Hi!
I'm working on blockchain performance and I'm getting some strong
performance statistics when comparing my own code against LevelDB.
I want some feedback on my testing methodology.
https://github.com/libbitcoin/libbitcoin_blockchain/tree/master/benchmark/large-bench
See the README for an explanation.
Here are the results I get (database = 30 million rows):
100k random keys:
* libbitcoin htdb_slab = 20 seconds (20k ms)
* leveldb = 48 seconds
10 million keys:
* htdb_slab = 37 seconds
* leveldb = 373 seconds
* null (no database, randomly iterate flat file) = 10 seconds
I drop the cache before each test. Is the kernel simply that good that
the more I run the test, the better the caching works and throughput
such that I improve from 40% to 10% of LevelDB's read speed? Seems very
drastic.
Also interesting to note is that performance difference for my database
and LevelDB's for small datasets is not significant, but when you stuff
more data into LevelDB it really starts to choke and performance
degrades significantly.
See below for actual commands.
-----------------------------------------------
Prepare initial databases:
$ ./prepare 30000000
Done.
$ ./leveldb_write
Wrote 30000000 values. Done.
$ ./htdb_slab_write 30000000
Buckets: 30000000
Wrote 30000000 values. Done.
Running the benchmark itself (read 100k random keys):
$ sudo ../drop_caches.sh
$ ./htdb_slab_read 100000
DEBUG [ht.get()]: iterations = 100000 buckets = 30000000 |
19996.761275
$ sudo ../drop_caches.sh
$ ./leveldb_read 100000
DEBUG [leveldb.Get()]: iterations = 100000 |
47950.581767
Now for 10 million random keys:
$ sudo ../drop_caches.sh
$ ./htdb_slab_read 10000000
DEBUG [ht.get()]: iterations = 10000000 buckets = 30000000 |
37031.098962
$ sudo ../drop_caches.sh
$ ./leveldb_read 10000000
DEBUG [leveldb.Get()]: iterations = 10000000 |
373072.996571
$ sudo ../drop_caches.sh
$ ./null_read 10000000
DEBUG [None]: iterations = 10000000 | 9972.837145