Go K/V Databases Benchmark

smallnest
3 min readMar 6, 2019

--

There are several well-known k/v database in Go ecosystem. They can be used as persistent caches, storages, databases, etc. All of them have common features such as Get, Set (Update), Delete, and some of them have customized features such as transaction, bucket, column families.

For those common features, how about their benchmarks? This post will give you some test results in Solid State Drive (SSD) or Hard Disk Drive cases.

My test code is cloned from https://github.com/tidwall/kvbench. tidwall/kvbench implements a redis protocol server to serve Get/Set operations by using k/v databases. I have implemented a cli tool to test those k/v databases without any redis protocol server. It can test each k/v databases and output test results in console.

And I also add more k/v database such as badger, rocksdb, bbolt and goleveldb. Now the test contains the below k/v databases:

Size of keys is 9 bytes and Size of value is 256 bytes.
Test four cases: concurrent only set, concurrent only get, one set and concurrent get, concurrent delete.
Use fsync to control whether the write operation should be sync into the disk. For memory case this option is useless.
Tests are executed both in HDD and SDD. Some databases are
optimized for SDD.

HDD Case

The server uses Seagate HDD:

Vendor:               SEAGATE
Product: ST900MM0168
User Capacity: 900,185,481,216 bytes [900 GB]
Rotation Rate: 10500 rpm

40 logical cpu cores, 32G memory.

nofsync

fsync=false, throughtputs

Btree and map are always great.
Rocksdb looks good, buntdb Get operations is very high.
The set operations are also high for all databases although the gap between them is still large.

fsync

fsync=true, throughputs

The write operations have fallen sharply. Rocksdb and badger can reach 1000 op/s but others can’t reach 100 op/s. (Ignore btree/memory and map/memory because they won’t sync data to disk)

SSD Case

The server uses SSD:

Vendor:               AVAGO
Product: AVAGO
Revision: 4.66
User Capacity: 298,999,349,248 bytes [298 GB]
Device Speed: 6.0Gb/s
Link Speed: 12.0Gb/s
Media Type: Solid State Device

20 logical cpu cores, 128G memory.

nofsync

fsync

For some databases such as rocksdb, badger, performance of write operations improved significantly and performance of others database are also improved.

In mixed concurrent case (one set, multiple get), performance of the get operation in mixed case is far less than performance of the get operation in read-only case.

The code is at github.

--

--