Commit 291ab1d
committed
storeliveness: smear storeliveness heartbeats via coordinator
Previously, heartbeat messages were sent immediately when enqueued via
`EnqueueMessage`. In large clusters, many stores might all send heartbeats
simultaneously at the same tick interval, causing a spike in runnable
goroutines that caused issues elsewhere in the database process.
This patch introduces a heartbeat coordinator that batches and smears
heartbeat sends over a configurable duration using a taskpacer. The
coordinator is enabled by default via the
`kv.store_liveness.use_heartbeat_coordinator` cluster setting (defaults to
true), and can be configured via
`kv.store_liveness.heartbeat_coordinator.refresh` (default: 10ms) and
`kv.store_liveness.heartbeat_coordinator.smear` (default: 1ms) settings.
When enabled, messages are enqueued but not sent immediately. Instead,
they wait in per-node queues until `SendAllEnqueuedMessages()` is called,
which signals the coordinator. The coordinator waits briefly
(`batchDuration`) to collect messages from multiple stores, then paces the
signaling to each queue's `processQueue` goroutine using the pacer to
spread sends over time.
Fixes: #148210
Release note: None1 parent e5666f1 commit 291ab1d
File tree
8 files changed
+583
-54
lines changed- pkg
- kv/kvserver
- storeliveness
- server
- testutils/localtestcluster
8 files changed
+583
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
34 | 66 | | |
35 | 67 | | |
36 | 68 | | |
37 | 69 | | |
| 70 | + | |
38 | 71 | | |
39 | 72 | | |
40 | 73 | | |
| |||
168 | 201 | | |
169 | 202 | | |
170 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
171 | 212 | | |
172 | 213 | | |
173 | 214 | | |
| |||
329 | 370 | | |
330 | 371 | | |
331 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
332 | 376 | | |
333 | 377 | | |
334 | 378 | | |
| |||
426 | 470 | | |
427 | 471 | | |
428 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
429 | 476 | | |
430 | 477 | | |
431 | 478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
| |||
0 commit comments