ZeroMQ &一致性哈希

发布于 2024-10-08 12:04:26 字数 198 浏览 15 评论 0原文


作为熟悉 0MQ 的练习,我尝试编写一个简单的代码 类似 Memcached 的分布式内存 键值存储。我能想到的最直接的架构是 OMQ设备分发请求 到后端,这是管理存储数据结构的简单进程 键值对。 问题是我想使用一致性哈希来平衡负载 后端之间但是 0MQ XREQ 套接字使用循环方式结束。那么,有没有一种简单的方法 使用一致性哈希 而不是使用 XREQ 套接字进行循环?

As an exercice to familiarize myself with 0MQ, I try to code a simple
Memcached-like distributed in-memory
key-value store. The most staightforward architecture I could figure is a
OMQ device distributing requests
to backends, which are simple processes managing a data structure that store
key-value pairs.
The problem is that I want to use consistent hashing to balance the load
between the backends but
0MQ XREQ sockets use round-robin to thid end. So, is there a simple way to
use consistent hashing
instead of round-robin with XREQ sockets ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

草莓酥 2024-10-15 12:04:26

您需要一个具有哈希值到 XREQ 套接字映射的应用程序,而不是使用 0MQ 设备来联合发出循环请求。当它收到请求时,它会计算输入的哈希值,在映射中查找它,并将请求转发到相关的 XREQ 套接字。

Instead of using a 0MQ device for federating out requests round-robin, you would need an application that has a mapping of hash values to XREQ sockets. When it receives a request, it would calculate a hash on the input, look it up in the mapping, and forward the request off to the relevant XREQ socket.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文