Skip to content

Comments

[FLINK-17842][network] Fix performance regression in SpanningWrapper#clear#12267

Merged
pnowojski merged 1 commit intoapache:masterfrom
pnowojski:f17842
May 21, 2020
Merged

[FLINK-17842][network] Fix performance regression in SpanningWrapper#clear#12267
pnowojski merged 1 commit intoapache:masterfrom
pnowojski:f17842

Conversation

@pnowojski
Copy link
Contributor

@pnowojski pnowojski commented May 20, 2020

For some reason the following commit:
5415574 [FLINK-17547][task] Use RefCountedFile in SpanningWrapper

caused a performance regression in various benchmarks. It's hard to tell why as none of the benchmarks are using spill files (records are too small), so our best guess is that combination of AtomicInteger inside RefCountedFile plus NullPointerException handling messed up with JIT ability to get rid of the memory barrier (from AtomicInteger) on the hot path.

Verifying this change

This change is covered by existing micro benchmarks.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

…clear

For some reason the following commit:
5415574 [FLINK-17547][task] Use RefCountedFile in SpanningWrapper

caused a performance regression in various benchmarks. It's hard to tell why
as none of the benchmarks are using spill files (records are too small), so
our best guess is that combination of AtomicInteger inside RefCountedFile
plus NullPointerException handling messed up with JIT ability to get rid
of the memory barrier (from AtomicInteger) on the hot path.
@flinkbot
Copy link
Collaborator

flinkbot commented May 20, 2020

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 0afb379 (Fri Oct 16 10:53:25 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.

Details
The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented May 20, 2020

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thanks for fixing this issue!

@rkhachatryan
Copy link
Contributor

rkhachatryan commented May 21, 2020

just for the record, benchmark results (build 157):

"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: channelsFlushTimeout","Param: outputMode","Param: stateBackend"
"org.apache.flink.benchmark.AsyncWaitOperatorBenchmark.asyncWait","thrpt",1,30,1675.314399,13.661763,"ops/ms",,ORDERED,
"org.apache.flink.benchmark.AsyncWaitOperatorBenchmark.asyncWait","thrpt",1,30,1647.660718,25.408029,"ops/ms",,UNORDERED,
"org.apache.flink.benchmark.BlockingPartitionBenchmark.compressedFilePartition","thrpt",1,30,7587.623968,495.943620,"ops/ms",,,
"org.apache.flink.benchmark.BlockingPartitionBenchmark.uncompressedFilePartition","thrpt",1,30,8049.532009,686.509545,"ops/ms",,,
"org.apache.flink.benchmark.BlockingPartitionBenchmark.uncompressedMmapPartition","thrpt",1,30,8572.416029,1130.753057,"ops/ms",,,
"org.apache.flink.benchmark.ContinuousFileReaderOperatorBenchmark.readFileSplit","thrpt",1,30,13052.659810,309.984908,"ops/ms",,,
"org.apache.flink.benchmark.DataSkewStreamNetworkThroughputBenchmarkExecutor.networkSkewedThroughput","thrpt",1,30,31190.271721,870.263370,"ops/ms",,,
"org.apache.flink.benchmark.InputBenchmark.mapRebalanceMapSink","thrpt",1,30,10180.719563,354.386348,"ops/ms",,,
"org.apache.flink.benchmark.InputBenchmark.mapSink","thrpt",1,30,16854.099393,344.041672,"ops/ms",,,
"org.apache.flink.benchmark.KeyByBenchmarks.arrayKeyBy","thrpt",1,30,3398.131636,172.190394,"ops/ms",,,
"org.apache.flink.benchmark.KeyByBenchmarks.tupleKeyBy","thrpt",1,30,5913.693638,409.171727,"ops/ms",,,
"org.apache.flink.benchmark.MemoryStateBackendBenchmark.stateBackends","thrpt",1,30,4673.754547,63.306818,"ops/ms",,,MEMORY
"org.apache.flink.benchmark.MemoryStateBackendBenchmark.stateBackends","thrpt",1,30,4377.262488,75.459472,"ops/ms",,,FS
"org.apache.flink.benchmark.MemoryStateBackendBenchmark.stateBackends","thrpt",1,30,4660.429485,94.844684,"ops/ms",,,FS_ASYNC
"org.apache.flink.benchmark.RemoteChannelThroughputBenchmark.remoteRebalance","thrpt",1,30,18032.072102,1103.527368,"ops/ms",,,
"org.apache.flink.benchmark.RocksStateBackendBenchmark.stateBackends","thrpt",1,30,326.831671,3.492961,"ops/ms",,,ROCKS
"org.apache.flink.benchmark.RocksStateBackendBenchmark.stateBackends","thrpt",1,30,327.989542,2.881097,"ops/ms",,,ROCKS_INC
"org.apache.flink.benchmark.SerializationFrameworkMiniBenchmarks.serializerAvro","thrpt",1,30,589.743375,11.544982,"ops/ms",,,
"org.apache.flink.benchmark.SerializationFrameworkMiniBenchmarks.serializerHeavyString","thrpt",1,30,241.771995,9.425987,"ops/ms",,,
"org.apache.flink.benchmark.SerializationFrameworkMiniBenchmarks.serializerKryo","thrpt",1,30,243.139002,14.217965,"ops/ms",,,
"org.apache.flink.benchmark.SerializationFrameworkMiniBenchmarks.serializerPojo","thrpt",1,30,670.134967,52.890921,"ops/ms",,,
"org.apache.flink.benchmark.SerializationFrameworkMiniBenchmarks.serializerRow","thrpt",1,30,863.168600,34.835227,"ops/ms",,,
"org.apache.flink.benchmark.SerializationFrameworkMiniBenchmarks.serializerTuple","thrpt",1,30,1001.052118,33.318160,"ops/ms",,,
"org.apache.flink.benchmark.StreamNetworkBroadcastThroughputBenchmarkExecutor.networkBroadcastThroughput","thrpt",1,30,954.221477,42.950052,"ops/ms",,,
"org.apache.flink.benchmark.StreamNetworkThroughputBenchmarkExecutor.networkThroughput","thrpt",1,30,67093.199752,3957.671286,"ops/ms","100,100ms",,
"org.apache.flink.benchmark.StreamNetworkThroughputBenchmarkExecutor.networkThroughput","thrpt",1,30,17223.881108,426.811956,"ops/ms","100,100ms,SSL",,
"org.apache.flink.benchmark.StreamNetworkThroughputBenchmarkExecutor.networkThroughput","thrpt",1,30,44499.732966,1150.701385,"ops/ms","1000,1ms",,
"org.apache.flink.benchmark.StreamNetworkThroughputBenchmarkExecutor.networkThroughput","thrpt",1,30,50776.544079,1534.164574,"ops/ms","1000,100ms",,
"org.apache.flink.benchmark.StreamNetworkThroughputBenchmarkExecutor.networkThroughput","thrpt",1,30,14035.133932,342.266906,"ops/ms","1000,100ms,SSL",,
"org.apache.flink.benchmark.TwoInputBenchmark.twoInputMapSink","thrpt",1,30,16936.372008,2106.132313,"ops/ms",,,
"org.apache.flink.benchmark.TwoInputBenchmark.twoInputOneIdleMapSink","thrpt",1,30,10697.065122,1029.836213,"ops/ms",,,
"org.apache.flink.benchmark.WindowBenchmarks.globalWindow","thrpt",1,30,7608.553032,221.379725,"ops/ms",,,
"org.apache.flink.benchmark.WindowBenchmarks.sessionWindow","thrpt",1,30,896.830459,3.495180,"ops/ms",,,
"org.apache.flink.benchmark.WindowBenchmarks.slidingWindow","thrpt",1,30,761.700982,2.725391,"ops/ms",,,
"org.apache.flink.benchmark.WindowBenchmarks.tumblingWindow","thrpt",1,30,4687.172718,96.650961,"ops/ms",,,
"org.apache.flink.benchmark.StreamNetworkLatencyBenchmarkExecutor.networkLatency1to1","avgt",1,30,10.204875,0.015665,"ms/op",,,

Build failure unrelated: https://issues.apache.org/jira/browse/FLINK-17817

@pnowojski pnowojski merged commit 3ab5d58 into apache:master May 21, 2020
@pnowojski pnowojski deleted the f17842 branch May 21, 2020 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants