BonsaiKV: Towards Fast, Scalable, and Persistent Key-Value Stores with Tiered, Heterogeneous Memory System
This repository contains the source code, setup utilities, and test scripts of BonsaiKV: a fast, scalable, and persistent key-value store on heterogeneous memory system.
Hardware: Intel Optane DC Persistent Memory with Non-Interleaved AppDirect Mode
Operating System: Ubuntu 18.04+
Kernel Version: Linux Kernel 5.4.0-125-generic
Libraries: libpmemobj, libnuma, libjemalloc
-
Clone BonsaiKV Repo:
git clone [email protected]:miaogecm/BonsaiKV.git
-
Configure BonsaiKV:
-
Modify
./include/config.h
to change hardware configurations and BonsaiKV functionalities. Important configurations:- NUM_CPU: Total CPU number
- NUM_DIMM: Total number of NVMM DIMMs
- NUM_SOCKET: Total NUMA node number
- NUM_USER_THREAD: Total user thread number
- STR_KEY: Enable string key or not
- STR_VAL: Enable string value or not
- VAL_LEN: String value length
Advanced options:
- LOG_REGION_SIZE: Log region size (default: 68GB)
- DATA_REGION_SIZE: Data region size (default: 51GB)
- CPU_VAL_POOL_SIZE: Number of string value slots for each CPU.
- ENABLE_PNODE_REPLICA: Enable NUMA-aware data migration. Recommend to enable this for skewed workloads.
-
-
Build BonsaiKV
cd ./src
make -j
You can find
libbonsai.so
in./src
.
By default, BonsaiKV uses Masstree as its DRAM index. You can plug other indexes as you desire.
- Modify
./src/Makefile
to link to your desired index library, or just copy its source code tosrc
andinclude
. - Register
index_init
,index_destroy
,index_insert
,index_remove
,index_lowerbound
insrc/adapter.c
. - Rebuild BonsaiKV.
The example
directory contains a toy example which demonstrates how to run BonsaiKV. To run it:
- Setup the environment
cd ./scripts
./setup.sh
- Build BonsaiKV first
- Build the toy example
cd ./example
make -j
- Run the toy example:
./example
You can generate YCSB workload traces as follows:
cd ./test/benchmark_ycsb/tools/index-microbench
- Modify
gen_ycsb.sh
to change workload configurations. ./gen_ycsb.sh
Note that these scripts are only compatible with our modified YCSB in ./test/benchmark_ycsb/tools/index-microbench
. We remove some outputs and add multi-thread support in YCSB to accelerate benchmark running.
-
Modify
./test/benchmark_ycsb/include/config.h
to change hardware configurations and benchmark options. Important options:- NUM_CPU: Total CPU number
- NUM_THREADS: Total worker thread number
- YCSB_KVLIB_PATH: Key-value store library file path
- YCSB_WORKLOAD_NAME: The workload to run (see all workloads in
./test/benchmark_ycsb/workloads
) - YCSB_IS_STRING_KEY: Use string key or not.
- YCSB_VAL_LEN: Value length.
-
Build the Benchmark Driver
cd ./test/benchmark_ycsb
make -j
Now you will find
kvstore
in./test/benchmark_ycsb
.
-
Setup the environment
cd ./scripts
./setup.sh
-
Run the YCSB Benchmark:
cd ./test/benchmark/ycsb
./kvstore