enhancement(transforms): Split mutable state, remove deep transform clones in Runner #27267
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 335 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.348
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #27267"
general
weight: 0.35
pront
Summary
Split immutable, sharable parts of transforms and mutable state. In
Runner::run_concurrently(), don't clone the transform;SyncTransform's are now immutable, shared overArc, andErasedSyncTransformcreates a fresh owned mutable state per batch. It then runs the transform with this mutable state.In bench
remap/hugethat this PR added, it improved throughput by over 40x on Ryzen AI 9 HX 370, 24 workers, batch size 256. Per-batch time 4.09 ms -> 78 µs.In our full config, Kafka source + ElasticSearch sink with memory buffer, throughput increased by ~300%.
It achieves so by removing two related bottlenecks:
1. No more serial transform cloning in
Runner::run_concurrently()2. For large or complex transforms, such as
remapwith a large VRL program, it allows workers to share one VRLProgram, eliminating work cloning the VRL syntax tree.Assisted by GPT-6.1 Astra and Sol, and I reviewed the changes.
Vector configuration
Proprietary to my employer; in summary the
remaptransform is automatically generated, about 300KB, and has over 2,000if's alone.Example:
How did you test this PR?
Full
cargo nextest runpassed (sinks::http::tests::json_zlib_compression_with_payload_wrapperflaky but unrelated); Vector 0.61 with this patch backported is currently running well in our testing environment.Help needed / future work
Removing the blocking
self.transform.clone()caused coordinator to spend less time blocking, which is intended; however this causedremap/add_fieldsandremap/parse_jsonto become 5-11% slower. This is due to producer having less time to populateinput_rx-> there are less events per batch -> more CPU time per event (in my testing went from ~21 events / batch to ~13.)Clearly there's a bottleneck on its producer side. The transform coordinator can also make use of bounded wait to allow the buffer to fill up.
Does this PR include user facing changes?
For a new deprecation announcement, follow the deprecation policy and add a
deprecation.d/notice instead.no-changeloglabel to this PR.