GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [fix][ml] Fix active cursor retention and deferred-update synchronization by lhotari · Pull Request #26511 · apache/pulsar Conversation
|
| Workload | Cursors | Query ratio | PriorityQueue M ops/s | Final hybrid M ops/s | Mean change | Allocation B/op (before → after) |
|---|---|---|---|---|---|---|
randomSeekingForward01 |
100 | 1 | 28.80 ± 0.77 | 33.29 ± 1.07 | +15.6% | 47.83 → 47.83 |
randomSeekingForward01 |
100 | 10 | 21.61 ± 0.18 | 24.41 ± 1.84 | +12.9% | 47.14 → 47.14 |
randomSeekingForward01 |
100 | 100 | 15.20 ± 0.29 | 18.07 ± 0.31 | +18.9% | 65.35 → 65.35 |
randomSeekingForward01 |
500 | 100 | 10.65 ± 0.61 | 10.68 ± 0.52 | +0.2% | 46.37 → 46.37 |
randomSeekingForward10 |
500 | 10 | 6.16 ± 0.58 | 6.89 ± 0.96 | +11.8% | 48.37 → 48.33 |
cohort |
100 | 32 | 29.12 ± 0.86 | 51.02 ± 3.14 | +75.2% | 47.50 → 47.50 |
cohort |
500 | 32 | 29.11 ± 0.38 | 43.78 ± 4.41 | +50.4% | 47.50 → 47.50 |
cursorChurn |
500 | 0 | 16.15 ± 0.40 | 16.80 ± 0.33 | +4.0% | 192.16 → 192.00 |
Cursor churn versus #26506
At 500 active cursors with no rank queries, cursorChurn measures 15.09 ± 0.56 M ops/s for #26506 versus 16.66 ± 0.48 M ops/s for this PR, a +10.4% change in mean throughput. #26506's implementation is pinned to bbf855c72c33 and overrides only implementation classes in the same benchmark jar.
Why this sorting strategy
FIFO experiments improved several random-seek workloads but lost roughly half their throughput when cursors advanced together. Sorting only during incremental flushes preserved descending-old-position processing, but plain ArrayList.sort introduced temporary-buffer allocations for larger batches. The final hybrid uses the standard small-array sort below 32 entries on JDK 21; for larger batches it skips sorting if already ordered, otherwise uses Fastutil's in-place quicksort. Full rebuilds skip pending-list sorting. Separate paired experiments against plain deferred sorting reduced allocation from 58.37 to 46.37 B/update for large random batches and from 80.00 to 47.50 B/update for the 500-cursor cohort. Fastutil is already a dependency.
The read-only slowest-position benchmarks remain API coverage; this implementation's slowest-position lookup is not on the current broker path.
./gradlew :microbench:shadowJar # Repeat with (cursors, query ratio): (100,1), (100,10), (100,100), (500,100). java -jar microbench/build/libs/microbench-*-benchmarks.jar \ 'ActiveManagedCursorContainerBenchmark.randomSeekingForward01' \ -p activeManagedCursorContainerImplType=DEFAULT \ -p numberOfCursors=100 \ -p getNumberOfCursorsAtSamePositionOrBeforeRatio=10 \ -f 2 -wi 2 -i 3 -w 1s -r 1s -jvmArgs '-Xms256m -Xmx256m' -prof gc # Ten-thread comparison: use randomSeekingForward10, 500 cursors, query ratio 10. # Churn comparison: use cursorChurn, 500 cursors, query ratio 0. java -jar microbench/build/libs/microbench-*-benchmarks.jar \ 'ActiveManagedCursorContainerCohortBenchmark.advanceCohort' \ -p numberOfCursors=100,500 \ -f 2 -wi 2 -i 3 -w 1s -r 1s -jvmArgs '-Xms256m -Xmx256m' -prof gc
If the box was checked, please highlight the changes
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…tion Release removed cursor references immediately and compact stale nodes in batches without flushing lazy position updates. Track queue membership to prevent duplicate entries during reactivation. Fix deferred-state mutation under a shared read lock. Use optimistic reads for clean slowest-position queries and exclusive locking when flushing. Add regression tests and cursor churn/read-only JMH workloads. Assisted-by: OpenAI Codex
Remove the tail-only early return from incremental position updates so joining and leaving a shared position group updates cursor ranks. Add regression coverage for a moving cursor that is removed and reactivated, tail group transitions, and subsequent node compaction. Assisted-by: OpenAI Codex
Make add() clear pending removal state when an existing cursor receives a real position, matching updateCursor(). Add regression coverage for both rebuild and incremental flushing and both ways of untracking. Assisted-by: OpenAI Codex
Keep the tail counter when its old and new positions are separate from the preceding group. Preserve counter updates when joining or leaving a shared position group, and add a focused tail-seek benchmark. Assisted-by: Codex
Add regression tests for exclusive pending-position flushes and appending after compaction removes the tail. Strengthen the test-only state checker to validate cursor references, backward links, the tail, and tracked node count without changing production operation paths. Assisted-by: Codex
Accumulate pending nodes in an ObjectArrayList and preserve descending old-position processing during incremental flushes. Use the small-array sort for short batches, skip sorting ordered larger batches, and use in-place quicksort otherwise to avoid temporary merge buffers. Full rebuilds skip pending-list sorting. Cover batch boundaries, repeated updates, new cursors and shared position groups. Add a grouped-advance benchmark. All 59 cursor cases and quickCheck pass; final paired JMH comparisons completed without a measured throughput regression. Assisted-by: Codex
There was an error while loading. Please reload this page.
…tion (apache#26511) (cherry picked from commit 72632e5)
…tion (apache#26511) (cherry picked from commit 72632e5) (cherry picked from commit cd9dd80)
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.