From 1dda6beb585a095981fbfde4fd640fe93fa75816 Mon Sep 17 00:00:00 2001 From: Nick Dimiduk Date: Sat, 25 Jan 2014 18:27:24 -0800 Subject: [PATCH] HBASE-10392 Correct references to hbase.regionserver.global.memstore.upperLimit --- .../java/org/apache/hadoop/hbase/HBaseConfiguration.java | 15 ++++++++++----- .../apache/hadoop/hbase/regionserver/MemStoreFlusher.java | 11 ++++++----- src/main/docbkx/community.xml | 2 +- src/main/docbkx/ops_mgt.xml | 2 +- src/main/docbkx/performance.xml | 12 ++++++------ 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java index a436901..43efe1b 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java @@ -74,8 +74,13 @@ public class HBaseConfiguration extends Configuration { } private static void checkForClusterFreeMemoryLimit(Configuration conf) { - float globalMemstoreLimit = conf.getFloat("hbase.regionserver.global.memstore.upperLimit", 0.4f); - int gml = (int)(globalMemstoreLimit * CONVERT_TO_PERCENTAGE); + if (conf.get("hbase.regionserver.global.memstore.upperLimit") != null) { + LOG.warn("hbase.regionserver.global.memstore.upperLimit is deprecated by " + + "hbase.regionserver.global.memstore.size"); + } + float globalMemstoreSize = conf.getFloat("hbase.regionserver.global.memstore.size", + conf.getFloat("hbase.regionserver.global.memstore.upperLimit", 0.4f)); + int gml = (int)(globalMemstoreSize * CONVERT_TO_PERCENTAGE); float blockCacheUpperLimit = conf.getFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, HConstants.HFILE_BLOCK_CACHE_SIZE_DEFAULT); @@ -87,10 +92,10 @@ public class HBaseConfiguration extends Configuration { "Current heap configuration for MemStore and BlockCache exceeds " + "the threshold required for successful cluster operation. " + "The combined value cannot exceed 0.8. Please check " + - "the settings for hbase.regionserver.global.memstore.upperLimit and " + + "the settings for hbase.regionserver.global.memstore.size and " + "hfile.block.cache.size in your configuration. " + - "hbase.regionserver.global.memstore.upperLimit is " + - globalMemstoreLimit + + "hbase.regionserver.global.memstore.size is " + + globalMemstoreSize + " hfile.block.cache.size is " + blockCacheUpperLimit); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java index a8457c6..0c42a75 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java @@ -132,12 +132,13 @@ class MemStoreFlusher implements FlushRequester { } /** - * Calculate global memstore size for configured percentage of max. - * @param max - * @param c - * @return Limit. + * Retrieve global memstore configured size as percentage of total heap. */ static float getGlobalMemStorePercent(final Configuration c) { + String oldValue = c.get(MEMSTORE_SIZE_OLD_KEY); + if (oldValue != null) { + LOG.warn(MEMSTORE_SIZE_OLD_KEY + " is deprecated by " + MEMSTORE_SIZE_KEY); + } float limit = c.getFloat(MEMSTORE_SIZE_KEY, c.getFloat(MEMSTORE_SIZE_OLD_KEY, DEFAULT_MEMSTORE_SIZE)); if (limit > 0.8f || limit < 0.05f) { @@ -737,4 +738,4 @@ class MemStoreFlusher implements FlushRequester { enum FlushType { NORMAL, ABOVE_LOWER_MARK, ABOVE_HIGHER_MARK; -} \ No newline at end of file +} diff --git a/src/main/docbkx/community.xml b/src/main/docbkx/community.xml index c32970f..9561e38 100644 --- a/src/main/docbkx/community.xml +++ b/src/main/docbkx/community.xml @@ -142,7 +142,7 @@ dev list and we'll sign you up. Owners do not need to be committers. We agreed to the following SVN commit message format: HBASE-xxxxx <title>. (<contributor>) -If the person making the commit is the contributor, leave off the '()' element. +If the person making the commit is the contributor, leave off the '(<contributor>)' element. diff --git a/src/main/docbkx/ops_mgt.xml b/src/main/docbkx/ops_mgt.xml index c12f8d4..7395fc8 100644 --- a/src/main/docbkx/ops_mgt.xml +++ b/src/main/docbkx/ops_mgt.xml @@ -1051,7 +1051,7 @@ false When configuring regions for multiple tables, note that most region settings can be set on a per-table basis via HTableDescriptor, as well as shell commands. These settings will override the ones in hbase-site.xml. That is useful if your tables have different workloads/use cases. Also note that in the discussion of region sizes here, HDFS replication factor is not (and should not be) taken into account, whereas other factors should be. So, if your data is compressed and replicated 3 ways by HDFS, "9 Gb region" means 9 Gb of compressed data. HDFS replication factor only affects your disk usage and is invisible to most HBase code.
Number of regions per RS - upper bound -In production scenarios, where you have a lot of data, you are normally concerned with the maximum number of regions you can have per server. has technical discussion on the subject; in short, maximum number of regions is mostly determined by memstore memory usage. Each region has its own memstores; these grow up to a configurable size; usually in 128-256Mb range, see . There's one memstore per column family (so there's only one per region if there's one CF in the table). RS dedicates some fraction of total memory (see ) to region memstores. If this memory is exceeded (too much memstore usage), undesirable consequences such as unresponsive server, or later compaction storms, can result. Thus, a good starting point for the number of regions per RS (assuming one table) is (RS memory)*(total memstore fraction)/((memstore size)*(# column families)) +In production scenarios, where you have a lot of data, you are normally concerned with the maximum number of regions you can have per server. has technical discussion on the subject; in short, maximum number of regions is mostly determined by memstore memory usage. Each region has its own memstores; these grow up to a configurable size; usually in 128-256Mb range, see . There's one memstore per column family (so there's only one per region if there's one CF in the table). RS dedicates some fraction of total memory (see ) to region memstores. If this memory is exceeded (too much memstore usage), undesirable consequences such as unresponsive server, or later compaction storms, can result. Thus, a good starting point for the number of regions per RS (assuming one table) is (RS memory)*(total memstore fraction)/((memstore size)*(# column families)) E.g. if RS has 16Gb RAM, with default settings, it is 16384*0.4/128 ~ 51 regions per RS is a starting point. The formula can be extended to multiple tables; if they all have the same configuration, just use total number of families. This number can be adjusted; the formula above assumes all your regions are filled at approximately the same rate. If only a fraction of your regions are going to be actively written to, you can divide the result by that fraction to get a larger region count. Then, even if all regions are written to, all region memstores are not filled evenly, and eventually jitter appears even if they are (due to limited number of concurrent flushes). Thus, one can have as many as 2-3 times more regions than the starting point; however, increased numbers carry increased risk. For write-heavy workload, memstore fraction can be increased in configuration at the expense of block cache; this will also allow one to have more regions. diff --git a/src/main/docbkx/performance.xml b/src/main/docbkx/performance.xml index 58656a7..95dfef0 100644 --- a/src/main/docbkx/performance.xml +++ b/src/main/docbkx/performance.xml @@ -175,15 +175,15 @@ A memory setting for the RegionServer process.
-
- <varname>hbase.regionserver.global.memstore.upperLimit</varname> - See . +
+ <varname>hbase.regionserver.global.memstore.size</varname> + See . This memory setting is often adjusted for the RegionServer process depending on needs.
-
- <varname>hbase.regionserver.global.memstore.lowerLimit</varname> - See . +
+ <varname>hbase.regionserver.global.memstore.size.lower.limit</varname> + See . This memory setting is often adjusted for the RegionServer process depending on needs.
-- 1.8.5.1