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
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**
5ae62f9 to
f1dd0a7
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
The first 10 failing tests are:
incremental_backup_usenames
reco-ddlk-sql **quarantined**
consumer_non_atomic_default_consumer_generated **quarantined**
tunables
572c04c to
4f410e0
Compare
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**
reco-ddlk-sql [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:
constraints_partial_index_off_generated [failed with core dumped]
constraints [failed with core dumped]
elect_retry_known_master
sqlqueries
skipscan [timeout] **quarantined**
4f410e0 to
e937ae0
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
The first 10 failing tests are:
constraints_noreorder_generated [failed with core dumped]
sqlqueries
tunables
skipscan [timeout] **quarantined**
e937ae0 to
4af34c1
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: 2/751 tests failed ⚠.
The first 10 failing tests are:
reco-ddlk-sql **quarantined**
nowritetimeout
|
We've tested this extensively with the hand-off also enabled under |
4af34c1 to
0d5f9ac
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
7b5e0a2 to
3a60ab3
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
RoboMark testing: failed.
RoboRivers testing: Success ✓.
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
RoboMark testing: failed.
RoboRivers testing: Success ✓.
The first 10 failing tests are:
autoanalyze **quarantined**
2daa5c7 to
c25897e
Compare
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
c25897e to
527d890
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>
527d890 to
ec38fb6
Compare
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
ec38fb6 to
4cd5500
Compare
roborivers
left a comment
There was a problem hiding this comment.
Failed to merge main into this PR - resolve conflicts and re-run ⚠.
🎯 The "Why" (Intent)
Every block processor (writer thread) blocks until all replicants ack its commit, so the 8 writer threads cap commits in flight at 8. This moves that wait to a background thread; clients still get their reply only after every ack. Port of #1963.
🛠️ The "What" (Critical Changes)
async_dist_commit, on by default) checks acks for every handed-off commit, with the inline wait's timeouts, incoherent marking, lease and durable-LSN rules (shared code, split out of the inline wait).ireqand its request logger) and takes the next one; the reply, request log and osql cleanup still run after the acks. A request can now be finished from another thread.net_send_nodrop, so a reply never waits for buffer space and one slow node cannot stall the waiter (Results 4).async_dist_commit_max_outstanding_trans, default 1024 (Results 5). A commit that doesn't fit waits inline.REP_SYNC_FULLblkseq commits, including durable LSNs andreplicant_retry_on_not_durable. Everything else waits inline as before (Caveats).async_dist_committest comparing each case with the inline wait.async_dist_commit_benchtest (long-running, so skipped bymake) reruns every experiment below on any cluster and prints the numbers;debug_ack_delay_ms(test only, default 0) makes replicants send acks late for the late-ack runs.📊 Results
8-node cluster, RelWithDebInfo build of this PR on current main, measured 2026-10-23 to 10-30. Each client inserts single rows (autocommit) into its own table, one commit in flight per client. 128 MB cache (production size; code default 64 MB), 8 writer threads, 48 SQL threads per node; 300 s × 2–3 unless noted.
1. Off vs on
xychart-beta title "Inserts/s: waiter on (bars) vs off (line)" x-axis "clients" [16, 32, 64, 128, 256] y-axis "inserts / s" 0 --> 24000 bar [19701, 22043, 21531, 21890, 21858] line [14742, 14751, 14187, 15256, 14407]numbers (+34% … +52%)
Off is flat: 8 writer threads, each held for a whole ack round trip. The previous revision of this PR measured +16–25%; side by side on the same day (2 × 300 s) off is unchanged (32 / 256 clients: 14,361 / 13,358 before vs 14,106 / 14,467 now) and on went from 16,986 / 17,207 to 22,114 / 22,065.
2. Why not more writer threads, and #6293
3. Network latency: big gain. Slow replicants: none.
xychart-beta title "Late acks, 64 clients: waiter on (bars) vs off (line)" x-axis "every ack delayed by" ["1 ms", "2 ms", "5 ms"] y-axis "inserts / s" 0 --> 24000 bar [22454, 20574, 10938] line [5903, 3419, 1490]4. Who sends the reply
net_send_nodropit is always queued at once, even when the 64 MB send queue to that node is full. That limit is meant for large messages (log records, schema), not replies.nodropremoves the blocking send instead, so the pool and its tunable are gone.nodrop.5. Cap (only the cap changes; inline waits per run in brackets)
xychart-beta title "Cap sweep: 1000 clients (bars), 500 clients (line)" x-axis "cap" [128, 256, 512, 1024, 2048] y-axis "inserts / s" 0 --> 24000 bar [17028, 17409, 19281, 19135, 19162] line [18857, 19230, 20706, 21088, 20902]numbers (inline waits per run in brackets)
kill -9; clients talk only to replicants and keep inserting. Every client has a commit in flight (cap = clients; SQL threads raised to 80 per node at 500 clients and 141 at 1000), 3 runs each:6. Safety and cost
durable_lsnson (now handed off): 32 clients 12,832 / 14,746 off vs 20,916 / 22,343 on (+57%); 128 clients 13,372 / 14,474 vs 22,173 / 22,026 (+59%). The durable / non-durable-retry / master-swing tests pass with the waiter turned on (final_non_durable_retry,lostwrite,master_load_commit,repeated_downgrades,rtcpu_drtest,cinsert_linearizable); @markhannum also ran Jepsen and the replicant-retry tests with the hand-off on underDURABLE_LSNSandreplicant_retry_on_not_durable.7. A replicant falling behind (one replicant stopped, down 60 s, restarted; 1000 unpinned clients, cap 1000, 141 SQL threads, 900 s runs)
logput_window 40000000logput_window+inmem_repdbA restarted replicant gets every new log record twice: once as a live broadcast, which is gigabytes ahead of where it is, so it is parked as out of order on its single receive thread; and again from its own gap fill. Parking took 56% of that thread during catch-up, so at the waiter's commit rate it fell behind.
logput_window(#6431) stops the live broadcast to an incoherent node more than 40 MB behind, so it only pulls the log in order. All settings tried and why are indocs/adr/0002-replica-catch-up.mdin #6431.Inline, as before: quorum (
sync atleast N), other sync modes, 2PC, rowlocks, and any request with DDL (its schema changes commit from their own threads on the same request, and only one thread may hand off).No gain when the replicants themselves are slow (section 3). The gain is from late acks over the network.
A restarted replicant catches up slowly at full load with the waiter on unless
logput_windowis set: 427 s to never, vs ~80 s with it (section 7, Turn on logput_window by default #6431).On by default assumes
logput_window(Turn on logput_window by default #6431) andinmem_repdb(Make inmem_repdb the default #6287) are on by default too. With the waiter alone, ~1000 commits in flight push replicants hard: the slow-replicant check (a node whose average ack time is 2× the second-worst) marked a node incoherent 23 and 15 times in 6-minute runs, and clients of that node are rejected until it catches up. With both on it did so 1 and 0 times, as with the waiter off (8 nodes, 1000 clients, 2026-10-30, runs interleaved):logput_window+inmem_repdbMaster killed 3 minutes into a 6-minute run with all three on (2 runs): new master after 9.4 / 8.1 s, 19.2k / 18.8k inserts/s before and 21.2k / 21.9k after, 295 / 575 retried requests, 0 failed, 0 acked inserts lost; 5 / 3 slow-replicant marks per run, against 17–25 with the waiter alone.