1. Tuning Java Hotspot G1 GC for BigData
A HBase Case Study
Yanping Wang (Intel/Data Center Java Technologies)
Liqi Yi (Intel/Data Center Java Technologies)
Yu Zhang (Oracle/Java GC performance)
3. In 2014, IEEE Spectrum
weighted and combined
12 metrics from
10 sources and ranked
the most popular
programming
languages. (http://spectrum.iee
e.org/computing/software/top-10-
programming-languages)
The #1 is: Java
Why Java?
5. HBase G1 Tuning Case
GC Pause Before GC Pause After
Throughput Latency
6. HBase configuration and Jdk8u40 build 23
Hotspot G1 GC: jdk8u40 build 23 https://jdk8.java.net/download.html
• Single Socket Intel® Xeon® Ivy-bridge EP processor,
serves as datanode and regionserver, 128 GB DDR3-
1600 RAM, three 400GB SSDs as HDFS storage.
• Apache HBase version 0.98.3-hadoop2 and HDFS 2.2.0
for HFile storage.
• HBase test table was configured as 400 million rows, and
it was 580GB in size. Snappy codec was used to
compress the HFiles, and short-circuit read was enabled
for faster HDFS block access
• Default HBase heap strategy: 40% for blockcache, 40%
for memstore, no off-heap caches.
• YCSB client, residing on a separate system, was used to
drive 600 work threads sending 50% read and 50% Write
requests to the HBase regionserver for 3600 seconds
7. G1 Concepts
Heap is divided to ~2K non-contiguous eden, survivor, and old
spaces, region size can be 1MB, 2MB, 4MB, 8MB, 16MB,
32MB
Humongous regions are old regions for large objects that are
larger than 1/2 of region size. Humongous objects are stored
in contiguous regions in heap.
Number of regions in eden and survivor can be changed
between GC’s
Young GC starts when eden is full, , live objects from eden
and survivor regions are evacuated to a set of unused regions
which becomes the new survivor regions
Concurrent cycle starts when heap is 45% full (by default)
After concurrent cycle, mixed GC starts, old regions are
collected at the same time as minor GCs
Full GC starts when heap is 95% full or heap allocation failure
8. G1 Command line Options
To get start:
-XX:+UseG1GC -Xms -Xmx
-XX:MaxGCPauseMillis (default 200ms)
-XX:ParallelGCThreads=? -
XX:+ParallelRefProcEnabled
To Print GC information in log:
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -
XX:+PrintGCTimeStamps -XX:+PrintReferenceGC -
XX:+PrintAdaptiveSizePolicy
First Line G1 Tuning Flags
-XX:G1HeapWastePercent (default 5)
-XX:InitiatingHeapOccupancyPercent (default 45%)
-XX:G1MixedGCLiveThresholdPercent (default 85)
-XX:ConcGCThreads (default ~1/4 of parallel threads)
-XX:G1MixedGCCountTarget (default 8)
9. HBase G1 Tuning Case
GC Pause Before GC Pause After
Throughput Latency
10. HBase G1 Tuning Case
(A single G1 Tuning Flag can make huge
difference)
Before Tuning: -
XX:+UseG1GC -Xms100g -
Xmx100g -
XX:MaxGCPauseMillis=100 -
XX:ParallelGCThreads=16 -
XX:+ParallelRefProcEnabled
AfterTuning: -
XX:+UseG1GC -Xms100g -
Xmx100g -
XX:MaxGCPauseMillis=100 -
XX:ParallelGCThreads=16 -
XX:+ParallelRefProcEnabled
-
XX:G1HeapWastePercent=2
29.3% reduction of total GC pause time
18.6% Throughput improvement
15.7% Latency reduction
Much tamed GC behavior, improved HBase performance
11. Questions?
Join the OpenJDK community:
http://openJDK.java.net/
GC Tuning email list: hotspot-gc-use@openjdk.java.net
Contribute & Get the latest source:
http://hg.openJDK.java.net/jdk9/hs-gc/hotspot
Contact: yanping.wang@intel.com
liqi.yi@intel.com