Why does HttpURLConnection connect take a long time
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andy_Sun
Posted On:   Tuesday, June 25, 2002 12:50 PM

I am running a servlet under Tomcat4. The (HttpURLConnection) connection.connect() statement takes a long time, about 20-30 seconds, to finish. But when I run the URL in IE, it takes a second or two to get the response. How do I get around this? Thanks.

Re: Why does HttpURLConnection connect take a long time

Posted By:   Andy_Sun  
Posted On:   Wednesday, June 26, 2002 09:17 AM

It doesn't sound right. Tomcat is also using proxy. The IE and Tomcat app are referring to the same external URL. If it is cached by the proxy server, both should benefit.

Can not test IP because it's an external URL with name only.

But once the resource is accessed once on Tomcat, later access are much faster because connect has been executed, even though the URL is slightly modified with different parameters. But my question is still why does it take that long to connect to an internet resource.

Thanks.

Re: Why does HttpURLConnection connect take a long time

Posted By:   Christopher_Koenigsberg  
Posted On:   Wednesday, June 26, 2002 07:11 AM

DNS lookup? What if you try the IP address instead of the hostname, does it go a lot faster then? If so, that's a sure sign of a DNS lookup/config problem.



Or, another possibility: could it be that IE is using a proxy server, but Tomcat is going direct? and maybe the proxy server already has the page cached?

About | Sitemap | Contact