Skip to content

perf(index): coalesce small S3 shard partition reads - #11747

Merged
BubbleCal merged 1 commit into
mainfrom
yang/perf-ivf-aux-s3-6288
Dec 2, 2026
Merged

BubbleCal merged 1 commit into
mainfrom
yang/perf-ivf-aux-s3-6288

Conversation

@BubbleCal

@BubbleCal BubbleCal commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Refs #6288. Small non-PQ IVF partitions can lead to three S3 range requests per partition per shard even when neighboring partitions share pages. #6289 explored using the windowed shard reader. This change preserves partition-driven writing and coalesces adjacent ranges only when multiple whole partitions fit.

The merge budgets an estimated 2 MiB of decoded payload across at most four shard windows. It detaches partial Arrow slices when they would retain a larger batch across writer buffering. This applies to IVF_FLAT, IVF_SQ, IVF_HNSW_FLAT, and IVF_HNSW_SQ auxiliary files on S3 stores with lexical listing and variable-size multipart parts. The existing streaming path handles large partitions, remaining shards, S3 Express, and constant-size multipart backends. Partition and shard order, row ownership, and file format are preserved. Measured performance below is for AWS S3 Standard.

AWS S3 Standard validation

The benchmark used one fresh process and a 512 MiB cgroup per arm on the same isolated EC2 m7i.8xlarge in us-east-1. Each fixture used eight immutable S3 Standard shards, uniform 768-dimensional IVF_SQ rows, and V2.2 auxiliary files. Output commit timing runs from the production merge call through successful multipart completion. The comparison pins base 5854ba17 and candidate 05a4fb06.

Scenario / metric Baseline This PR Benefit
5M, cold AB commit latency, lower is better 1,102.82 s 831.05 s 1.33x speedup
5M, warm-client AB commit latency, lower is better 1,105.95 s 855.20 s 1.29x speedup
5M, cold BA commit latency, lower is better 1,092.04 s 842.90 s 1.30x speedup
5M, warm-client BA commit latency, lower is better 1,103.66 s 863.37 s 1.28x speedup
5M, S3 GETs in each pair, lower is better 53,680 requests 40,264 requests 25.0% fewer
5M, maximum cgroup peak across runs, lower is better 130.20 MiB 149.57 MiB +19.37 MiB
10M, cold BA commit latency, lower is better 2,221.54 s 1,657.49 s 1.34x speedup
10M, S3 GETs, lower is better 107,350 requests 80,522 requests 25.0% fewer
10M, kernel cgroup peak, lower is better 166.41 MiB 175.78 MiB +9.37 MiB

The four 5M pairs used 2,236 partitions and varied run order and client prewarm. Warm-client setup issued eight HEADs and opened fresh merge readers. The 10M pair used 4,472 partitions at the same per-shard density. Candidate peak anonymous charge grew by 15.23–31.00 MiB in matched 5M pairs and 11.99 MiB at 10M. The 10M process RSS peak was 191.35 MiB versus 180.16 MiB. All matched arms verified the same logical rows, partition lengths and metadata, with zero cgroup-limit or OOM events. GET count fell more than GET bytes, which decreased 0.8–0.9%. The median observed GET duration, including its body, fell in the 16–32 ms histogram bucket.

A skewed filtered SQ fixture with small tail partitions and a large streaming fallback preserved all 106,669 owned rows, with 1,958 → 1,099 GETs. A separate larger-partition filtered fixture used streaming in both arms and produced identical output with 1,664 GETs each. Its single-run latency was 33.88 s for baseline and 35.71 s for the candidate.

Workspace formatting and 22 targeted merger tests passed on managed Linux. Exact-head Linux x86 and ARM CI passed. The Linux x86 suite also passed the existing HNSW FLAT and SQ segment merge and graph rebuild cases.

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer performance labels Dec 2, 2026
@BubbleCal
BubbleCal marked this pull request as ready for review December 2, 2026 15:57

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

No merge-blocking issues found. Local six-shard FLAT/SQ comparisons across V2.1/V2.2 preserved ordered rows, vector values, ownership filtering, and partition lengths while reducing range reads. Large partitions continue through the existing streaming path.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 2, 2026
@BubbleCal
BubbleCal merged commit 3cd3c18 into main Dec 2, 2026
49 checks passed
@BubbleCal
BubbleCal deleted the yang/perf-ivf-aux-s3-6288 branch December 2, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-index Vector index, linalg, tokenizer K-approved Latest Gatekeeper recommendation permits acceptance. performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants