Author: tedyu Date: Tue Feb 7 21:41:45 2012 New Revision: 1241644 URL: http://svn.apache.org/viewvc?rev=1241644&view=rev Log: HBASE-5267 Add a configuration to disable the slab cache by default (Li Pi)
Modified: hbase/trunk/conf/hbase-env.sh hbase/trunk/src/docbkx/upgrading.xml hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java hbase/trunk/src/main/resources/hbase-default.xml Modified: hbase/trunk/conf/hbase-env.sh URL: http://svn.apache.org/viewvc/hbase/trunk/conf/hbase-env.sh?rev=1241644&r1=1241643&r2=1241644&view=diff ============================================================================== --- hbase/trunk/conf/hbase-env.sh (original) +++ hbase/trunk/conf/hbase-env.sh Tue Feb 7 21:41:45 2012 @@ -45,7 +45,7 @@ export HBASE_OPTS="-XX:+UseConcMarkSweep # Uncomment below if you intend to use the EXPERIMENTAL off heap cache. # export HBASE_OPTS="$HBASE_OPTS -XX:MaxDirectMemorySize=" -# Set hbase.offheapcachesize in hbase-site.xml +# Set hbase.offheapcache.percentage in hbase-site.xml to a nonzero value. # Uncomment and adjust to enable JMX exporting Modified: hbase/trunk/src/docbkx/upgrading.xml URL: http://svn.apache.org/viewvc/hbase/trunk/src/docbkx/upgrading.xml?rev=1241644&r1=1241643&r2=1241644&view=diff ============================================================================== --- hbase/trunk/src/docbkx/upgrading.xml (original) +++ hbase/trunk/src/docbkx/upgrading.xml Tue Feb 7 21:41:45 2012 @@ -171,7 +171,7 @@ The block size default size has been cha </title> <para> A new cache was contributed to 0.92.0 to act as a solution between using the âon-heapâ cache which is the current LRU cache the region servers have and the operating system cache which is out of our control. -To enable, set â-XX:MaxDirectMemorySizeâ in hbase-env.sh to the value that you want to dedicate to that cache. This should only be set for servers and not for clients; in fact, if you already had to add that configuration on for any reason and still use it today itâs going to enable this feature. Use at your own risk. +To enable, set â-XX:MaxDirectMemorySizeâ in hbase-env.sh to the value for maximum direct memory size and specify hbase.offheapcache.percentage in hbase-site.xml with the percentage that you want to dedicate to off-heap cache. This should only be set for servers and not for clients. Use at your own risk. See this blog post for additional information on this new experimental feature: http://www.cloudera.com/blog/2012/01/caching-in-hbase-slabcache/ </para> </section> Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java?rev=1241644&r1=1241643&r2=1241644&view=diff ============================================================================== --- hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java (original) +++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java Tue Feb 7 21:41:45 2012 @@ -329,7 +329,7 @@ public class CacheConfig { } if (cachePercentage > 1.0) { throw new IllegalArgumentException(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY + - " must be between 0.0 and 1.0, not > 1.0"); + " must be between 0.0 and 1.0, and not > 1.0"); } // Calculate the amount of heap to give the heap. @@ -338,7 +338,7 @@ public class CacheConfig { int blockSize = conf.getInt("hbase.offheapcache.minblocksize", HFile.DEFAULT_BLOCKSIZE); long offHeapCacheSize = - (long) (conf.getFloat("hbase.offheapcache.percentage", (float) 0.95) * + (long) (conf.getFloat("hbase.offheapcache.percentage", (float) 0) * DirectMemoryUtils.getDirectMemorySize()); LOG.info("Allocating LruBlockCache with maximum size " + StringUtils.humanReadableInt(cacheSize)); Modified: hbase/trunk/src/main/resources/hbase-default.xml URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-default.xml?rev=1241644&r1=1241643&r2=1241644&view=diff ============================================================================== --- hbase/trunk/src/main/resources/hbase-default.xml (original) +++ hbase/trunk/src/main/resources/hbase-default.xml Tue Feb 7 21:41:45 2012 @@ -851,4 +851,13 @@ hbase.thrift.maxQueuedRequests threads. </description> </property> + <property> + <name>hbase.offheapcache.percentage</name> + <value>0</value> + <description> + The amount of off heap space to be allocated towards the experimental + off heap cache. If you desire the cache to be disabled, simply set this + value to 0. + </description> + </property> </configuration>