Bound per-shard content in FT.SEARCH fan-out #1684
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.50) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 584 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.381
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1684"
general
weight: 0.35
greptile-apps[bot]
Bound per-shard content in FT.SEARCH fan-out
Implements #1324.
A cluster FT.SEARCH bounded to K results (KNN K, or LIMIT offset+count) currently has
every shard return K results with content: N × K records read and serialized to return K.
With
search.fanout-bounded-contentenabled, each shard returns K candidates (keys andscores) with content for only its first E_i. The coordinator ranks all candidates as
before, then fetches the content of winners that arrived without it from their owning
shard: a new
FetchContentRPC, or in-process for its own shard. Fetched keys arerevalidated against the query; a winner that no longer matches is replaced by the next
candidate, so the reply is the same as without the setting.
E_i is the smallest per-shard limit that keeps the probability of a fetch round at or
below
search.fanout-content-recovery-rate, modeling each shard's share of the winners asbinomial in its share of the slots.
Applies to FT.SEARCH with content, no SORTBY or INKEYS, across two or more shards.
Configuration
| Name | Default | Description |
|---|---|---|
|
search.fanout-bounded-content|no| Enables bounded content fan-out ||
search.fanout-content-recovery-rate|0.1| Target fraction of queries that need a fetch round; lower is more conservative |The default recovery rate was chosen from a sweep of 0.01, 0.1, 0.3 and 1.0 (N=4):
| Recovery rate | Field RPS (1000 conns) | HNSW RPS (1000 conns) | HNSW RPS (1 conn) |
|---|---|---|---|
| 0.01 | +77% | +4% | 0% |
| 0.1 | +107% | +9% | −1% |
| 0.3 | +107% | +10% | +1% |
| 1.0 | +143% | +6% | −15% |
0.1 matches 0.3, the best HNSW result, with fewer fetch rounds. 1.0 helps field search
further but slows HNSW at low load.
Compatibility
content_limit,content_omitted,FetchContent). Ashard without them returns full content and is never asked to fetch.
Testing
fetch rounds (backfill, termination, failures).
- HASH and JSON;
- even and skewed data;
- LIMIT offsets, RETURN, KNN, hybrid queries and WITHCURSOR;
- uneven slot ownership and replica targets;
- shards without
content_limit;- fetch failures (partial results and consistency);
- documents changed between rounds.
The in-flight blocking tests also run with the setting on.
Performance
Setup:
per shard.
io-threads 2,reader-threads 8,writer-threads 8.| Workload | Data | Query |
|---|---|---|
| Field | 50,000 docs × 50 TEXT fields of ~1 KB |
@field1:<term>(LIMIT 10, and LIMIT 0 100) || Prefix | 10,000 docs, one 50 B TEXT field,
WITHSUFFIXTRIE|@field1:<term>*|| HNSW | 100,000 docs, 256-d FLOAT32 vector (HNSW, M 16) |
(@price:[100 500])=>[KNN 10 @embedding $vec], RETURN 2 |Throughput (1000 connections per client process)
| Workload | N | RPS off | RPS on | RPS improvement |
|---|---|---|---|---|
| Field | 2 | 1,072 | 1,558 | +45.3% |
| Field | 4 | 964 | 1,992 | +106.6% |
| Field, LIMIT 0 100 | 2 | 103 | 173 | +67.9% |
| Field, LIMIT 0 100 | 4 | 104 | 253 | +144.3% |
| HNSW | 2 | 14,890 | 14,794 | −0.6% |
| HNSW | 4 | 13,593 | 14,786 | +8.8% |
| Prefix | 2 | 24,841 | 22,433 | −9.7% |
| Prefix | 4 | 21,364 | 20,075 | −6.0% |
Latency (1 connection per client process)
Improvement = (off − on) / off; positive means lower latency with the setting on.
| Workload | N | p50 ms off → on | p50 improvement | p99 ms off → on | p99 improvement |
|---|---|---|---|---|---|
| Field | 2 | 2.95 → 1.76 | +40.3% | 4.12 → 2.86 | +30.6% |
| Field | 4 | 4.74 → 2.19 | +53.8% | 7.47 → 3.68 | +50.7% |
| Field, LIMIT 0 100 | 2 | 27.65 → 11.24 | +59.3% | 34.72 → 18.48 | +46.8% |
| Field, LIMIT 0 100 | 4 | 38.88 → 12.52 | +67.8% | 65.94 → 24.24 | +63.2% |
| HNSW | 2 | 0.39 → 0.39 | 0.0% | 0.57 → 0.59 | −3.5% |
| HNSW | 4 | 0.56 → 0.55 | +1.8% | 1.19 → 1.21 | −1.7% |
| Prefix | 2 | 0.21 → 0.25 | −19.0% | 0.29 → 0.44 | −51.7% |
| Prefix | 4 | 0.34 → 0.46 | −35.3% | 0.87 → 1.09 | −25.3% |
Run-to-run variation is within ±5%.
Queries with small content (prefix) are slower with the setting on, which is why it is off
by default.
In progress
Benchmarks of this branch with the setting off, against its base commit, are running.
Results will be posted in the comments.