Repository navigation
Hand the replication-ack wait to a background thread (port of #1963) - #6144
emelialei88 wants to merge 6 commits into
Conversation
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
The first 10 failing tests are:
reco-ddlk-sql **quarantined**
consumer_non_atomic_default_consumer_generated **quarantined**
tunables
sc_downgrade [timeout] **quarantined**
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Error ⚠.
Regression testing: Success ✓.
The first 10 failing tests are:
osql_cleanup [failed with core dumped]
analyze_partial_index_off_generated [failed with core dumped] **quarantined**
analyze [failed with core dumped] **quarantined**
tsa
consumer_non_atomic_default_consumer_generated **quarantined**
tunables
sc_downgrade [timeout] **quarantined**
skipscan [timeout] **quarantined**
c56015b to
61d8686
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: harness did not run - no test results were produced ⚠.
fb13067 to
799db91
Compare
8ab1886 to
d92c2e4
Compare
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
d92c2e4 to
5876642
Compare
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
5876642 to
5ae62f9
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
The first 10 failing tests are:
comdb2sys_queueodh_generated [db unavailable at finish]
reco-ddlk-sql **quarantined**
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
The first 10 failing tests are:
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
🎯 The "Why" (Intent)
Every block processor blocks until all replicants ack its commit, so the 8 writer threads cap in-flight commits at 8. This moves that wait to a background thread without changing what clients see. Port of #1963.
🛠️ The "What" (Critical Changes)
async_dist_commit, off by default) applies the same timeouts, incoherent marking, durability and lease rules, then replies on a thread of its own.REP_SYNC_FULLblkseq commits (no durable LSNs, 2PC, rowlocks or schema change) are handed off; everything else, or a full queue, waits inline.async_dist_committest comparing each case against the inline wait.📊 Results
8-node cluster, single-row autocommit inserts (each client has one commit in flight), 8 writer threads. Release build (RelWithDebInfo); sections marked Debug weren't rerun because they're diagnostics or replicant-bound. Old locking is forced with a benchmark-only switch, so both columns of each table use the same binary. Compare numbers within a table.
1. Off vs on (32 clients, cap 128, 2 runs of 180 s, inserts/s)
Both PRs together: +38% over today. No commit fell back to the inline wait.
2. Gain by client count (with #6293, cap = clients, 2 runs of 120 s)
Off stays at ~14k whatever the client count. On peaks at 32 clients; past that each waiter pass checks more commits in flight and the gain shrinks. Early stop recovers most of it.
3. More writer threads (32 clients, old locking, cap 64, 2 runs of 120 s)
Every ack broadcasts on one shared condition, waking every writer thread asleep in the inline wait (
bdb_wait_for_seqnum_from_all_int); each re-takes the same mutex, checks, and sleeps again. Debug perf profile at 32 threads: ~40% of master CPU in that loop (waking 12.8%, "acked yet?" check 11.0%, mutex re-take 10.0%, check + LSN compares 5.0%), and the ack thread queues on the same mutex. With this change only the waiter sleeps on it.4. Where writer threads spend their time (Debug, 32 clients, stack samples of the master)
With the waiter, the next bottleneck is the repo lock (#6293).
5.
async_dist_commit_max_outstanding_trans(64 clients, 2 runs of 120 s; % = commits that waited inline)6. Slow replicants (Debug)
7. Prototype: cheaper waiter passes (cap = clients, 2 runs of 120 s; not in this PR)
Skip reads every node's acks once per pass and skips commits that clearly aren't acked yet; early stop stops a pass at the first commit not yet acked by everyone (acks are cumulative per node).
With #6293 and early stop, against today's code (old locking, off; cap 128, 3 runs of 180 s): 32 clients 12,220 → 17,301 (+42%), 64 clients 11,282 → 15,665 (+39%).
8. Late acks (network latency) (cap 128, 2 runs of 120 s, inserts/s)
Benchmark-only patch on every replicant: apply each commit at full speed, but send its ack D ms later from a separate thread, as if over a long link.
Off, throughput is capped at about 8 writer threads ÷ ack delay, however many clients there are; on, it grows with clients ÷ delay until the master's other limits. At 2 ms / 32 and 5 ms / 32 the clients are the limit (32 commits per round trip), so #6293 adds nothing there. No commit waited inline.
9. Short replicant pauses (Debug; one replicant frozen 1 s every 15 s, 32 clients): off 10,687, on 11,140. No clear effect, likely because the slow-replicant rule stops waiting for the frozen node.
10. Cost (Debug profile, 64 clients)
views_lk, javasp lock) and the post-commit callbacks (analyze, genid48) are released/run after the local commit, before replication is confirmed. Client replies still wait for every ack.sync atleast N) / durable-LSN commits always use the inline wait.MAKE_SLOW_REPLICANTS_INCOHERENT) and stops waiting for it.