Cohere 1M measurement and fix for k=100 concurrent-search scaling - #30
Merged
Merged
Conversation
…alisation Running Zvec's published Cohere 1M configuration (int8 / float, M = 15, efSearch 180, recall@100, 12 concurrent clients) showed QPS that was not monotonic in efSearch at k = 100 with 12 threads: efSearch 100 reached 1,883 QPS while efSearch 180 reached 3,129. Single-threaded and k = 10 runs were monotonic, so the problem was in the per-hit work under concurrency. GetMetadata and ReadGuidFromDisk went through MemoryMappedViewAccessor, whose every ReadX/ReadArray call takes an interlocked reference on the shared SafeBuffer. At k = 100 that is a few hundred atomic operations per query on one cache line, and twelve threads serialised on it. Both now read through the raw mapping pointer the distance code already uses. Cohere 1M float, efSearch 100, 12 threads: 1,883 -> 6,441 QPS. Single-threaded throughput is unchanged. Benchmark harness: --passes N repeats the query set N times per efSearch row; Cohere has only 1,000 queries, which at several thousand QPS is over in under a second. Warm-up now uses the measurement's thread count and runs at least one full pass and at least two seconds, because a fresh process soft-faults every page of a multi-gigabyte mapping into its working set even when the OS has the file cached; the first row of a sweep was 2-3x slower than the second before this. Measured (12 cores, throttling exemption, 12 build threads, 12 query threads, --passes 10), efSearch 180: float build 419 s (2,385/s) 3,376 MiB recall@100 94.8 % 3,764 QPS (1 thread: 565) int8 build 181 s (5,516/s) 1,194 MiB recall@100 93.2 % 6,841 QPS (1 thread: 839) Documented in benchmarks/README.md with the caveats that apply to a comparison against Zvec's 16-vCPU chart; a short table in README.md. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Measures Cohere 1M in the configuration Zvec publishes (int8 / float,
M = 15,efSearch = 180, recall@100, 12 concurrent clients), and fixes a scaling bottleneck that the measurement exposed.Bug: result materialisation serialised concurrent searches
At
k = 100with 12 query threads, QPS was not monotonic in efSearch: efSearch 100 gave 1,883 QPS, efSearch 180 gave 3,129. Single-threaded andk = 10sweeps were monotonic, so the per-hit work under concurrency was the suspect.GetMetadataandReadGuidFromDiskread throughMemoryMappedViewAccessor, whose everyReadX/ReadArraycall takes an interlocked reference on the sharedSafeBuffer. Atk = 100that is a few hundred atomic operations per query on one cache line; twelve threads serialised on it. Both now read through the raw mapping pointer the distance computations already use.Cohere 1M float, efSearch 100, 12 threads: 1,883 → 6,441 QPS. Single-threaded throughput unchanged (so the SIFT-1M numbers in the README did not move).
Harness
--passes N: repeat the query set N times per efSearch row. Cohere has only 1,000 queries; at several thousand QPS a row was over in under a second.Measured (12 cores, throttling exemption, 12 build threads,
--concurrency 12 --passes 10)Zvec's chart for the same configuration on 16 vCPUs reads as roughly 8–9 k QPS at recall@100 ≈ 0.93–0.94 (image only, approximate). Per core the int8 row is in the same range — on different hardware, OS and day, which is as far as the comparison goes. The documentation says so explicitly. Note that Zvec's 1M run does not use its refiner (only 10M does); the earlier README sentence claiming otherwise is corrected.
Tests
Fast suite 333 + Slow 7 green, 0 warnings. The read-path change is covered by the existing metadata/Guid round-trip tests; no new test since the defect is a contention profile rather than a functional bug.