You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# A KV high-performance mini-database based on memory and C++17
2
+
**This project is inspired by Redis source code.**
3
+
4
+
# Command line tools
5
+
Developed command line tool **kvctl**.
6
+
value type:string
7
+
```shell
8
+
yunfei@ubuntu:~/MiniKV/build$ ./kvctl --key qjx --operate set --value hello
9
+
yunfei@ubuntu:~/MiniKV/build$ ./kvctl --key qjx --operate get
10
+
11
+
hello
12
+
```
13
+
14
+
value type:list
15
+
```shell
16
+
yunfei@ubuntu:~/MiniKV/build$ ./kvctl --key zyf --operate set --value hello --encoding list
17
+
yunfei@ubuntu:~/MiniKV/build$ ./kvctl --key zyf --operate set --value world --encoding list
18
+
19
+
yunfei@ubuntu:~/MiniKV/build$ ./kvctl --key zyf --operate get
20
+
21
+
world hello
22
+
```
23
+
2
24
3
25
# build
26
+
**Dependencies: grpc, protobuf, gflags**
4
27
In the project dir, do:
5
28
```shell
6
29
cd build && cmake .. && make
7
30
```
8
-
then you can get `kvserver` and `kvclient`.
31
+
then you can get `kvserver` and `kvclient`.
32
+
33
+
# run
34
+
```shell
35
+
./kvserver
36
+
```
37
+
38
+
# About
39
+
- This project is based on the gRPC framework to implement the memory-based KV cache middleware, which realizes the client and server respectively. Support list, string type KV cache, data snapshot and progressive Rehash.
40
+
41
+
- Communication between client and server is realized based on gRPC, and concurrency security is realized based on read-write lock; The client supports the addition, deletion, modification and query of keys.
42
+
43
+
- Support data snapshot, background thread timing persistence, based on user-defined data frame format; Service start automaticly to read snapshot.
44
+
45
+
- The underlying storage structure mimics the design of Redis hash table, solves hash conflicts with zipper method, and realizes automatic memory management with intelligent pointer.
46
+
47
+
- Imitate Redis to implement the expired key based on the expired hash table, and clean up the expired key through lazy deletion.
48
+
49
+
- Simulate the design of Redis double hash table, and implement progressive rehash after the background thread calculates the load factor regularly.
0 commit comments