-
Notifications
You must be signed in to change notification settings - Fork 2
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
Possible concurrent version #43
Comments
I think a good spot to start for a concurrent implementation of ART would be The ART of practical synchronization by the same authors of the original ART paper. I think you could also approach the problem with some other strategies as well, like fine grained r/w locks per node. |
#27 (comment) is also a previous comment talking about this subject. Cc @Gab-Menezes |
IMO the concurrent version is kinda hard to implement, or at least I wasn't able to fully understand the paper/other implementations. |
Or maybe do something similar to MVCC, but I don't know about the subject |
This stuff is a little out of my league I assume 😅 |
Probably change blart to be concurrent. Congee requires fixed len keys because it does a lot of optimization with it. |
As I said in the comment probably what makes it hard to implement are operations that hold a reference for an extended period of time, like iterator/entry api. Specially the iterators, since IMO iterators should work in sane way where the contents of the tree don't change while iterating over it. That's why congee doesn't have iterators. |
If you find it difficult, I think I better look elsewhere haha. Really wanted to use a lock free concurrent art tree for a multi column routing table, I think it would have been the best choice, as far as data structures go. If you don't mind, could u give your opinion on using a lock free concurrent b+ tree (concurrent_map (sled's internal index)) or a lock free concurrent skiplist (crossbeam skipmap) vs blart as is. Not sure if I should leave the issue open, feel free to close it if this is outside the scope currently. Thanks. |
I'm sorry, I haven't used or researched those much, so I can't really give an opinion.
Feel free to leave this open, I think its useful to track as a feature request. |
What a feature it will be...one day 🍻 |
@MirroredLens I have a few thoughts even though I haven't used
|
But I did do some research on methods of scaling with shards - partitioning by key hashing, key range or custom. And I'm not sure how to best approach it for blart. Overall though, I think key range partitioning might be a good technique and relatively easy to implement a sharding strategy with, compared to key hashing or optimistic lock coupling. |
I think you're right, key partitioning would be a natural way to shard the TreeMap based on key. Without prior knowledge of the key distribution/access distribution, I also think it would be difficult to assign key ranges to shard at construction. Maybe you could devise some way to periodically re-balance key ranges across shards? If you had some simple statistics per-key (or more aggregated), maybe you could periodically lock some adjacent shards and do the re-balance with a dedicated thread? You could re-balance only based on shard size or you could attempt to re-balance based on heat (number of read/write accesses). Not really sure, this is more just brainstorming. I definitely want to echo @Gab-Menezes's point that some good profiling/benchmarking would be very important to trial different ideas.
With the sharding model, I think the iterators would be pretty natural. Just lock each shard in key-range order and iterate over the contents. The trouble comes when the (hypothetical) application expects that the iterator represents a snapshot view of the data-structure, which I think is pretty difficult to accomplish (probably why congee leaves it out). As long as the application is able to comprise on that point, I think iterators will still be viable. |
So,
Given these requirements and limitations, maybe a kind of "adaptive key range sharder" would work where keys and key ranges are re-balanced dynamically based on several heuristics,
I hope I'm right at least theoretically, but even if this is right and also a very scalable architecture, the complexity seems pretty high to get it all working correctly 🤯 |
Let me know what you guys think of this strategy. And if you guys feel it's worth a try. |
I'm sorry but I can't really evaluate the strategy without knowing more about your constraints and goals, and I think that is starting to get a bit off-topic for this thread. I think your project does sound cool! And if it ends up using a sharded-map with blart underneath then that would be great. However, I'd like to keep this thread focused on a "possible concurrent version" of blart, and any data points/suggestions/interest relating to that topic. |
You're right that I'm focusing on my use case more than a general version (I have a known ordering of keys) 😅 |
Hey I didn't see a discussion section, so opened an issue.
Just wondering if a concurrent version of the art tree could be implemented with this library, and if a guide/hint/ref as to how to do so could be given by anyone if possible.
The text was updated successfully, but these errors were encountered: