HBASE-11307 Deprecate SlabCache
This commit is contained in:
parent
8e547f3ba7
commit
632301f525
|
@ -515,6 +515,7 @@ public class CacheConfig {
|
||||||
GLOBAL_BLOCK_CACHE_INSTANCE = lruCache;
|
GLOBAL_BLOCK_CACHE_INSTANCE = lruCache;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
LOG.warn("SlabCache is deprecated. Consider BucketCache as a replacement.");
|
||||||
GLOBAL_BLOCK_CACHE_INSTANCE = new DoubleBlockCache(
|
GLOBAL_BLOCK_CACHE_INSTANCE = new DoubleBlockCache(
|
||||||
lruCacheSize, slabCacheOffHeapCacheSize, blockSize, blockSize, conf);
|
lruCacheSize, slabCacheOffHeapCacheSize, blockSize, blockSize, conf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,10 @@ import org.apache.hadoop.util.StringUtils;
|
||||||
* cache before looking for the block in the off heap cache. Metrics are the
|
* cache before looking for the block in the off heap cache. Metrics are the
|
||||||
* combined size and hits and misses of both caches.
|
* combined size and hits and misses of both caches.
|
||||||
*
|
*
|
||||||
**/
|
* @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}.
|
||||||
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
|
@Deprecated
|
||||||
public class DoubleBlockCache implements ResizableBlockCache, HeapSize {
|
public class DoubleBlockCache implements ResizableBlockCache, HeapSize {
|
||||||
|
|
||||||
static final Log LOG = LogFactory.getLog(DoubleBlockCache.class.getName());
|
static final Log LOG = LogFactory.getLog(DoubleBlockCache.class.getName());
|
||||||
|
@ -178,4 +180,4 @@ public class DoubleBlockCache implements ResizableBlockCache, HeapSize {
|
||||||
public BlockCache[] getBlockCaches() {
|
public BlockCache[] getBlockCaches() {
|
||||||
return new BlockCache [] {this.onHeapCache, this.offHeapCache};
|
return new BlockCache [] {this.onHeapCache, this.offHeapCache};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,10 @@ import com.google.common.cache.RemovalNotification;
|
||||||
* Eviction and LRUness is taken care of by Guava's MapMaker, which creates a
|
* Eviction and LRUness is taken care of by Guava's MapMaker, which creates a
|
||||||
* ConcurrentLinkedHashMap.
|
* ConcurrentLinkedHashMap.
|
||||||
*
|
*
|
||||||
|
* @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}.
|
||||||
**/
|
**/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
|
@Deprecated
|
||||||
public class SingleSizeCache implements BlockCache, HeapSize {
|
public class SingleSizeCache implements BlockCache, HeapSize {
|
||||||
private final Slab backingStore;
|
private final Slab backingStore;
|
||||||
private final ConcurrentMap<BlockCacheKey, CacheablePair> backingMap;
|
private final ConcurrentMap<BlockCacheKey, CacheablePair> backingMap;
|
||||||
|
@ -350,4 +352,4 @@ public class SingleSizeCache implements BlockCache, HeapSize {
|
||||||
public BlockCache[] getBlockCaches() {
|
public BlockCache[] getBlockCaches() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,11 @@ import com.google.common.base.Preconditions;
|
||||||
* Slab is a class which is designed to allocate blocks of a certain size.
|
* Slab is a class which is designed to allocate blocks of a certain size.
|
||||||
* Constructor creates a number of DirectByteBuffers and slices them into the
|
* Constructor creates a number of DirectByteBuffers and slices them into the
|
||||||
* requisite size, then puts them all in a buffer.
|
* requisite size, then puts them all in a buffer.
|
||||||
**/
|
*
|
||||||
|
* @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}.
|
||||||
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
|
@Deprecated
|
||||||
class Slab implements org.apache.hadoop.hbase.io.HeapSize {
|
class Slab implements org.apache.hadoop.hbase.io.HeapSize {
|
||||||
static final Log LOG = LogFactory.getLog(Slab.class);
|
static final Log LOG = LogFactory.getLog(Slab.class);
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,10 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
*
|
*
|
||||||
* <p>It is configured with a call to {@link #addSlab(int, int)}
|
* <p>It is configured with a call to {@link #addSlab(int, int)}
|
||||||
*
|
*
|
||||||
**/
|
* @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}.
|
||||||
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
|
@Deprecated
|
||||||
public class SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize {
|
public class SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize {
|
||||||
private final ConcurrentHashMap<BlockCacheKey, SingleSizeCache> backingStore;
|
private final ConcurrentHashMap<BlockCacheKey, SingleSizeCache> backingStore;
|
||||||
private final TreeMap<Integer, SingleSizeCache> slabs;
|
private final TreeMap<Integer, SingleSizeCache> slabs;
|
||||||
|
@ -508,4 +510,4 @@ public class SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize {
|
||||||
public BlockCache[] getBlockCaches() {
|
public BlockCache[] getBlockCaches() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,11 @@ import org.apache.hadoop.hbase.io.hfile.BlockCacheKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for objects that want to know when actions occur in a SingleSizeCache.
|
* Interface for objects that want to know when actions occur in a SingleSizeCache.
|
||||||
* */
|
*
|
||||||
|
* @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}.
|
||||||
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
|
@Deprecated
|
||||||
interface SlabItemActionWatcher {
|
interface SlabItemActionWatcher {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1953,7 +1953,8 @@ rs.close();
|
||||||
<para>LruBlockCache is the original implementation, and is entirely within the Java heap.
|
<para>LruBlockCache is the original implementation, and is entirely within the Java heap.
|
||||||
SlabCache and BucketCache are mainly intended for keeping blockcache data offheap,
|
SlabCache and BucketCache are mainly intended for keeping blockcache data offheap,
|
||||||
although BucketCache can also keep data onheap and in files.</para>
|
although BucketCache can also keep data onheap and in files.</para>
|
||||||
<para> BucketCache has seen more production deploys and has more deploy options. Fetching
|
<para><emphasis>SlabCache is deprecated and will be removed in 1.0!</emphasis></para>
|
||||||
|
<para>BucketCache has seen more production deploys and has more deploy options. Fetching
|
||||||
will always be slower when fetching from BucketCache or SlabCache, as compared with the
|
will always be slower when fetching from BucketCache or SlabCache, as compared with the
|
||||||
native onheap LruBlockCache. However, latencies tend to be less erratic over time,
|
native onheap LruBlockCache. However, latencies tend to be less erratic over time,
|
||||||
because there is less garbage collection.</para>
|
because there is less garbage collection.</para>
|
||||||
|
@ -2112,6 +2113,7 @@ rs.close();
|
||||||
<title>Offheap Block Cache</title>
|
<title>Offheap Block Cache</title>
|
||||||
<section>
|
<section>
|
||||||
<title>Enable SlabCache</title>
|
<title>Enable SlabCache</title>
|
||||||
|
<para><emphasis>SlabCache is deprecated and will be removed in 1.0!</emphasis></para>
|
||||||
<para> SlabCache is originally described in <link
|
<para> SlabCache is originally described in <link
|
||||||
xlink:href="http://blog.cloudera.com/blog/2012/01/caching-in-hbase-slabcache/">Caching
|
xlink:href="http://blog.cloudera.com/blog/2012/01/caching-in-hbase-slabcache/">Caching
|
||||||
in Apache HBase: SlabCache</link>. Quoting from the API documentation for <link
|
in Apache HBase: SlabCache</link>. Quoting from the API documentation for <link
|
||||||
|
|
Loading…
Reference in New Issue