• A
    Cache fragmented range tombstones in BlockBasedTableReader (#4493) · 7528130e
    Abhishek Madan 提交于
    Summary:
    This allows tombstone fragmenting to only be performed when the table is opened, and cached for subsequent accesses.
    
    On the same DB used in #4449, running `readrandom` results in the following:
    ```
    readrandom   :       0.983 micros/op 1017076 ops/sec;   78.3 MB/s (63103 of 100000 found)
    ```
    
    Now that Get performance in the presence of range tombstones is reasonable, I also compared the performance between a DB with range tombstones, "expanded" range tombstones (several point tombstones that cover the same keys the equivalent range tombstone would cover, a common workaround for DeleteRange), and no range tombstones. The created DBs had 5 million keys each, and DeleteRange was called at regular intervals (depending on the total number of range tombstones being written) after 4.5 million Puts. The table below summarizes the results of a `readwhilewriting` benchmark (in order to provide somewhat more realistic results):
    ```
       Tombstones?    | avg micros/op | stddev micros/op |  avg ops/s   | stddev ops/s
    ----------------- | ------------- | ---------------- | ------------ | ------------
    None              |        0.6186 |          0.04637 | 1,625,252.90 | 124,679.41
    500 Expanded      |        0.6019 |          0.03628 | 1,666,670.40 | 101,142.65
    500 Unexpanded    |        0.6435 |          0.03994 | 1,559,979.40 | 104,090.52
    1k Expanded       |        0.6034 |          0.04349 | 1,665,128.10 | 125,144.57
    1k Unexpanded     |        0.6261 |          0.03093 | 1,600,457.50 |  79,024.94
    5k Expanded       |        0.6163 |          0.05926 | 1,636,668.80 | 154,888.85
    5k Unexpanded     |        0.6402 |          0.04002 | 1,567,804.70 | 100,965.55
    10k Expanded      |        0.6036 |          0.05105 | 1,667,237.70 | 142,830.36
    10k Unexpanded    |        0.6128 |          0.02598 | 1,634,633.40 |  72,161.82
    25k Expanded      |        0.6198 |          0.04542 | 1,620,980.50 | 116,662.93
    25k Unexpanded    |        0.5478 |          0.0362  | 1,833,059.10 | 121,233.81
    50k Expanded      |        0.5104 |          0.04347 | 1,973,107.90 | 184,073.49
    50k Unexpanded    |        0.4528 |          0.03387 | 2,219,034.50 | 170,984.32
    ```
    
    After a large enough quantity of range tombstones are written, range tombstone Gets can become faster than reading from an equivalent DB with several point tombstones.
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/4493
    
    Differential Revision: D10842844
    
    Pulled By: abhimadan
    
    fbshipit-source-id: a7d44534f8120e6aabb65779d26c6b9df954c509
    7528130e
table_cache.cc 17.5 KB