Apache Tomcat Performance Tuning

The proper Tomcat JVM configuration is essential for getting the most out of your server.  
Before you start changing any settings, you should make sure that you have chosen the most logical JVM for your site's needs.  There are a growing number of JVM vendors, and if you do not require any JDK-specific functionality, it is a good idea to run some benchmarks and see which solution gives you the best performance.  Also, make sure to upgrade to the latest stable release of your JVM, as this may give you a sizable performance boost right away. 
Next, consider experimenting with your JVM threading configuration.  If your JVM supports both green and native threads, you should try both models to determine the best choice for your site.  If you are running I/O bound applications, the native thread model should offer you improved performance.  However, green threads will decrease the load placed on your machine.  If you are unsure which option to choose, native threads are usually a good choice.
Certain JVM processes, such as garbage collection and memory reallocation, can be a drain on your server.  You can reduce the frequency with which these processes occur by using the -Xmx and -Xms switches to control how JVM handles its heap memory.
JVM garbage collection can use up valuable CPU power that you want being used to serve web requests.  To reduce the frequency with which JVM invokes garbage collection, Use the -Xmx switch to start the JVM with a higher maximum heap memory.  This will free up CPU time for the processes you really care about.

No comments:

Post a Comment

Please Provide your feedback here