sjvanrossum commented on PR #40606:
URL: https://github.com/apache/beam/pull/40606#issuecomment-6397668935
Hey! I reviewed this change and noticed quite a bit of complexity around
synchronization/locking was added and I worried that it might affect bundle
processing throughput. I found a notable throughput regression that seems to be
caused by cross-thread `requestStream.request(1)` calls from bundle worker
threads, extra locking and per-message allocations and a 20ms poll-stall
fallback when a bundle queue fills.
I've addressed this in #40788 by using a simple state machine and
non-blocking `add` since overflow spills onto a backlog queue anyhow.
### Benchmarks
`ProcessBundleBenchmark` executed on Apple M5 Pro.
```bash
./gradlew :sdks:java:harness:jmh:jmh
--args="org.apache.beam.fn.harness.jmh.ProcessBundleBenchmark -p
elementsEmbedding=false -f 1 -wi 3 -i 5 -w 2s -r 2s -foe=true"
```
This change shows a ~17% throughput regression on `testLargeBundle`:
| Benchmark (`elementsEmbedding=false`) | Base | This PR | vs base |
| :--- | ---: | ---: | ---: |
| `testLargeBundle` | `14,991.4 ± 496.3 ops/s` | `12,426.3 ± 2,080.8 ops/s`
| **-17.1%** |
| `testTinyBundle` | `35,573.1 ± 1,610.7 ops/s` | `35,691.6 ± 1,846.2 ops/s`
| **+0.3%** |
| `testStateWithCaching` | `6,748.1 ± 167.0 ops/s` | `6,831.1 ± 296.1 ops/s`
| **+1.2%** |
| `testStateWithoutCaching` | `3,936.6 ± 216.9 ops/s` | `3,699.4 ± 394.4
ops/s` | **-6.0%** |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]