Skip to content

kongjun18/kvcache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KVCache

This is a KV Cache on SSD, which is inspired by Twitter'sFatCache and the paper Optimizing Flash-based Key-value Cache Systems.

This repository has done the following work:

  1. Implemented the algorithm of the paper Optimizing Flash-based Key-value Cache Systems. Open-Channel SSD mentioned in the paper is mocked by RocksDB.

  2. Concurrency: Get/Put/Delete operations, as well as background flushing and garbage collection (GC). In comparison, Twitter's FatCache only supports single-threaded operations.

Building

KVCache requires the following dependencies:

  • C++23 compiler
  • CMake 3.20+
  • RocksDB
  • OpenSSL
  • Google Test (for testing)

To build:

make build

Running Tests

To run the tests:

make test

Benchmark

To benchmark the performance:

make benchmark

This benchmark puts and read 4*SSD_SIZE data with random key and value size.

I use a small amount of data to minimize wear on my laptop's disk, you can adjust the test configurations in kvcache_test.cpp. This benchmark writes a large number of small objects (up to a maximum of 200 KB each, totaling 800 MB) and uses only 10 MB of memory. On my laptop, the performance is as follows:

Benchmark: Put and Get 4 SSDs with random key and value
write_seconds: 1.67115 read_seconds: 0.775589
Performance test results:
Write: 9777.08 ops/s, actual write 478.72 MiB/s
Read: 105148.54 ops/s, actual read 1098.88 MiB/s

benchmark