HBASE-27805 The chunk created by mslab may cause memory fragement and lead to fullgc
diff --git a/hbase-common/src/main/resources/hbase-default.xml b/hbase-common/src/main/resources/hbase-default.xml
index a4ee0c8..c527946 100644
--- a/hbase-common/src/main/resources/hbase-default.xml
+++ b/hbase-common/src/main/resources/hbase-default.xml
@@ -755,8 +755,12 @@
</property>
<property>
<name>hbase.hregion.memstore.mslab.chunksize</name>
- <value>2097152</value>
- <description>The maximum byte size of a chunk in the MemStoreLAB. Unit: bytes</description>
+ <value>2096128</value>
+ <description>
+ The maximum byte size of a chunk in the MemStoreLAB.
+ Use 2047k as the default because 2m may cause memory fragmentation in some cases.
+ Unit: bytes
+ </description>
</property>
<property>
<name>hbase.regionserver.offheap.global.memstore.size</name>
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java
index 4edefaf..8928559 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java
@@ -51,7 +51,7 @@
String MSLAB_CLASS_NAME = "hbase.regionserver.mslab.class";
String CHUNK_SIZE_KEY = "hbase.hregion.memstore.mslab.chunksize";
- int CHUNK_SIZE_DEFAULT = 2048 * 1024;
+ int CHUNK_SIZE_DEFAULT = 2047 * 1024;
String INDEX_CHUNK_SIZE_PERCENTAGE_KEY = "hbase.hregion.memstore.mslab.indexchunksize.percent";
float INDEX_CHUNK_SIZE_PERCENTAGE_DEFAULT = 0.1f;
String MAX_ALLOC_KEY = "hbase.hregion.memstore.mslab.max.allocation";
diff --git a/src/main/asciidoc/_chapters/offheap_read_write.adoc b/src/main/asciidoc/_chapters/offheap_read_write.adoc
index bea47c4..f4288d3 100644
--- a/src/main/asciidoc/_chapters/offheap_read_write.adoc
+++ b/src/main/asciidoc/_chapters/offheap_read_write.adoc
@@ -213,7 +213,8 @@
MaxDirectMemorySize property (see <<hbase.offheapsize>> for more on _HBASE_OFFHEAPSIZE_). The default value of
`hbase.regionserver.offheap.global.memstore.size` is 0 which means MSLAB uses onheap, not offheap, chunks by default.
-`hbase.hregion.memstore.mslab.chunksize` controls the size of each off-heap chunk. Default is `2097152` (2MB).
+`hbase.hregion.memstore.mslab.chunksize` controls the size of each off-heap chunk. Default is `2096128` (that's 2047KB, why not 2MB?
+see link:https://issues.apache.org/jira/browse/HBASE-27805[HBASE-27805] for more detail).
When a Cell is added to a MemStore, the bytes for that Cell are copied into these off-heap buffers (if `hbase.regionserver.offheap.global.memstore.size` is non-zero)
and a Cell POJO will refer to this memory area. This can greatly reduce the on-heap occupancy of the MemStores and reduce the total heap utilization for RegionServers