Skip to content
rockeet edited this page Sep 4, 2018 · 79 revisions

中文 Chinese

TerarkDB Documentation

TerarkDB = terark rocksdb + terark-zip-rocksdb

terark-zip-rocksdb is for RocksDB's SSTable implementation: TerarkZipTable.

TerarkZipTable use terark's searchable compression technology and achieved all of these:
        (1) much higher random read performance
        (2) much higher compression ratio (disk file is much smaller)
        (3) much lower memory usage (mmap on compressed file, no double caching)

We forked official rocksdb as terark rocksdb and changed for better support TerarkZipTable(in terark-zip-rocksdb).

Now by using TerarkDB, you are able to store more data on disk (3x+ more than snappy, 2x+ more than zstd), and load more data into memory(10x+ more), and improve read performance greatly! All data are accessed at memory speed!


1. Compile and Download

1.1 Compile terark rocksdb by yourself

  git clone
  cd  terarkdb
  git submodule init
  git submodule update
  make -C rocksdb shared_lib DEBUG_LEVEL=0

1.2 Download precompiled terark-zip-rocksdb


  • You can not compile terark-zip-rocksdb by yourself
  • Without terark-zip-rocksdb, terark rocksdb works exactly the same as official rocksdb

The download file names like:

  • terark-zip-rocksdb-Linux-x86_64-g++-5.4-bmi2-1.tgz
       -- bmi2-1 means this software can only run on intel-haswell or newer CPU
  • terark-zip-rocksdb-Linux-x86_64-g++-5.4-bmi2-0.tgz
       -- bmi2-0 means this software can run on older CPU (but the CPU must support popcnt & SSE4.2)

The downloaded package contains all dependencies you need as below:

  $ cd terark-zip-rocksdb-Linux-x86_64-g++-4.8-bmi2-1/lib
  # just show filename and symbol links

  $ ls -l libterark* # "-r" for "release version" -> -> -> ->

  $ ls -l libterark* # "-d" for "debug version" -> -> -> ->

2. Now, you can try TerarkDB

3. Restrictions

  • User Key Comparator is not supported, you should encode your keys in byte lexical order
  • EnvOptions::use_mmap_reads must be true, can be set by DBOptions::allow_mmap_reads

4. Tuning Guide

5. License

This software is open source.

5.1 submodule rocksdb

submodule rocksdb is our fork of rocksdb and can be compiled by yourself.

License of submodule rocksdb is same as offical rocksdb(BSD clause 3).

5.2 submodule terark-zip-rocksdb

submodule terark-zip-rocksdb implements an MemTable and an SSTable for submodule rocksdb, terark-zip-rocksdb license is Apache 2.0, with NOTES:

  • You can read or redistribute or use the source code under Apache 2.0 license
  • You can not compile this software by yourself, since this software depends on our proprietary core algorithms, which requires a commercial license
  • You can download the precompiled binary library of this software

6. Contacts

Clone this wiki locally
You can’t perform that action at this time.