Tuning Apache Tomcat – Reduce Network Calls

July 29, 2013 | By kiranbadi1991 | Filed in: Development, Environment, Performance Engineering, Web Server.

One of the ways to gain the response time by couple of milliseconds is to reduce the unnecessary calls back and forth in the network. Whenever the application is deployed in Apache Tomcat, I would suggest that you disable the enableLookups flag of connector element in server.xml of the Server. This is cheap way to gain couple of milliseconds in performance depending on the your network speed. If your server or users are slow network, then obviously you should be gaining in seconds, however for high speed network, you should be able to gain at least close to 200ms minimum.(My experiments showed 200ms gain minimum).

Whenever the application is deployed in Apache Tomcat, it logs information about the client’s ip or host name by querying the DNS servers. This query often adds couple of milliseconds to your transaction response time behind the scene. We can disable this roundtrip by setting the enableLookups flag to false in server.xml for connector element.

Below is sample server xml connector tag where changes needs to be done,

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

By Default the enableLookups flag is set to true. Once the change is done, ensure that you restart the server.

However if you want to implement this change, ensure that you access impact on application correctly since if your application is mining the client’s data , then this change might break your application. By setting enableLookups to false, you will not be able to get the client’s host name details.

Tags: , ,

Comments are closed here.