rocksdb icon indicating copy to clipboard operation
rocksdb copied to clipboard

RocksDB#getLongProperty("rocksdb.estimate-num-keys") block long time (Java Lib)

Open horizonzy opened this issue 1 year ago • 2 comments

In our case, we count the Rocksdb keys number and put it into metrics. But we found that the method db.getLongProperty("rocksdb.estimate-num-keys") block for a long time.

I want to know why this happens and what the workaround is for it. Thanks.

Rocksdb java lib version: org.rocksdb-rocksdbjni-7.9.2.jar

horizonzy avatar Aug 12 '24 08:08 horizonzy

Hello @horizonzy

thank you for reaching our community. Can you please describe your problem more. I wrote JMH test and I didn't notice any slowdown. Maybe if you can provide some sample code, or describe little bit more your setup(How many keys, average size of keys, values, ...). What times you see in your system ?

Radek

simple test results :

Benchmark                              (keysInDB)    Mode     Cnt    Score   Error   Units
PropertyReadBenchmark.get                       0   thrpt       5    2.340 ± 0.020  ops/us
PropertyReadBenchmark.get                10000000   thrpt       5    2.301 ± 0.054  ops/us
PropertyReadBenchmark.get                       0    avgt       5    0.430 ± 0.008   us/op
PropertyReadBenchmark.get                10000000    avgt       5    0.572 ± 0.529   us/op
PropertyReadBenchmark.get                       0  sample  896789    0.458 ± 0.001   us/op
PropertyReadBenchmark.get:get·p0.00             0  sample            0.400           us/op
PropertyReadBenchmark.get:get·p0.50             0  sample            0.400           us/op
PropertyReadBenchmark.get:get·p0.90             0  sample            0.500           us/op
PropertyReadBenchmark.get:get·p0.95             0  sample            0.500           us/op
PropertyReadBenchmark.get:get·p0.99             0  sample            0.700           us/op
PropertyReadBenchmark.get:get·p0.999            0  sample            1.200           us/op
PropertyReadBenchmark.get:get·p0.9999           0  sample           16.713           us/op
PropertyReadBenchmark.get:get·p1.00             0  sample           88.832           us/op
PropertyReadBenchmark.get                10000000  sample  874835    0.470 ± 0.001   us/op
PropertyReadBenchmark.get:get·p0.00      10000000  sample            0.400           us/op
PropertyReadBenchmark.get:get·p0.50      10000000  sample            0.500           us/op
PropertyReadBenchmark.get:get·p0.90      10000000  sample            0.500           us/op
PropertyReadBenchmark.get:get·p0.95      10000000  sample            0.500           us/op
PropertyReadBenchmark.get:get·p0.99      10000000  sample            0.900           us/op
PropertyReadBenchmark.get:get·p0.999     10000000  sample            1.300           us/op
PropertyReadBenchmark.get:get·p0.9999    10000000  sample           12.896           us/op
PropertyReadBenchmark.get:get·p1.00      10000000  sample          107.776           us/op
PropertyReadBenchmark.get                       0      ss       5    4.320 ± 0.502   us/op
PropertyReadBenchmark.get                10000000      ss       5   13.760 ± 2.414   us/op

rhubner avatar Aug 20 '24 18:08 rhubner

Hi @horizonzy Is this still an issue for you ? Are you able to provide more detail on the behaviour you are observing ?

alanpaxton avatar May 19 '25 13:05 alanpaxton