[MDEV-22171] Range Locking: explore other data structures Created: 2020-04-06 Updated: 2020-04-07 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
MDEV-21574 didn't succeed in improving performance of range locking. This task is to look at other data structures with similar properties to lock tree. I was able to find B-Trees and Skip Lists. Bronson's treeIt doesn't have an established name so I'm calling it "Bronson tree". A widely-cited paper: https://stanford-ppl.github.io/website/papers/ppopp207-bronson.pdf It is
(There is a re-implementation in C https://github.com/LPD-EPFL/ASCYLIB/tree/master/src/bst-bronson . It seems to be of prototype-level quality) Other treesThere are papers mentioning other kinds of concurrent trees.
But it seems none of them have ended up in a production-ready library. Also, the language they use is typically Java Skip List(RocksDB's SkipList doesn't have a remove operation and so cannot be used) The most referenced-to seems to be and folly/ConcurrentSkipList implements it: It does support node removal:
But the "Caveat" is there. A test program with N threads that keep adding/removing elements will have its memory usage grow, with no apparent limits. if I make all threads to pause for a bit, this seems to give it a chance to reclaim memory. Mem usage stops growing for a while (while freed memory is reused) then starts growing again. Another issue: folly/ConcurrentSkipList requires strict ordering of elements that are stored. One needs to define std::less<Element>. Ranges can overlap. I'm not sure if it is valid to assume overlapping ranges equal. |