Wednesday, September 12, 2012

A Case Study of Using Tiered Compilation in HotSpot

Hotspot has two JITs named c1 (i.e., client JIT) and c2 (i.e., server JIT).[1] The client JIT starts fast but provides less optimizations. So, it is used for GUI application. The server JIT starts more slowly but provide very good optimizations. The idea of tiered compilation [2]is to get the best of both compilers, first JITs the code with c1 and then if the code is really hot to recompile it with c2.

The tiered server runtime is enabled with the following Hotspot VM options:
  • -server -XX:+TieredCompilation
In this article, we show a case study of using HotSpot (build 23.0-b18, mixed mode) with TieredCompilation off/on.

Comparison

You can tune JVM's performance by tuning either memory management or code generaion.  Here we have tuned code generator by turning tiered compilation mode on.  With tiered compilation on, more classes are compiled (or compiled more efficiently) and so they execute faster (i.e., +15%).

Using ATG CRM Demo benchmark, we saw the following KPI changes:



-XX:-TieredCompilation

-XX:+TieredCompilation

% Change

Total Footprint

4431MB

4686MB

-5.4%

Application Server CPU

23%

20%

+15%

Average Response Time

0.234

0.217

+7.8%

Notes


  1. Here is our setting for ReservedCodeCacheSize[2]:
    -TieredCompilation: 128MB
    +TieredCompilation: 256MB
  2. When we turned on tiered compilation mode, we also reserve larger code cache for it (i.e., 256 MB vs. 128 MB).  Code cache is allocated out of native memory (vs. heap).  Total footprint shown in the table includes native memory.  So, we see total footprint is larger when tiered compilation mode is turned on.

References

  1. HotSpot Glossary of Terms
  2. Performance Tuning with Hotspot VM Option: -XX:+TieredCompilation (Xml and More)

1 comment:

Blogger said...

Did you know you can shorten your links with Shortest and receive cash for every visitor to your short urls.