Distributed locking on AWS (ClockBound)
2025-02-02
Aws · Cgo · Clockbound · Distributed-Locking · Ffi · Go · Golang · Locking · Programming · Software · Spindle · Systems · Tech · Timesync · True-Time
2 minutes
After some testing time, I now have a working port of spindle in AWS. There were some slight changes from the original library to account for some of the differences between Cloud Spanner and PostgreSQL, but not really by much. It’s called spindle-cb, if you’re interested. It’s still half the battle though; I still have to port hedge as well before I could really use it for some of the planned projects in my pipeline.
As far as lock services are concerned, spindle-cb (and spindle for that matter) is what you call a coarse-grained lock (as opposed to fine-grained). Most of my use cases of distributed locks are really around application-level orchestrations across multiple nodes. That means using a single lock (or two) within the duration of the application, instead of multiple locks for multiple objects/data, although that’s not a limitation of the library by any means. With that said, I don’t usually use spindle[-cb] directly, but through a cluster-aware wrapper, like, say, hedge.
At this point, I couldn’t really vouch for spindle-cb’s reliability, at least not yet. But since it’s really just spindle with a different “true time” source, I have high hopes. And having used spindle in production for many years without any issues, I’m optimistic.
Related blogs:
- AWS ClockBound client for Go
- AWS ClockBound client for Go (update)
- This blog post
- Cluster membership management on AWS
- Static-linked CGO binaries using musl and Zig