Skip to content

Concurrent graph modifications#321

Draft
razdoburdin wants to merge 10 commits intointel:mainfrom
razdoburdin:seqlock
Draft

Concurrent graph modifications#321
razdoburdin wants to merge 10 commits intointel:mainfrom
razdoburdin:seqlock

Conversation

@razdoburdin
Copy link
Copy Markdown
Contributor

This PR introduces concurrent graph modifications with seqlock pattern.

@razdoburdin razdoburdin marked this pull request as draft April 27, 2026 15:58
Copy link
Copy Markdown
Member

@rfsaliev rfsaliev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it would be better to keep both synchronized and non-synchronized graphs.
For example, synchronization is not needed for static Vamana index, but gives overhead.

using index_type = Idx;
using value_type = std::span<Idx>;
using const_value_type = std::span<const Idx>;
using const_value_type = AtomicSpan<const Idx>;
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.

For better flexibility and allow user to select syncronized/non-syncronized index kind, I would define a dedicated SyncronizedGraphBase class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this duplication is really required. Performance penalty for synchronized vs non-synchronized search is only few precents.

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.

Hi @razdoburdin, is duplication too bad in this case? Otherwise, @rfsaliev may have a point on flexibility and it's always better if performance is not affected. But agree with you that pros and cons should be discussed if duplication is a large overhead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to investigate the trade-offs, after the finalization of design of concurrent path. Let's make sure it works well first.

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.

To get valuable results, I would recommend to benchmark 'static' VamanaIndex with and without synchronized graph on different platforms - especially on multi-socket systems.

if (is_deleted(dst)) {
const auto& others = graph_.get_node(dst);
all_candidates.insert(others.begin(), others.end());
// SeqLock retry: a concurrent consolidate may be writing dst's
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.

GraphConsolidator class is parametrized by a graph type, so we can keep both syncronized/non-synchronized behavior by detecting graph type.

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.

3 participants