[gem] Redis-based distributed locks with "acquisition queue" capabilities
New gem (https://github.com/0exp/redis_queued_locks) [RedisQueuedLocks] that provides distributed redis-based locks with "lock acquisition" ordered queue capabilites and depends on pre-configured RedisClient istance (Reidis infrastracture layer you should provide by yourself)
The main feature:
Each lock request is put into the request queue (each lock is hosted by it’s own queue separately from other queues) and processed in order of their priority (FIFO). Each lock request lives some period of time (RTTL) (with re-queue capabilities) which guarantees the request queue will never be stacked.
This feature also allowed us to replace PostgreSQL's "advisory locks", cuz we uses them ultra very oftenly for some cases of logic: postgresql's advosiry locks works in "ordered queue" manner, and it is very necessary for us to save this behavior in Redis-Queued-Locks (in my company). The main logic is based on the Redis'es SortedSets under the hood and working with this functionality. It works very fast and stable.
It is still in development phase, but all major features are ready, we are using it in production already, and "1.0.0" release is coming really really soon :)
Battle-tested on the huge projects in the real production under high-load (thousand locks are acquired and released every second in our applications).
Post a comment