Decide to use the BucketCache
The 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 theBucketCache
, 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 ofLruBlockCache
when the eviction rate is high. BucketCache
using file mode on solid-state disks has a better garbage-collection profile but lower throughput thanBucketCache
using off-heap memory.