1. 3
    1. 3

      I did some benchmarking of various Redis locking gems years ago.


      You can improve your gem in two ways:

      1. Allow N lockers, not just 1.
      2. Don’t (sleep and poll) but rather block, up to the acquire_timeout.

      Note: I wrote and sell my own commercial version as part of Sidekiq Enterprise.

      1. 1

        Ah! interesting. Thanks for the feedback. Will look at incorporating.

    2. 1

      Anecdotes about stolen backpacks in high school are cute, but how is this different from the many other redis-backed locks on rubygems.org, or at least the most popular, redlock?

      1. 2

        Redlock is distributed. You use multiple Redi’ to decide who gets the lock, similar to Paxos or Raft. Most people don’t need this complexity.

        Simple mutexes like this one use a single Redis and aren’t fault tolerant if Redis dies.

        1. 1

          Thanks Mike, that’s exactly what the decision was here. I needed a simple mutex to reach for, didn’t want to manage multiple Redi for this. Wasn’t something I was worried about it the single Redis went down, etc. So made something I thought was easy to grok and maintain.

    3. 1

      I wrote one of these many years ago to help with distributed synchronization. uncomplicated_mutex