Skip navigation
VMware
0

Tomcat NIO Connector

Posted by haroldr Oct 13, 2010

In my recent whitepaper on Java performance, I used tc Server 2.0 as the deployment platform.  The underlying web container for tc Server 2.0 is Tomcat 6.0.24. In the course of my tuning experiments, I gathered some interesting results about the performance benefit of switching to Tomcat’s NIO HTTP connector.  These results are not specific to the virtualized environment, and I thought that they would be worth sharing.

 

The Tomcat HTTP connector provides a connection from clients using the HTTP protocol to the web applications.   Tomcat has three different implementations available for the HTTP connector.  There are the default Java HTTP connector, the high performance Java NIO HTTP connector, and the native APR HTTP connector.  \

 

I compared the peak throughput of my application (Olio) for native and virtual configurations with a single CPU using the default HTTP connector and the NIO HTTP connector.  The results are summarized in the chart below.  Switching from the default HTTP connector to the NIO HTTP connector resulted in a 150% to 200% increase in peak throughput.  No other tuning was done to achieve this increase.

 

 

Note that Olio is a very network intensive workload.  At peak-throughput, the 1-vCPU VM was, on average, receiving 85Mbps and transmitting 161Mbps. The benefit of switching to the NIO HTTP connector would likely be lower for less network intensive workloads. 

 

I learned two important lessons from these results.  The most obvious was that if you are using Tomcat, you should not be using the default HTTP connector.  The NIO HTTP connector can give an impressive performance boost, and the configuration changes needed to enable it are trivial.  I did not try the native APR HTTP connector. 

 

The second lesson was that the performance overheads introduced by virtualization are trivial compared to the potential impact of misconfiguration and poor tuning.  The same lesson could be drawn from my experiments on the performance impact of maximum heap-size.  I also saw improvements from database and file server tuning that, while less dramatic, also overshadowed the virtualization overhead.  While this isn’t really a surprise, it is useful to keep in mind when trying to improve the performance of virtualized applications.

1,272 Views 0 Comments Permalink Tags: performance, esx, java, tomcat, vi4, vsphere
2

The VMware best practices guide for deploying Java applications on ESX recommends enabling large pages, and the VMware whitepaper on large page performance gives a clear demonstration of the performance benefits of using large pages for Java on ESX.  However, when I talk to customers I often find they are not using large pages for their Java applications. 

 

The large page performance whitepaper used SPECjbb2005 as the benchmark workload, and showed a performance improvement of 8 to 10 percent when large pages were enabled.  While this is a useful result, SPECjbb2005 is a single node benchmark that doesn’t include any communication with external systems.  With the Olio Java application discussed in my recent whitepaper, I was able to investigate the impact of large pages on a multi-tier enterprise Java application.   Olio relies on an external database and file-server, and the workload includes significant network traffic. The results give a fresh demonstration of the benefit of large pages.   The chart below shows the benefit of enabling large pages for 1, 2, and 4–vCPU VMs, as well as for a fully loaded system with eight 2vCPU VMs, with the Olio workload.  The heap sizes used are discussed in my previous blog post.

 

The chart below shows that enabling large pages gives a 6 to 8 percent increase in peak throughput for Olio.  Obtaining this improvement required only a few simple configuration steps, and did not require allocating any additional memory to the VMs.

 

 

Enabling large pages is relatively simple, although the exact process varies depending on the operating system and JVM.  The large page performance whitepaper includes instructions for enabling large pages on Red Hat Linux and Windows 2003 Server.   This blog post also gives a good overview of the steps required to enable large pages for Linux and Java.  You should also be able to find the instructions in the documentation for your specific OS.  The key to remember is that large pages need to be enabled in both the OS and in the JVM.  For the Sun JVM the necessary command-line parameter is -XX:+UseLargePages, for JRocket it is -XXlargePages, and for IBM's JVM it is –lp.  Large-page support is enabled in VMware ESX by default.  When using these options, you should check the JVM logs carefully for error messages indicating that the JVM was not able to allocate large pages.

 

The bottom line is that enabling large pages is simple and can have a significant performance benefit.   If you are interested in improving the performance of your Java applications, enabling large pages should be your first step.

1,151 Views 2 Comments Permalink Tags: performance, esx, java, vi4, vsphere
0

Java heap-size and vCPU Count

Posted by haroldr Oct 1, 2010

In my recent whitepaper on enterprise Java performance on tc Server 2.0 and vSphere 4.1, I discuss tests that I ran with native and virtualized configurations using 1, 2, and 4 total CPUs.  The setup that I used when I collected the published results reflected the results of some tuning experiments that aren't covered in the paper.  At the JVM level, the two main tunings that I investigated were the maximum heap size, and the impact of using large pages.  In this blog I will look at the impact of changing the maximum heap-size.

 

As I mention in the paper, the application that I used was the Java version of Olio, a Java web application that implements a complete social networking website.  When choosing my JVM tunings, one of the first things that I wanted to understand was how changing the maximum Java heap size affected the peak number of Olio users that could be supported by the application. I also wanted to understand how changing the number of CPUs affected the choice of heap size.

 

The chart below shows the change in peak-throughput as I increased the maximum heap size for the different VM configurations.  In order to avoid confusion with the published results, which reflect additional test-bed tuning, I normalized all of the values to the lowest datapoint.

 

 

 

There are a few interesting observations to be made about this data. There is clearly a tradeoff to be made between heap size and performance.  However, after a certain point, the benefit of larger heap sizes is limited. Depending on memory availability, it may worthwhile to give up a bit of peak throughput in order to save memory.  This is particularly true if reducing the heap size, and therefore the VM’s total memory size, allows you to avoid over-committing memory on an ESX host.  While memory over-commit works well for most workloads, Java applications tend to suffer when ESX has to reclaim memory from the VM.

 

It is also clear that the same heap size won’t work for all VM configurations.  In my tests I chose to use a maximum heap size of 2048MB for a 1-vCPU VM, 2560MB for a 2-vCPU VM, and 4096MB for a 4-vCPU VM.  If I had used 2048MB for all three configurations, I would have lost about 5% off of the peak-throughput in the 2-vCPU case, and a painful 35% in the 4-vCPU case.  Of course, the specific heap-size needed, and the impact of changing the VM configuration and heap-size, will vary for different Java applications.  However, the message is clear.  When moving from one hardware configuration to another, it is important to re-assess the choice of maximum heap-size.  This is true whether you are changing the VM configuration, or moving from physical on one system to virtual on another.

785 Views 0 Comments Permalink Tags: performance, esx, java, vi4, vsphere
0

The performance team at VMware publishes a lot of great technical papers covering the performance of our products.  As an occasional author of one of these whitepapers, it is always nice to know that I am helping our customers to understand and get the best performance from our products. However, the whitepapers often represent only the key points from a large set of data and experiences that I collected over the course of a project.  I intend to use this blog to share interesting data and useful tips that may be too detailed for a whitepaper, but which I feel are worth sharing.

 

I recently published a whitepaper which looks at the performance of enterprise Java applications on vSphere 4.1.  I am going to use the next few installments of this blog to dive into some of the details that didn't make it into the paper.  I also invite my readers to ask questions about the paper, either in comments or through a private message, and I will try to answer them in future posts.  I am also the author of a vSphere performance-troubleshooting paper, and I would welcome questions about that document as well.

 

Thanks for reading.

 

Hal

101 Views 0 Comments Permalink Tags: performance, esx, java, vi4, vsphere


Communities