Package org.apache.bookkeeper.bookie
Class SkipListArena
- java.lang.Object
-
- org.apache.bookkeeper.bookie.SkipListArena
-
public class SkipListArena extends java.lang.Object
SkipList allocation buffer to reduce memory fragment. Adapted from HBase project.The SkipListArena is basically a bump-the-pointer allocator that allocates big (default 2MB) byte[] chunks from and then handles it out to threads that request slices into the array.
The purpose of this class is to combat heap fragmentation in the bookie. By ensuring that all KeyValues in a given SkipList refer only to large chunks of contiguous memory, we ensure that large blocks get freed up when the SkipList is flushed.
Without the Arena, 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SkipListArena.MemorySlice
The result of a single allocation.
-
Constructor Summary
Constructors Constructor Description SkipListArena(ServerConfiguration cfg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SkipListArena.MemorySlice
allocateBytes(int size)
Allocate a slice of the given length.
-
-
-
Constructor Detail
-
SkipListArena
public SkipListArena(ServerConfiguration cfg)
-
-
Method Detail
-
allocateBytes
public SkipListArena.MemorySlice allocateBytes(int size)
Allocate a slice of the given length.If the size is larger than the maximum size specified for this allocator, returns null.
-
-