迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:zb-kvs开源软件地址:https://gitee.com/ZNBase/zn-kvs开源软件介绍:0. What is ZN-KVSZN-KVS is a RocksDB replacement with optimized tail latency, throughput etc.
Notes
Design Principle
Architecture OverviewMore detail of architecture desgin is here. 1. Use ZN-KVSCompilationCompile project to static library, which can be integrated into yourown project. Advanced options of compilation is here. # Add some dependenciessudo apt install libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev libgflags-dev gitsudo apt install build-essential autoconf gcc g++ ccache libncurses5-dev byacc cmake# Create build directorymkdir buildcd build# Build with defaultcmake ..make -j4 Usage of ZN-KVSZN-KVS inherites exported interface from Rocsdb. So you can use ZN-KVS just like Rocksdb, except that adding one line code "options.pureMemTable = true". Example code of Usage: int main() { Options options = Options(); options.env = Env::Default(); options.pureMemTable = true; rocksdb::DB* db2 = nullptr; rocksdb::Status s = DB::Open(options, dbname_+"/db_test", &db2); WriteOptions writeOptions = WriteOptions(); ASSERT_OK(db2->Put(writeOptions,"542", "v2")); ASSERT_OK(db2->Put(writeOptions,"444", "v1")); ASSERT_OK(db2->Put(writeOptions,"ps", "v3")); ASSERT_OK(db2->Put(writeOptions,"ps", "v4")); ASSERT_EQ("v1", OpenGet(db2,"444")); ASSERT_EQ("v2", OpenGet(db2,"542")); ASSERT_EQ("v4", OpenGet(db2,"ps")); db2->Close(); delete db2;}std::string OpenGet(DB* db,const std::string& k) { ReadOptions options; std::string result; Status s = db->Get(options, k, &result); if (s.IsNotFound()) { result = "NOT_FOUND"; } else if (!s.ok()) { result = s.ToString(); } return result;} 2. Performance ImprovementBenchmarkwith only 1G data test, ZN-KVS can has At list 100% search performance improvement than Rocksdb. 3. Contributing
4. License
5. UsersPlease let us know if you are using ZN-KVS, thanks! ![]() |
请发表评论