Skip to content

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

Merged
kriszyp merged 3 commits into
mainfrom
claude/perf-vector-tests-main
Jun 29, 2026
Merged

perf(test): cut round-trips in HNSW vector-index integration tests#1523
kriszyp merged 3 commits into
mainfrom
claude/perf-vector-tests-main

Conversation

@dawsontoth

Copy link
Copy Markdown
Contributor

Splits the HNSW vector-index test perf work out of #1505 (which merged into a stacked branch) into its own PR targeting main.

Why

integrationTests/server/vector-index-integrity.test.ts is a top Windows CI hotspot — the HNSW vector-index data-integrity suite ran ~29 min on Windows 5/6 (1763s). The data is tiny (DIMS=8, N≤50); the cost is per-test worker restarts plus ~100–200 sequential, individually-committed HTTP round-trips per test — round-trip + per-write fsync overhead, not vector math.

Measured result (CI, Windows shard 5/6)

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. The dominant per-test cost was the per-test worker restart; the residual ~422s is the single shared before deploy+restart.

Changes (correctness-neutral)

  • Deploy all four tables once in a single component with one restart in before, dropping the per-test add_component/set_component_file/restart. Restarts: ~5 → 2; add_component: 4 → 1. Tables keep distinct names/databases so tests stay isolated.
  • Bulk-insert the reindex pre-index seed — replace N sequential POSTs with one insert op. There's no HNSW index during these inserts (the index is added afterward), so per-record ordering is irrelevant; the backfill builds the index from the stored rows.
  • Parallelize independent read-back searches — the update-churn and reindex verification loops run their N independent QUERY searches with Promise.all instead of serializing.

Deliberately left sequential (order-sensitive): the delete-entry-point insert/delete sequence and the churn update sequence.

Validation

CI-validated, not locally measured — restart_service is flaky in a local multi-loopback setup (per-test readiness probes time out at 60s, 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.

🤖 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 HNSW vector-index data-integrity integration tests by consolidating the schema deployment and worker restarts into a single shared setup, and parallelizing read-only vector searches. The review feedback recommends limiting the concurrency of these parallelized HTTP requests by processing them in smaller chunks to prevent potential socket exhaustion or test flakiness on slow CI environments.

Comment thread integrationTests/server/vector-index-integrity.test.ts Outdated
Comment thread integrationTests/server/vector-index-integrity.test.ts Outdated
@claude

claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

@dawsontoth dawsontoth force-pushed the claude/perf-vector-tests-main branch from 39c3a2e to efad325 Compare June 29, 2026 15:43
dawsontoth and others added 3 commits June 29, 2026 13:31
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>
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>
…il workers settle

The reindex test restarts HTTP workers to add the HNSW index, then backfill
settles per-worker. The single-shot readiness poll confirmed only one worker was
ready, so firing all N read-back searches at once fanned them across workers —
some still reloading the index-adding schema ('embedding is not indexed') —
producing spurious misses (saw 7/40 > 4 allowed on Linux v24 5/6).

- Add mapConcurrent(): bounded-concurrency fan-out (cap 10 in flight) so a large
  burst can't exhaust sockets on slow runners, while staying parallel.
- reindex: collapse the readiness gate + recall assertion into one converging
  poll — retry the full bounded read-back until misses <= allowed (or 60s), so
  per-worker backfill settling can't cause a spurious failure. A real recall
  regression still never converges and fails.
- update-churn: use mapConcurrent for the read-back (no behavior change; bounds
  the fan-out per review feedback).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dawsontoth dawsontoth force-pushed the claude/perf-vector-tests-main branch from efad325 to dea55fb Compare June 29, 2026 17:31

@kriszyp kriszyp 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.

Approving — test-only change cutting round-trips in the HNSW vector-index integration tests; no assertions weakened and build/search are still genuinely exercised. CI green. Thanks @dawsontoth!

— 🤖 KrAIs (Kris's review assistant)

@kriszyp kriszyp merged commit 0b6c584 into main Jun 29, 2026
47 checks passed
@kriszyp kriszyp deleted the claude/perf-vector-tests-main branch June 29, 2026 21:07
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.

2 participants