-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce locks for adhoc BF #419
Conversation
…t of parallel adhoc with insert.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #419 +/- ##
==========================================
- Coverage 95.59% 95.48% -0.12%
==========================================
Files 65 65
Lines 4086 4093 +7
==========================================
+ Hits 3906 3908 +2
- Misses 180 185 +5
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments below :)
The main suggestion is to include UnSafe
in the API function's name so if we have an alternative safe solution in the future, we won't have to break the API again.
Also, since this can cause a bottleneck in writing requests, I think it is worth examining the option to first accumulate results up to some limit (on Redisearch side) and then calculate the accumulated vectors distances.
Describe the changes in the pull request
In ad-hoc BF mode of the tiered index, we call internally to
getDistanceFrom
of the flat and HNSW indexes. These calls access the indexes' data, and it is not safe to run insert/delete operations in parallel. Until now we were acquiring the locks internally, but since this is usually called for every vector individually, we see that the overhead of acquiring and releasing the locks is significant in that case.Hence we introduce the new API for acquiring and releasing the locks for shared ownership and assume that the caller acquires the locks while calling the tiered index
getDistanceFrom
.Mark if applicable