Persistent memory - Introduction
Persistent memory is non-volatile1 storage that fits in a standard DIMM2 slot. Persistent memory provides higher throughput than SSD and NVMe3 but is slower than DRAM4. With persistent memory, memory contents remain even when system power goes down in the event of an unexpected power loss, user-initiated shutdown, or system crash.
Persistent Memory is interesting because it provides a new entry in the memory-storage hierarchy that fills the performance/capacity gap.
This article series introduces persistent memory by following a small journey from building an in-memory dictionary to converting the same to a persistent dictionary and concluding with various use-cases of persistent memory.
This article series consists of the following articles:
The in-memory dictionary is an application that allows adding and searching of words. It is volatile because the entire dictionary data is in DRAM, which means we lose all the words in case of power failure.
This article builds an in-memory dictionary that supports the following methods:
add(word)that adds a new word into the dictionary,
contains(word)that specifies if the given word is present in the dictionary,
containsPrefix(prefix)that specifies if there is any word beginning with the given prefix.
This article explains the data structure for our dictionary and builds the above-mentioned methods one at a time.
This article introduces persistent memory and its characteristics. It explains various ideas around persistent memory including:
- What persistent memory is.
- The characteristics of persistent memory.
- What makes persistent memory different from block storage devices.
- Memory mapping.
- How persistent memory works.
- Byte addressability vs Word addressability.
- Why byte addressability of persistent memory is useful.
This article begins by building a very naive append-only key/value store to understand different concepts around PMDK, which is the development kit we will be using to build our persistent dictionary.
This article explains the design choices with persistent memory which include:
The idea behind full persistence is to have the entire data structure on persistent memory. Our persistent dictionary will use full persistence which means all read/write operations will involve persistent memory.
The idea behind selective persistence is to have some part of the data structure in DRAM and the rest in persistent memory. This design choice gives the best of DRAM and persistent memory as we might be able to perform READ operations from DRAM and writes will happen both in DRAM and persistent memory, thus making our writes non-volatile.
This article also explains leveraging selective persistence to get the best of DRAM and persistent memory and concludes with some use-cases of persistent memory and why it makes sense to use persistent memory in those use-cases.
This article series uses C++ as its programming language. Throughout the series, we will use just the basic language concepts including
classes, objects and raw pointers. The codebase link will be mentioned in the corresponding articles.
Non-volatile storage is a type of storage that can retain the stored information even after power is off.
DIMM (dual in-line memory module) is a module that can be found on the motherboard. The module has slots that contain one or more RAM chips found on a smaller part of the entire motherboard of your computer. Basically, the DIMM slots serve as your computer’s main memory storage unit as it houses the RAM chips.
NVMe (nonvolatile memory express) is a storage access and transport protocol for flash and solid-state drives (SSDs). To help deliver a high-bandwidth and low-latency user experience, the NVMe protocol accesses flash storage via a PCI Express (PCIe) bus, which supports tens of thousands of parallel command queues and thus is much faster than hard disks and traditional all-flash architectures, which are limited to a single command queue.