开发者

ZeroMQ & Consistent Hashing

开发者 https://www.devze.com 2023-02-01 06:31 出处:网络
As an exerc开发者_开发问答ice to familiarize myself with 0MQ, I try to code a simple Memcached-like distributed in-memory

As an exerc开发者_开发问答ice 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 ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消