Cache eviction priorities
You must decide on the cache eviction priorities to allow for scan-resistance and in-memory column families.
Both the on-heap cache and the off-heap BucketCache
use the same cache
priority mechanism to decide which cache objects to evict to make room for new objects.
Three levels of block priority allow for scan-resistance and in-memory column families.
Objects evicted from the cache are subject to garbage collection.
-
Single access priority: The first time a block is loaded from HDFS, that block is given single access priority, which means that it will be part of the first group to be considered during evictions. Scanned blocks are more likely to be evicted than blocks that are used more frequently.
-
Multi access priority: If a block in the single access priority group is accessed again, that block is assigned multi access priority, which moves it to the second group considered during evictions, and is therefore less likely to be evicted.
-
In-memory access priority: If the block belongs to a column family which is configured with the
in-memory
configuration option, its priority is changed to in memory access priority, regardless of its access pattern. This group is the last group considered during evictions, but is not guaranteed not to be evicted. Catalog tables are configured with in-memory access priority.To configure a column family for in-memory access, use the following syntax in HBase Shell:hbase> alter 'myTable', 'myCF', CONFIGURATION => {IN_MEMORY => 'true'}
To use the Java API to configure a column family for in-memory access, use the
HColumnDescriptor.setInMemory(true)
method.