Why is Tomcat 4.0 so slow when connecting via a URLConnection?

Darren Hobbs

Question continues:
When connecting to a servlet running under Tomcat 4.0.1 via a URLConnection ie:
URLConnection conn = (new URL("http://tomcatserver:8080/myapp/servlet1")).openConnection());
Response and connection speed seems very slow, especially with multiple client threads. How can this be improved?

You have to edit the server.xml file in the conf directory of your tomcat installation.
Find the entry that starts like this:

<Connector className="org.apache.catalina.connector.http.HttpConnector"
Check (and if necessary add) the following attribute:
allowChunking="false"

HTTP Chunking is supposed to improve performance when connecting with a HTTP 1.1 client (ie. a modern web browser), but appears to drastically reduce performance when connecting directly using Java connections.

I also use the following settings, but your mileage may vary:

tcpNoDelay="true"
debug="0"
minProcessors="50"
maxProcessors="250"
acceptCount="250"
enableLookups="false"
debug="0"
connectionTimeout="60000"
bufferSize="8192"
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact