Lox

A simple distributed lock manager

View the Docs View on GitHub

Lox helps you coordinate access to shared resources.

Lox is a dead-simple Node.js microservice to help you manage distributed locks. Using Lox, you can acquire and release shared locks across multiple clients subject to dynamically changing availability constraints.

What can I do with it?

At GameChanger, we use Lox to coordinate deploys across hundreds of instances. Lox allows us to deploy a constant percentage of a cluster at a given time, even if the size of that cluster changes in the middle of a deploy. Lox also expires stale locks, so we don't have to worry about deadlocks.

Is it complicated?

Lox exposes a pretty minimal set of HTTP API endpoints, documented here. So no, not really.


GET /health - return 200 if the service is running
GET /lock - inspect a shared lock
POST /lock - acquire a single shared lock
POST /locks - acquire multiple shared locks (all-or-nothing)
DELETE /lock/:lockId - release a single shared lock
          

Great, how can I get started?

Lox can be deployed either directly with Node.js or using a public Docker image. Once you've done that, you just need to point Lox to a Redis instance and you're good to go. Check out the repository for full deployment instructions.