Skip to content

perf(test): cut round-trips in HNSW vector-index integration tests#1505

Merged
kriszyp merged 2 commits into
claude/fix-ci-5of6from
claude/perf-vector-tests
Jun 28, 2026
Merged

perf(test): cut round-trips in HNSW vector-index integration tests#1505
kriszyp merged 2 commits into
claude/fix-ci-5of6from
claude/perf-vector-tests

Conversation

@dawsontoth

@dawsontoth dawsontoth commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Measured result (CI, Windows shard 5/6)

The restart-reduction restructure (deploy all tables once, ~5 worker restarts → 2) delivered the win:

Test Before After
delete-entry-point 476s 0.25s
update-churn 345s 0.47s
threshold queries 381s 0.023s
reindex backfill 362s 2.75s
HNSW suite total 1764s 422s (−76%, ~22 min saved)

All four vector tests pass on v24/v26/Windows. Per-test cost was almost entirely the per-test worker restart; the residual ~422s is the single shared before deploy+restart. (The round-trip reductions — bulk insert + parallel read-back — are a secondary, in-the-noise contribution on top.)


Status: Draft — Windows CI perf for the vector-index integration tests. Stacked on #1504 (set as this PR base), so its shard-5/6 hardening is in scope and the perf change is validated without the pre-existing flake noise. Independent of the RFC PR #1503.

Why

integrationTests/server/vector-index-integrity.test.ts is a top Windows CI hotspot — the HNSW vector-index data-integrity suite runs ~29 min on Windows 5/6 (1763s), with individual tests at 284s/237s/184s.

The data is tiny (DIMS=8, N≤50). The cost is ~100–200 sequential, individually-committed HTTP round-trips per test — i.e. per-request round-trip + per-write fsync, not vector math. Measured ratio: ~6× slower on Windows than local for the same suite.

Changes (correctness-neutral)

  • Bulk-insert the reindex pre-index seed — replace N sequential POSTs with one insert op. There's no HNSW index during these inserts (the table is altered to add the index afterward), so per-record ordering is irrelevant; the backfill builds the index from the stored rows either way.
  • Parallelize independent read-back searches — the update-churn and reindex verification loops issue N independent QUERY searches; run them with Promise.all instead of serializing the round-trips.

Deliberately left sequential (order-sensitive, would change what's tested): the delete-entry-point insert/delete sequence (entry-point election) and the churn update sequence.

Validation

⚠️ CI-validated, not locally measured. restart_service is flaky in a local multi-loopback setup — the per-test readiness probes time out at 60s, which both fails and dominates local timings (an artifact that doesn't exist on CI, where these tests pass). The update-churn test — the one that runs cleanly locally — still passes with the parallelized read-back. The real before/after is the Windows 5/6 shard time on this PR's CI run vs the ~1763s baseline.

Bigger levers (not in this PR)

  • Per-test restartHttpWorkers — each test restarts workers (~5 across the suite; reindex does 2). Worker-restart cost is likely a larger driver than the data ops, but reducing it means sharing setup across tests (changes test isolation) — worth a follow-up.
  • CI sharding/concurrency — Windows runs one rotating shard; 5/6 is a ~29-min hotspot. Rebalancing heavy vector files across shards would cut wall-time for every PR. Infra-level, owner's call.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request optimizes the vector-index-integrity integration tests by parallelizing independent read-only vector searches using Promise.all and batching record insertions into a single bulk request instead of executing them sequentially. These changes significantly improve test execution performance. There are no review comments, so I have no additional feedback to provide.

@claude

claude Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

The vector-index-integrity suite is a major Windows CI hotspot (~29 min for the
suite). Most of the cost is ~100–200 sequential, individually-committed HTTP
round-trips per test — tiny data (DIMS=8, N≤50), so it's round-trip + per-write
fsync overhead, not vector math. Apply correctness-neutral reductions:

- reindex backfill: bulk-insert the N pre-index seed records in one request
  instead of N sequential POSTs. There is no HNSW index during insert, so
  per-record ordering is irrelevant; the backfill builds the index afterward.
- update-churn & reindex: run the independent read-back verification searches
  concurrently (Promise.all) instead of serializing N round-trips.

Left untouched (semantically order-sensitive): the entry-point insert/delete
sequence and the churn update sequence.

Note: validated on CI, not locally — restart_service is flaky in a local
multi-loopback setup (readiness probes time out at 60s), which both fails and
dominates local timings; the churn test (the one that runs cleanly locally)
still passes with the parallelized read-back.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dawsontoth dawsontoth changed the base branch from main to claude/fix-ci-5of6 June 26, 2026 20:27
@dawsontoth dawsontoth force-pushed the claude/perf-vector-tests branch from 826779e to 9bf4a5b Compare June 26, 2026 20:28
Each test in this suite deployed its own component and restarted the HTTP
workers; the restart is the dominant per-test cost on slow runners (a test doing
3 inserts still took ~265s on Windows — almost entirely restart/setup). Deploy
all four tables in one component with a single restart in `before`, and drop the
per-test add_component/set_component_file/restart. Restarts: ~5 -> 2 (the shared
one, plus the single restart `reindex` needs for its mid-test index-add);
add_component: 4 -> 1.

Tables keep distinct names/databases so the tests stay isolated despite sharing
one component. ReindexTable is deployed without an index initially; the reindex
test redeploys the full schema with it indexed (a no-op re-assert for the other
three, which have already run — reindex is last) to trigger backfill.

CI-validated (local restart_service is flaky in a multi-loopback setup).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cb1kenobi cb1kenobi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is rad, nice work!

@kriszyp kriszyp merged commit 551c8f9 into claude/fix-ci-5of6 Jun 28, 2026
45 of 47 checks passed
@kriszyp kriszyp deleted the claude/perf-vector-tests branch June 28, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants