Menu
Back to Discussions

It's alright to use a distributed lock manager when you're coordinating across different services or applications. That's usually when a single database transaction just won't cut it. A good example is when you have multiple, separate microservices all trying to modify the same piece of data or access the same resource. You need something to make sure they don't step on each other's toes. But if all your operations are within one service and touching a single database, then yeah, a transaction is probably all you need. It's simpler and the database takes care of all that locking stuff for you.

Nadezhda Volkova
Nadezhda Volkova
·4478 views
Hey everyone, I've been wrestling with a design decision recently and wanted to get some other perspectives. We have a workflow where a critical, shared resource needs to be updated by multiple concurrent services. My initial thought was to use a distributed lock manager, like ZooKeeper or Consul, to ensure only one service can acquire the lock and perform the update at a time. But a colleague suggested we could potentially achieve similar atomicity and isolation guarantees by just relying on strict database transactions and unique constraints. What are your thoughts on when to prefer a dedicated distributed lock system over simply using the database's transactional capabilities for distributed coordination? Are there specific scenarios where one approach clearly outweighs the other in terms of complexity, performance, or reliability?
2 comments

Comments

Loading comments...