Arctic: A Practical Lock-Free Adaptive Radix Tree

(usenix.org)

101 points | by grep_it 3 days ago

8 comments

  • nwtnni 1 day ago
    Hi, first author here!

    I've actually been working on a more approachable blog post introducing the data structure; wasn't expecting to see the paper here first! The repository is [here](https://github.com/nwtnni/arctic) and our latest benchmark results are [here](https://nwtnni.github.io/index-bench/) (forgive the janky UI). I'm happy to answer any questions--have been quite excited about this work since I believe it's the first time we have a lock-free tree that outperforms lock-based alternatives.

    • grep_it 23 hours ago
      I came across the paper on google scholar while looking into radix trees. Funny enough there was a recent post from valkey on dropping the skiplist in favour of a btree for their sorted set[0].

      Looking forward to the blog post!

      0: https://news.ycombinator.com/item?id=50534387

    • benjaminogles 1 day ago
      Any stories yet of your property based tests and/or shuttle based tests exposing surprising bugs that required a particular thread schedule and particular sequence of operations?

      I've always been curious whether there was a way to specify the behavior of a concurrent data structure in something like an LTL to prove it correct without having to implement a reference implementation or write an invariant checker. Although I guess the spec itself plays the role of a reference implementation if it is that sophisticated.

      • nwtnni 1 day ago
        The most subtle bug I've been able to reproduce with shuttle-based testing is [this race in Node47](https://github.com/nwtnni/arctic/blob/efad26c696f28cfdbeec11...), with [this test](https://github.com/nwtnni/arctic/blob/efad26c696f28cfdbeec11...). I did run into some issues trying to compose proptest with shuttle, i.e., writing a test that exercises both random inputs and random interleavings on that input.

        For non-concurrent code, the [state machine tests](https://github.com/nwtnni/arctic/blob/efad26c696f28cfdbeec11...) comparing arctic against std::collections::BTreeMap was invaluable for finding edge cases.

        > I've always been curious whether there was a way to specify the behavior of a concurrent data structure in something like an LTL to prove it correct without having to implement a reference implementation or write an invariant checker.

        I've toyed with [Alloy](https://alloytools.org/) to verify a small piece of lock-free code in the past, but am no expert. I think verification of lock-free data structures (esp. under weak memory models) is an area of active research.

    • benjaminogles 1 day ago
      I'm also curious why linearizability might be desirable over a weaker guarantee (IIUC) like sequential consistency? Apologies if this question doesn't make sense. Based on my googling, linearizability is a stricter requirement than just staying consistent with some global ordering of the interleaved operations.
      • nwtnni 1 day ago
        By my understanding, linearizability is a property of a single object accessed concurrently, like a data structure, whereas sequential consistency is a property of multiple objects accessed concurrently, like transactions over multiple database rows.

        EDIT: actually I suppose that's not quite right, since you could view arctic as multiple key-value pair objects. Then I think linearizability is usually used because it's a composable property, whereas sequential consistency is not (https://concurrencyfreaks.blogspot.com/2015/11/the-importanc...)

  • p11p 1 day ago
    The authors should have compared against the practical lock-free ART-tree implementation in flock, which IIUC is extremely fast: https://github.com/cmuparlay/flock
    • nwtnni 1 day ago
      Oops, thanks for the pointer. I searched for standalone concurrent data structure papers and missed this one.

      That said, it seems like their lock-free variant only beats the original lock-based ART under high skew? Whereas arctic out-performs ART for both uniform and skewed key distributions.

      • p11p 22 hours ago
        I think their follow-up in VerLib handles uniform well as well. I'm not an expert here---just saw this talk once and remembered. Please do take a look---might be relevant for any follow-up work you're doing: https://dl.acm.org/doi/pdf/10.1145/3627535.3638501
  • vvern 23 hours ago
    I like the use of 16-byte atomics. We’ve reached the point that for servers and general-purpose computers we should assume they exist.
  • BiraIgnacio 19 hours ago
    this is super cool, thanks for sharing.

    Something very hard to do correctly and that still performs better than a lock-full version of it (in my very own experience, that is)

  • colesantiago 1 day ago
    Great work, always looking for new and neat algorithms and data structures.

    This video is very helpful.

    https://www.youtube.com/watch?v=n8lhCeefQzg

  • 1106234989 1 day ago
    [flagged]