HBASE-5267 Add a configuration to disable the slab cache by default (Li Pi)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1241644 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-02-07 21:41:45 +00:00
parent e8b6a99539
commit b4f585e6a3
4 changed files with 13 additions and 4 deletions

View File

@ -45,7 +45,7 @@ export HBASE_OPTS="-XX:+UseConcMarkSweepGC"
# 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

View File

@ -171,7 +171,7 @@ The block size default size has been changed in 0.92.0 from 0.2 (20 percent of h
</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 its 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>

View File

@ -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));

View File

@ -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>