HBase tuning|HBase + G1GC performance tuning

                 

At present, Xiaomi has started to use the G1 garbage collection algorithm on a large scale online, and I have seen some friends discussing various problems encountered when using G1 in the forum. Here I plan to write an article to record some of the experience of reducing G1.
Let’s start with the portal. I shared a G1GC tuning PPT in HBaseConAsia2017: 

http://openinx.github.io/2012/01/01/my-share/
First of all, students who are not familiar with the G1 algorithm can read Oracle's G1 algorithm tutorial carefully. The tutorial basically explains the operating principle of G1 and the essential difference from CMS. If you are interested in the details of the algorithm, you can read Garbage-First Garbage Collection. In this paper, the G1 implementation of JVM should be based on this paper.

In order to facilitate statistics of G1GC log information, we need to enable all the following G1 parameters:

-Xmx30g -Xms30g
-XX:MaxDirectMemorySize=30g
-XX:+UseG1GC
-XX:+UnlockExperimentalVMOptions
-XX:MaxGCPauseMillis=90
-XX:G1NewSizePercent=8
-XX:InitiatingHeapOccupancyPercent=30
-XX:+ParallelRefProcEnabled
-XX:ConcGCThreads=4
-XX:ParallelGCThreads=16
-XX:MaxTenuringThreshold=1
-XX:G1HeapRegionSize=32m
-XX:G1MixedGCCountTarget=64
-XX:G1OldCSetRegionThresholdPercent=5

Among them, the key parameters that need to be tuned are:
1.  G1NewSizePercent  : The Young area size of G1 is adaptively determined by an algorithm, that is, the young size after the Young area is determined according to the time spent in the Young area GC. If it takes too long, Then adjust the Young area smaller, if the time is too short, adjust the Young area larger. This parameter represents the minimum percentage of Young.
2.  InitiatingHeapOccupancyPercent : When the occupied memory exceeds this percentage, G1 starts to execute multiple Mixed GCs to organize the memory of the old generation Fragmentation.
3.  G1MixedGCCountTarget : When the occupied memory exceeds the InitiatingHeapOccupancyPercent threshold, how many times Mixed GC can be used to control the memory below the threshold.
4.  MaxTenuringThreshold : When the algebra of an object gc exceeds this value, the object Move from the young area to the old area.
5.  G1HeapRegionSize : Indicates how much G1 divides each Region into. Note that the unit must be written, such as 32m.
Since the value range of each parameter is very wide, for example, G1NewSizePercent can generally range from 0 to 10 (or even larger), and there are many parameters. Therefore, we write a script to modify each parameter, and then automatically restart, And record the test start time and end time of each parameter. You only need to automatically analyze the gc log through the tool later. Here, the script will only adjust one parameter at a time, then restart the entire cluster, and then use the PerformanceEvaluation tool to perform stress testing , The stress test will run for an hour. After the run, adjust the next parameter, and then run again. The
script address is here: 

https://github.com/openinx/scripts/blob/master/java-g1gc-tuning.py
After running all the parameters, you need to use tools to analyze the G1 log in the future. Before HubSpot developed a Python tool called gc_log_visualizer  , this tool extracts log data through regularization, and then draws it into a monitoring graph, which is more convenient to view the global G1 status.


image

Everyone who encounters HBase technical problems during work and study, post the problems to the HBase technical community forum http://hbase.group , and welcome everyone to ask questions and leave comments on the forum for discussion. If you want to learn more about HBase technology, follow the official account of the HBase technology community (WeChat ID: hbasegroup ), and you are very welcome to contribute actively.


Guess you like

Origin blog.51cto.com/15060465/2676760