用于处理竞争条件的一致散列与分布式锁
在工作负载分布到多个节点的分布式系统中,处理多个请求同时对同一数据进行操作的竞争条件的两种方法是使用一致性哈希和分布式锁。一致的散列将确保对一组数据进行操作的所有请求都发送到同一工作人员,而分布式锁将确保一次只有一个工作人员可以对任何一组数据进行操作。
我的问题是这两种方法的优缺点是什么,哪种方法可能更有利?
In a distributed system where workload is distributed to multiple nodes, two of the ways of dealing with race conditions where multiple requests to operate on the same data concurrently are the use of consistent hashing and distributed locks. Consistent hashing would ensure that all requests to operate on one set of data are sent to the same worker and distributed locks would ensure that only one worker could operate on any set of data at a time.
My question is what are the pros and cons of either approach and which might be favorable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一致性哈希比分布式锁更容易实现。问题是输入的特定分布只能发送到节点的子集,导致某些单词比其他单词更有效。分布式锁较难实现,需要多个通信消息(或一些共享数据),但不会导致节点分配的偏差。
The consistent hashing is much easier to implement than a distributed lock. The problem is specific distribution of inputs could be sent only to a subset of the nodes, resulting in some words working harder than others. Distributed lock is harder to implement and requires several communication messages (or some shared data) but won't result in a bias of node allocations.