Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-11836

Use futexes when waiting for a resource

    • Storage Engines
    • 8
    • 2023-12-12 - Heisenbug, 2024-01-09 - I Grew Tired
    • v8.0

      WiredTiger uses __wt_spin_backoff() to dynamically backoff when waiting for a resource. It spins for a few cycles, then yields, then falls back to sleeping.

      The goal is to respond quickly if the resource becomes available soon, but not use too many resources if it takes a while for the resource to become available.

      The downside is that repeatedly calling yield still takes time, and sleeping can run longer than it takes for the resource to become available – sleep doesn't end when the resource is available.

      Linux futexes provide a user-level mechanism for one thread to wait for an event triggered by a different thread and should avoid the overheads of our current spin-and-backoff approach.

      We should evaluate the feasibility of using futexes in WiredTiger – both in terms of code simplification and readability and performance.

      A downside is that futexes are only available on Linux. This is probably our primary platform, but not the only one we run on.

        1. Keith YCSB avg update latency.png
          Keith YCSB avg update latency.png
          174 kB
        2. Screenshot 2024-02-23 at 8.32.11 PM.png
          Screenshot 2024-02-23 at 8.32.11 PM.png
          383 kB
        3. Screenshot 2024-02-23 at 8.59.54 PM.png
          Screenshot 2024-02-23 at 8.59.54 PM.png
          180 kB
        4. Screenshot 2024-02-24 at 9.16.07 AM.png
          Screenshot 2024-02-24 at 9.16.07 AM.png
          820 kB

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            keith.smith@mongodb.com Keith Smith
            Votes:
            0 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated: