Skip to content
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

Concurrency and Locking in hnswlib for Online Indexing #590

Open
qscqesze opened this issue Sep 12, 2024 · 2 comments
Open

Concurrency and Locking in hnswlib for Online Indexing #590

qscqesze opened this issue Sep 12, 2024 · 2 comments

Comments

@qscqesze
Copy link

Description

I am using hnswlib for online indexing, where I continuously add vectors to my vector index library from a message queue using multithreading. Additionally, I perform multithreaded queries and execute a save operation after writing a certain number of items.

Question

As a user of hnswlib, do I need to implement locking to handle these operations effectively?

Operations:

  • Adding vectors from a message queue (multithreaded)
  • Performing queries (multithreaded)
  • Periodic save operations after writing a certain number of items

Additional Information

Any recommendations on how to manage concurrency and ensure data integrity would be greatly appreciated.

@slhuang
Copy link

slhuang commented Sep 19, 2024

I was also looking into the concurrent read/write in HNSWLib. From my understanding, locking is performed during write (addPoint/deletePoint), but not read (searchKnn). Can someone confirm whether this is true? And is non-locking read done purposely for performance consideration? @yurymalkov Thanks.

@yurymalkov
Copy link
Member

Sorry for a late reply. Yes, it is purely performance-based. That is something we wanted to fix for a while (making a separate method which is thread-safe), but didn't prioritize.

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

No branches or pull requests

3 participants