66
Modern memory allocators usually rely on anonymous memory mapping to
provision memory pages from the operating system. For most systems, this means that
actual physical memory is allocated only when a page is first accessed, allowing the OS
to overprovision virtual memory. Additionally, anonymous memory can be paged out
if needed. When using memkind with file-based kinds, such as PMEM kind, physical
space is still only allocated on first access to a page and the other described techniques
no longer apply. Memory allocation will fail when there is no memory available to be
allocated, so it is important to handle such failures within the application.
The described techniques also play an important role in hiding the inherent
inefficiencies of manual dynamic memory allocation such as fragmentation, which
causes allocation failures when not enough contiguous free space is available. Thus, filebased kinds can exhibit low space utilization for applications with irregular allocation/
deallocation patterns. Such workloads may be better served with libvmemcache.
libvmemcache
What is it?
libvmemcache is an embeddable and lightweight in-memory caching solution that
takes full advantage of large-capacity memory, such as persistent memory with direct
memory access (DAX), through memory mapping in an efficient and scalable way.
libvmemcache has unique characteristics:
• An extent-based memory allocator sidesteps the fragmentation
problem that affects most in-memory databases and allows the cache
to achieve very high space utilization for most workloads.
• The buffered least recently used (LRU) algorithm combines a
traditional LRU doubly linked list with a non-blocking ring buffer to
deliver high degrees of scalability on modern multicore CPUs.
• The critnib indexing structure delivers high performance while
being very space efficient.
The cache is tuned to work optimally with relatively large value sizes. The smallest
possible size is 256 bytes, but libvmemcache works best if the expected value sizes are
above 1 kilobyte.
Chapter 10 describes this library in more detail. libvmemcache is an open source
project on GitHub at https://github.com/pmem/vmemcache.
Chapter 5 IntroduCIng the persIstent MeMory developMent KIt
Modern memory allocators usually rely on anonymous memory mapping to
provision memory pages from the operating system. For most systems, this means that
actual physical memory is allocated only when a page is first accessed, allowing the OS
to overprovision virtual memory. Additionally, anonymous memory can be paged out
if needed. When using memkind with file-based kinds, such as PMEM kind, physical
space is still only allocated on first access to a page and the other described techniques
no longer apply. Memory allocation will fail when there is no memory available to be
allocated, so it is important to handle such failures within the application.
The described techniques also play an important role in hiding the inherent
inefficiencies of manual dynamic memory allocation such as fragmentation, which
causes allocation failures when not enough contiguous free space is available. Thus, filebased kinds can exhibit low space utilization for applications with irregular allocation/
deallocation patterns. Such workloads may be better served with libvmemcache.
libvmemcache
What is it?
libvmemcache is an embeddable and lightweight in-memory caching solution that
takes full advantage of large-capacity memory, such as persistent memory with direct
memory access (DAX), through memory mapping in an efficient and scalable way.
libvmemcache has unique characteristics:
• An extent-based memory allocator sidesteps the fragmentation
problem that affects most in-memory databases and allows the cache
to achieve very high space utilization for most workloads.
• The buffered least recently used (LRU) algorithm combines a
traditional LRU doubly linked list with a non-blocking ring buffer to
deliver high degrees of scalability on modern multicore CPUs.
• The critnib indexing structure delivers high performance while
being very space efficient.
The cache is tuned to work optimally with relatively large value sizes. The smallest
possible size is 256 bytes, but libvmemcache works best if the expected value sizes are
above 1 kilobyte.
Chapter 10 describes this library in more detail. libvmemcache is an open source
project on GitHub at https://github.com/pmem/vmemcache.
Chapter 5 IntroduCIng the persIstent MeMory developMent KIt
