version:rocksdb 6.15.2
I open a DB and put 2000W k-v using writebatch.
The keys range from (1,20000000), and the values are normal string.
```
DB* db; Options options; options.IncreaseParallelism(); options.OptimizeLevelStyleCompaction(); options.max_open_file=-1; options.write_buffer_size=1024*1024*1024; options.create_if_missing=true; Status s=DB::Open(options,dbPath,&db);Using MultiGet to get 500 keys costs 15 secondes.
pgsql costs only 200ms under the same conditions after build index btree.
I mean rocksDB slower than sqlDB?
Is there any wrong on options or set-up?
Can you share perf context of your query?
Here is how you can get it: https://github.com/facebook/rocksdb/wiki/Perf-Context-and-IO-Stats-Context
--
You received this message because you are subscribed to the Google Groups "rocksdb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
rocksdb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rocksdb/930d1d27-77ed-4457-bfa3-487aa11ede69n%40googlegroups.com.
Look at these lines:
block_cache_hit_count=2
block_read_count=1058
block_read_byte=4379421
block_read_time=54048875682
Block cache only hit for 2 blocks, and other 1058 blocks were read from disk. By every, each one is 54 ms.
Since you read 500 keys, it’s about 2 I/Os per key. Not a crazy number.
If 54ms per I/O is what the latency your storage can provide, then increasing block cache hit rate is the only chance you have. How large is the DB and how large is your DRAM size and your block cache size? Is it possible that you tune Postgres to mostly cache in DRAM but in RocksDB cache you need to read from the disk?
rocksdb::BlockBasedTableOptions table_options;
table_options.block_cache = rocksdb::NewLRUCache(10 * 1024 * 1024 * 1024LL);Do you use direct I/O? If not, I’m surprised that the whole thing isn’t cached in OS page cache. I’m not expert on Postgres but it appears that it always uses OS page cache, so there everything should be cached too.
The I/O you hit is clearly the data blocks, not index or something like that. Unless you use BlobDB, RocksDB inlines data with index so there isn’t a clear difference.
To view this discussion on the web visit https://groups.google.com/d/msgid/rocksdb/tencent_67AE09F65A5EC436C5C4F9E2C4F6E82CDB06%40qq.com.
I can’t see any problem, unless you didn’t apply table_options correctly to options.