I write this article is aiming to help you understand how to ameliorate your Tomcat performance.
I’m going to write it as simple as possible so that you can understand what I’m talking about even with a glance.
Unlike other technical articles, you won’t be lost in a terminological jungle. Instead, you will stand on the top of a mountain so that you can see the full landscape of this field.
To make a long story short, let’s begin with a example below:
You could image Tomcat is a bottle, if you want to put more water into it and pour the water out as fast as possible within certain seconds, there are two factors that you need to consider:
- The size of bottle neck.
- The volume of the bottle itself.
So equally, tuning a Tomcat server, you could only focus on two factors.
- Connector. –> The bottle neck, defined in server.xml.
- JVM(Max Memory Pool). –> The volume, defined in Java Options.
To increase the bottle neck size, go to /conf/server.xml.
First, uncomment the following line to tell the system that you are going to use self-defined executor(Executor is the guard of connector). By default, executor is disabled.
Note: Generally, maxThreads=”500″ minSpareThreads=”20″ maxIdleTime=”60000″ are enough.
<Executor name=”tomcatThreadPool” namePrefix=”catalina-exec-” maxThreads=”500″ minSpareThreads=”20″ maxIdleTime=”60000″ />
Then, change connection timeout value like the following example.
<Connector executor=”tomcatThreadPool” port=”8080″ protocol=”HTTP/1.1″ connectionTimeout=”60000″ keepAliveTimeout=”15000″ maxKeepAliveRequests=”1″ redirectPort=”8443″ />
To increase the bottle volume, you can check the following two KBs due to OS type accordingly.
- Windows: 1921501 – Default Java Options for Tomcat for BI4
- Linux/AIX: 1750952 – BI4 Setting JAVA_OPTS for tomcat
Concerning the proper JVM size, please go to the following KB to know the details.
2405536 – Best Practice: The popular combinations of Tomcat Max Memory Pool size and MaxPermSize .