Decide to use the BucketCache
BucketCache manages areas of memory called buckets
for holding the cached blocks. You can use BucketCache if any of the conditions listed in here
are are true.
- If the result of a Get or Scan typically fits completely in the heap, the default
configuration, which uses the on-heap
LruBlockCache, is the best choice, as the L2 cache will not provide much benefit. If the eviction rate is low, garbage collection can be 50% less than that of the
BucketCache, and throughput can be at least 20% higher.
- Otherwise, if your cache is experiencing a consistently high eviction rate, use the
BucketCache, which causes 30-50% of the garbage collection of
LruBlockCachewhen the eviction rate is high.
BucketCacheusing file mode on solid-state disks has a better garbage-collection profile but lower throughput than
BucketCacheusing off-heap memory.