The default memory size of hbase is 1 GB. The official documents clearly state that this is unable to support long-time normal operation, and it must trigger a ZooKeeper Session Timeout event, resulting in service exit. The document provides four suggestions that are not very useful: Increase the memory size (but do not tell how much to add, the more it is, the better) and ensure that swap partitions are not used (but my hard disk is SSD ).
The default memory size of hbase is 1 GB. The official documents clearly state that this is unable to support long-time normal operation, and it must trigger a ZooKeeper Session Timeout event, resulting in service exit. The document provides four suggestions that are not very useful: Increase the memory size (but do not tell how much to add, the more it is, the better) and ensure that swap partitions are not used (but my hard disk is SSD ).
The default memory size of hbase is 1 GB. The official documents clearly state that this is unable to support long-time normal operation, and it must trigger a ZooKeeper Session Timeout event, resulting in service exit.
The document provides four very useful suggestions:
Increase the memory size (but do not tell how much to add, the more it is, the better). Make sure not to use swap partitions (but my hard disk is SSD, which is not much slower than the memory) make sure there are idle CPUs. (What should I do if there are few CPUs ?) Extend the ZooKeeper timeout wait time (this is useful, and it is harmless to extend it as appropriate)
Since it is an event caused by JVM memory reclaim, optimize the JVM parameters to solve it! Take the default 1 GB memory as an example.
Set the Xmn value to 150 M:
Export HBASE_OPTS = "-Xmn150m"
Set GC parameters:
Export SERVER_GC_OPTS = "-XX: CMSInitiatingOccupancyFraction = 80-XX: + UseParNewGC-XX: + UseConcMarkSweepGC"
Explanations:
-The size of the Xmn150m young generation is 150 MB.
"-XX: CMSInitiatingOccupancyFraction = 80 the old generation uses 80% to recycle memory
(1-150 M for the young generation/(1000 M for the total memory-150 M for the young generation) * 100 = 82.35> 80
Make sure that there is a margin to execute the tasks that appear at this time when recycling
-XX: + UseParNewGC: Set the young generation for concurrent collection
-XX: + UseConcMarkSweepGC: set the age for concurrent collection
In this way, hardware resources can be used to support normal operation to the maximum extent.Try it now!