Tuesday, September 22, 2009

Tomcat Performance parameters

1:DNS Lookups

When your webserver logs the information about the client, it can either log
the client’s numeric IP address or look up the actual host name in the Domain Name
Service. DNS lookups require network traffic, involving a round-trip response
from multiple servers, possibly far away and possibly inoperative, resulting in delays.

find this part of the server.xml file:

Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="true" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />







Just change the enableLookups value from "true" to "false", and restart Tomcat. No
more DNS lookups and their resulting delays!

2: Number of threads

We can control the number of threads that are allocated by changing a Connector’s
minThreads and maxThreads values.This setting is totally depend upon traffic that your application handles.

3: Precompile your JSP

When a JSP is first accessed, it is converted into Java servlet source code, which must then be compiled into Java bytecode.

For example, if you want index.jsp (in the root of your webapp’s directory) to always
be precompiled at webapp startup time, you can add a tag for this file in
your web.xml file, like this:

?servlet?
?servlet-name?index.jsp?/servlet-name?
?jsp-file?/index.jsp?/jsp-file?
?load-on-startup?0?/load-on-startup?
?/servlet?


Enjoy tomcat!!!!!!!!!