Skip to content

jrmhx/nvmstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

High-Concurrency Cache Aggregation for KV Store on Non-Volatile Memory (NVM)

Background

designing a cache aggregation layer for a high-concurrency Key-Value (KV) storage system. The underlying storage medium is Non-Volatile Memory (NVM).

NVM Performance Characteristics:

  • Random write performance is poor.
  • Sequential write performance is excellent.
  • Goal: Convert random concurrent insertion operations into batched, sequential writes to optimize NVM performance.

Functional Requirements

need to implement two core functions:

  • insert(key, value):
    • Must be thread-safe in a high-concurrency environment
    • Restriction: You cannot use a Global Lock, as it would become a major performance bottleneck.
  • flush():
    • Must efficiently collect and aggregate data inserted by multiple threads.
    • Must write the aggregated data to the underlying storage in a single, sequential batch.

Design Requirements

  • Thread Safety: How to ensure safety without global locks (e.g., lock-free mechanisms or fine-grained locking).
  • High-Efficiency Insertion: How to manage the data buffer to handle rapid ingestion.
  • Efficient Aggregation (flush): How to gather data from multiple threads and execute a batch sequential write.
  • Currently DO NOT need to consider data retrieval (read) or indexing structures; focus strictly on the write path (aggregation and persistence).
  • Assume the NVM write interface is a standard memory copy (memcpy) to a persistent memory region.
  • Ensure the code reflects high-concurrency control principles and guarantees data integrity during the flush operation.

Key Words:

  • High Concurrency
  • Cache Aggregation
  • NVM (Non-Volatile Memory)
  • Thread-Safe
  • Global Lock
  • Fine-grained Lock
  • Lock-free
  • Batch Sequential Write

How to run the demo code

clang++ main.cpp -o main -std=c++20 -pthread
./main
hexdump -c ./nvm_store.bin | head

About

concurrent safe cache aggregation for kv store on non-volatile memory

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages