Internal Tuning
This section details a specific set of techniques that will help your Tomcat instance run faster, regardless of the operating system or JVM you are using. In many cases, you may not have control of the OS or JVM on the machine you are deploying to. In those situations, you should still make recommendations in line with what was detailed in the last section; however, you still should be able to affect changes in Tomcat itself. Here is where we think are the best places to start internally tuning Tomcat.
Disabling DNS Lookups
When a web application wants to log 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
data. DNS lookups require network traffic, involving a round-trip response from multiple
servers, possibly far away and possibly inoperative, resulting in delays. To disable these
delays you can turn off DNS lookups. Then, whenever a web application calls the getRemoteHost( ) method in the HTTP request object, it will
only get the numeric IP address. This is set in the Connector object for your application, in Tomcat's
server.xml file. For the common java.io HTTP 1.1 connector, use the
enableLookups attribute. Just find this part of the
server.xml file:
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="true" redirectPort="8443" acceptCount="100" ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access