[ 
https://issues.apache.org/jira/browse/FLINK-41519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149441#comment-18149441
 ] 

Aleksandr Savonin commented on FLINK-41519:
-------------------------------------------

I opened a draft PR in flink-benchmarks with two benchmarks for the case the 
bound from FLINK-40584 was added for: 
[apache/flink-benchmarks#127|https://github.com/apache/flink-benchmarks/pull/127].

The existing MapState benchmarks read live entries only, so they show what the 
bound costs (the regression reported here) but not what it saves. The new 
benchmarks measure reads that run into deletion markers: {{MapState.isEmpty()}} 
after all maps were cleared, and opening an operator after a restore when all 
of its timers fired before the checkpoint.

Results on the same Flink commit, with the bound and with the two commits that 
add it reverted:
||Benchmark||Key groups||With the bound||Without the bound||Ratio||
|{{clearedMapIsEmpty}}| |816.9 ± 19.7 ops/ms|0.443 ± 0.009 ops/ms|1844x|
|{{timerServiceInit}}|128|8.70 ± 0.24 ms/op|171.4 ± 1.5 ms/op|20x|
|{{timerServiceInit}}|4,096|16.51 ± 0.55 ms/op|4,903.6 ± 37.4 ms/op|297x|

Higher is better for ops/ms, lower is better for ms/op. These are synthetic 
worst cases, where a read meets nothing but deletion markers. The setup is 
described in the PR.

I am also working on reducing the per-iterator overhead of the bound that 
causes this regression.

> Performance regression in RocksDB MapState iterator and isEmpty benchmarks 
> since Sep 24
> ---------------------------------------------------------------------------------------
>
>                 Key: FLINK-41519
>                 URL: https://issues.apache.org/jira/browse/FLINK-41519
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / State Backends
>    Affects Versions: 2.4.0
>            Reporter: Mika Naylor
>            Priority: Critical
>              Labels: pull-request-available
>             Fix For: 2.4.0
>
>
> Since around Sep 27 the daily flink-benchmarks runs show a ~4–6% regression 
> in RocksDB MapState benchmarks that open an iterator:
> ||Benchmark||Baseline (ops/ms)||Current (ops/ms)||Δ||
> |mapEntries.ROCKSDB|294.5|280.9|-4.6%|
> |mapIsEmpty.ROCKSDB|38.0|36.3|-4.6%|
> |mapIsEmpty.ROCKSDB_CHANGELOG|38.3|36.0|-5.9%|
> |mapIterator.ROCKSDB_CHANGELOG|295.0|283.2|-4.0%|
> *Cause:* FLINK-40584 (ce32f1ef, 2d30c035).
> {{RocksDBOperationUtils#getRocksIteratorBoundedByPrefix}} creates and frees a 
> private {{ReadOptions}} copy and an upper-bound {{Slice}} on every 
> {{{}isEmpty(){}}}, {{clear()}} and map iterator cache load. That is about 8 
> extra JNI calls and 2 native allocations per call.
> I was able to replicate the regression by reverting and un-reverting the 
> commits in question.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to