Don't lock SegmentHolder for the entire duration of read operations#8056
Merged
JojiiOfficial merged 5 commits intodevfrom Feb 6, 2026
Merged
Conversation
eb68f56 to
983e249
Compare
SegmentHolder for the entire duration of read operationsSegmentHolder for the entire duration of read operations
generall
reviewed
Feb 6, 2026
timvisee
requested changes
Feb 6, 2026
Comment on lines
1320
to
1325
Member
There was a problem hiding this comment.
We need the same treatment here. This still read locks the segment holder for the duration of the for loop.
Calling size_info() should be relatively cheap, but there's another read lock on the segment itself.
Two problems:
- on long writes the inner read lock might hang for some time
- the sync read lock blocks the async runtime!
In my opinion we should clone the segments. Then use spawn_blocking and run the for loop with read locks in blocking context.
Contributor
Author
There was a problem hiding this comment.
Good catch! I fixed it in 34cf12f
In my opinion we should clone the segments. Then use spawn_blocking and run the for loop with read locks in blocking context.
I'll tackle this in a separate PR 👍🏻
timvisee
approved these changes
Feb 6, 2026
generall
added a commit
that referenced
this pull request
Feb 9, 2026
…#8056) * Don't lock SegmentHolder during read operations * Add comment clarifying eager segment allocation * review fixes * Remove TODO * Shorter locking of segment holder in calculate_local_shard_stats --------- Co-authored-by: generall <andrey@vasnetsov.com>
9 tasks
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.
Continuation of #8024
Benchmarks
Setup
Parallel updates + searches using the following commands:
For hardware, a 2 core 8GB cloud cluster with 1 node was used.
For the searches, a slightly modified version of BFB was used, mostly to measure slow requests in detail.
The changes can be found here: qdrant/bfb#97
Results
The results of 2-3 runs on each Qdrant@1.16.3 and this PR averaged.
PR
Qdrant@1.16.3
Furthermore:
These results show that this PR improves on slow requests during search