Commit 7000671
perf: optimize RB to Work throughput for large-scale Pod distribution
This commit introduces multiple performance optimizations for the
ResourceBinding to Work synchronization path, targeting scenarios
with 10000+ Pods distribution.
Key optimizations:
1. AsyncWorkCreator for Binding Controller
- Decouples Work creation from reconcile loop using 64 async workers
- Implements Assume Cache pattern (similar to kube-scheduler)
- Adds failure retry via requeue callback mechanism
- Periodic cleanup of stale cache entries (every 5 min)
2. Parallel Work preparation and execution
- Parallelizes DeepCopy and ApplyOverridePolicies across clusters
- Concurrent Work creation for multi-cluster scenarios
3. CreateOrUpdateWork optimization
- Implements Create-First pattern (try Create before Get+Update)
- Adds fast-path comparison to skip unchanged Work updates
- Reduces API calls by 30-50% in update scenarios
4. Precise orphan Work detection
- Uses TargetClustersHashAnnotation to track cluster changes
- Skips orphan check when clusters haven't changed
- Expected 90%+ reduction in List API calls
5. AsyncBinder for Scheduler
- 32 async workers for RB/CRB patch operations
- Decouples scheduling decisions from persistence
New configuration options:
--enable-async-work-creation=true
--async-work-workers=64
--enable-async-bind=true
--async-bind-workers=32
Performance improvement:
- New Work API calls: 2 -> 1 per Work (50% reduction)
- Orphan check: Every reconcile -> Only on cluster change (90%+ reduction)
- Multi-cluster Work creation: Sequential -> Parallel (Nx speedup)
- Expected throughput: ~200 Work/s -> ~1000+ Work/s (5-10x improvement)
Signed-off-by: Kevinz857 <[email protected]>1 parent 31e4756 commit 7000671
File tree
15 files changed
+1844
-140
lines changed- cmd
- controller-manager/app
- options
- scheduler/app
- options
- pkg
- apis/work/v1alpha2
- controllers
- binding
- context
- ctrlutil
- scheduler
- binder
- util/helper
15 files changed
+1844
-140
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
380 | 381 | | |
381 | 382 | | |
382 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
383 | 422 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
392 | 434 | | |
393 | 435 | | |
394 | 436 | | |
| |||
398 | 440 | | |
399 | 441 | | |
400 | 442 | | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
401 | 446 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
410 | 458 | | |
411 | 459 | | |
412 | 460 | | |
| |||
924 | 972 | | |
925 | 973 | | |
926 | 974 | | |
| 975 | + | |
| 976 | + | |
927 | 977 | | |
928 | 978 | | |
929 | 979 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
147 | 155 | | |
148 | 156 | | |
149 | 157 | | |
| |||
228 | 236 | | |
229 | 237 | | |
230 | 238 | | |
| 239 | + | |
| 240 | + | |
231 | 241 | | |
232 | 242 | | |
233 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
107 | 121 | | |
108 | 122 | | |
109 | 123 | | |
| |||
163 | 177 | | |
164 | 178 | | |
165 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
166 | 183 | | |
167 | 184 | | |
168 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
191 | 194 | | |
192 | 195 | | |
193 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
0 commit comments