Commit c8f5fbc
feat(mutations): replace pipeline on/off flag with edge-count threshold
The benchmark matrix in worker/pipeline_bench_test.go showed the
pipeline loses ~2x on small mutations (≤10 edges total) and wins
~1.5x on bulk (live-loader sized: 1000 edges per txn across many
predicates). A binary on/off flag forces an all-or-nothing choice,
penalising whichever side of that crossover the workload spends most
time on.
Replace MutationsUsePipeline (bool) with MutationsPipelineThreshold
(int):
threshold = 0 -> never use the pipeline (default; legacy behavior)
threshold = 1 -> always use the pipeline (any txn with ≥1 edge)
threshold = N -> use the pipeline only when len(m.Edges) >= N
The threshold compares against total edges in the proposal. From the
benches the crossover is around 100; the live-loader 1M dataset uses
~1000 edges per txn, so anything from 100-1000 will engage the
pipeline only on bulk-shaped mutations and leave small interactive
mutations on the legacy serial path.
Wiring:
- x.WorkerConfig.MutationsPipelineThreshold (int) replaces the
bool field.
- feature-flags superflag: "mutations-pipeline-threshold=0".
- alpha/run.go reads it via featureFlagsConf.GetInt64.
- worker/draft.go applyMutations branches on
`t > 0 && len(m.Edges) >= t`.
Verified end-to-end against the live-loader benchmark
(1million.rdf.gz, official 1M schema):
threshold=0 : 13.56s, 80,129 N-Quads/s (legacy, matches baseline)
threshold=1 : 9.92s, 115,742 N-Quads/s (always-on, matches prior)
CLI usage:
dgraph alpha --feature-flags="mutations-pipeline-threshold=200"
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 7929232 commit c8f5fbc
4 files changed
Lines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
799 | | - | |
| 799 | + | |
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
| 529 | + | |
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
145 | 153 | | |
146 | 154 | | |
147 | 155 | | |
| |||
0 commit comments