Tomcat Tuning Approach

How to Start Tomcat Tuning?

When you are prepared to run Tomcat server, you may need to do some performance tuning so that it serves all requests efficiently. Tomcat tuning is a complex one. It consists of measuring, proper understanding, changing and measuring again.

At the time of developing an application, we may define the application architecture, how the application is going to perform and the resources required for an application. Administrators should follow few thumb rules for increasing the performance.

Proper Logging and Monitoring

You must enable proper logging for Tomcat and this may help you in tracing the major issues that are about to occur in production environment. It is advised to monitor the system accordingly.

Knowledge base for the application and issue trends

A knowledge base is recommended for applications running 24×7. A good documentation for the application’s support is also recommended so that the team has same information regarding all the issues.

Following the problem management approach

It is a good approach to perform root cause analysis (RCA) for all the issues so that recurrence of such issues could be avoided in future.

Thread Tuning

Thread tuning plays a major role in improving Tomcat’s performance. Improper tuning of the thread may degrade the performance. The thread pool is defined as the ability of the web server to accept number of requests.

You can configure two types of thread pools such as shared pool and dedicated pool.

These configurations need to be performed in TOMCAT_HOME/conf/server.xml.

Increasing the Heap Size – Tomcat Tuning

To increase the heap size, we must add JAVA_OPTS parameter in catalina.sh, which could be found in TOMCAT_HOME/bin.

For instance, to increase max heap size to 512 MB and to set Perm Gen = 256 MB, the JAVA_OPTS parameter is:

JAVA_OPTS=”-Xms128m -Xmx512m -XX:MaxPermSize=256m”

Note: All the changes in configuration for the JVM parameter will take effect when you restart the Tomcat server. You can verify the changes done in the JVM parameter by running the jmap command.

OS Tuning – Part of Tomcat Tuning

Every operating system has its own prerequisites to run Tomcat server and has to be tuned according to the requirements.

Some useful tips:

64 bit versus 32 bit VM

We can address larger amounts of memory by using 64 bit VMs as compared to 32 bit VMs. In case of memory intensive applications, we can allocate more than 4 GB JVM for certain applications.

File size

As per the requirement of application, the file size is set in the operating system. If the application is using large number of transactions then we must increase the file limit.

Ulimits

Depending on the session, users can increase limits.

Huge page size

In many instances, applications usually send a large page size that may slow down your system. So the only option is to increase the page size as per the needs of an application.

Pages: 1 2 3

Leave a Reply

Your email address will not be published. Required fields are marked *