Interface MemStoreLAB

All Known Implementing Classes:
ImmutableMemStoreLAB, MemStoreLABImpl

@Private public interface MemStoreLAB
A memstore-local allocation buffer.

The MemStoreLAB is basically a bump-the-pointer allocator that allocates big (2MB) chunks from and then doles it out to threads that request slices into the array. These chunks can get pooled as well. See ChunkCreator.

The purpose of this is to combat heap fragmentation in the regionserver. By ensuring that all Cells in a given memstore refer only to large chunks of contiguous memory, we ensure that large blocks get freed up when the memstore is flushed.

Without the MSLAB, the byte array allocated during insertion end up interleaved throughout the heap, and the old generation gets progressively more fragmented until a stop-the-world compacting collection occurs.

This manages the large sized chunks. When Cells are to be added to Memstore, MemStoreLAB's copyCellInto(ExtendedCell) gets called. This allocates enough size in the chunk to hold this cell's data and copies into this area and then recreate a Cell over this copied data.

See Also: