-
Notifications
You must be signed in to change notification settings - Fork 2.2k
RocksDB performs significantly worse than LevelDB in tests #5340
Comments
Hey. The Secondly, parity has found good config options for rocksdb. You can either find them in parity's code or ask them on some chat channel. Options: https://github.com/facebook/rocksdb/wiki/Setup-Options-and-Basic-Tuning. |
I've found this PR: openethereum/parity-ethereum#7348. |
We chatted about this offline but just to call this out here for posterity -
I also tried setting simple database config options based on what Parity has in the PR you shared, here's the relevant code file (from the PR since the file appears to have been removed from the repo): https://github.com/paritytech/parity-ethereum/blob/27564e6672285642f02e7a287f91b8de096d50dd/util/kvdb-rocksdb/src/lib.rs Here are the database options I set:
Setting these options had no impact on performance when running the bcStateTests test. I also tried setting the Next I'm going to try playing with the more complicated options e.g. BlockBasedTableOptions, compaction profiles, and column options. |
On Parity's DB tuning there's also this doc https://gist.github.com/andresilva/a71c251995ef97806715441074a10f57#file-rocksdb-tuning-org |
Thanks @gumb0 ! I set those options but the test
I'll do some debugging to see if I can figure out what the issue is...I don't think the exception error is correct, DatabaseAlreadyOpen is thrown in a fallback case (on line 99 in State.cpp): Lines 77 to 100 in 5a7689b
|
Maybe you can see the message from line 85 if you increase verbosity of testeth run |
Thanks, setting --verbosity to 3 did the trick and I figured it out. Unfortunately RocksDB is still performing more than 2x slower (for BlockchainTests/bcStateTests) than LevelDB...I'm going to take a closer look at the meaning of each of the tuning options to see if I can come up with better values for them. |
Since digging into the tuning options is going to take a bit of time, I first tried to set the exact same defaults as LevelDB...this involved setting:
The results were pretty much the same as our current settings (which is just
Next I'm going to throw together some microbenchmarks (e.g. insert 1000 blocks into the database directly and read back the same 1000 blocks) to determine what sorts of perf deltas we're seeing for reads vs writes, since this will help guide my optimizations. |
I created a simple test which inserts 1000 blocks (each containing 1 tx) directly into the database and reads back the blocks. I timed the insertions and reads separately (using std::chrono) and I’m seeing RocksDB take approx 50 percent longer for the reads and approx 2.5x longer for the writes. |
@halfalicious Could you share this test? I would try it on my machines |
I cannot help with this, but if you want to switch to rocksdb on Windows to be able to upgrade to VS 2017, I'm ok with this. |
Sure, I've re-written it so that the test runs 11 iterations of inserting 1000 blocks then reading 1000 blocks and computes the median of the write / read results. I'm seeing much smaller deltas when running this new test (on my Lenovo X1 Carbon laptop with SSD) built with the release config, approximately the same read latency (~2ms) and RocksDB has approx 50% worse write latency (~30ms vs ~28ms for LevelDB). These numbers are still very low and therefore susceptible to skew, I think I'm going to experiment with increasing the number of blocks and/or the number of txs in each block to see what the deltas are like with larger latencies. Here's the commit: 3a0b326 Here's how you run the test / an example of the output:
|
I'm getting the similar results on both Windows and Linux machine, or even worse, insertion is several times slower for RocksDB. While LevelDB performs very comparable to MemoryDB. |
|
Closing since we've removed RocksDB support |
RocksDB support is being added in this PR: #4844
When running the Aleth tests, RocksDB currently performs significantly worse than LevelDB. For example, a full test run using RocksDB (and TestEth compiled with the RelWithDebInfo configuration) takes approximately 70% longer than when using LevelDB (timing performed via TestEth's
--exectimelog
argument). From the PR:I took a quick look at the RocksDB interface that Aleth uses to interact with RocksDB and noticed a couple of small differences compared to the LevelDB interface:
• RocksDBWriteBatch::insert: The status is checked after
m_writeBatch.put()
. No status check is performed in LevelDBWriteBatch::insert• RocksDBWriteBatch::kill: The status is checked after
m_writeBatch.delete()
. No status check is performed in LevelDBWriteBatch::kill• RocksDB::exists: The status is checked via
IsNotFound()
before the call tocheckStatus()
. This check is not performed in LevelDB::exists.However, these differences aren't causing any noticeable performance issues since I removed the code from RocksDB and re-ran the tests but the perf delta remained.
Note that for some tests, the perf delta can be 100+%. For example:
- LevelDB: 21.4428
- RocksDB: 44.3357
- Delta: 106%
- LevelDB: 8.98981
- RocksDB: 18.1722
- Delta: 102%
Output from test runs:
I've done some brief searching online and haven't found anything indicating that RocksDB performance is expected to be significantly worse than LevelDB performance. As such, these significant performance differences are not expected and should be investigated.
The text was updated successfully, but these errors were encountered: