Asynchronous tasks. Which architecture? (Or pattern in zeroMQ)

本秂侑毒 提交于 2019-12-05 18:42:35

Have a look at the several patterns described in the ZMQ Guide and see if one of them fits better than simple REQ/REP.

In general your server on the linux box seems to need implementation of ROUTER/DEALER pattern that will forward incoming tasks to a set of workers.

ZMQ has it's own topology compared to traditional socket based client/server solutions. Other solutions might be to implement a socket based server that uses a thread pool to forward the incoming tasks.

UPDATE: Since you've been precising on your requirements I think the majordomo pattern might be a good and reliable starting point for your purposes. There might be better fitting patterns as @gvd mentions in his comments.

As DevNoob says, the asynchronous client server pattern sounds like the one you need.

"LRU" means least-recently used, but I've removed that term from the latest text of the Guide, and am using "load-balancing" instead. Since the goal is to load-balance across a set of workers...

I know you mentioned ZMQ as your lib of choice, but may I humbly suggest Akka (www.akka.io)? Akka has a ZQM extension which we've had good experiences with, so you can readily translate between its transport mechanism (netty-based) and ZMQ. It implements the Actor Model and, more importantly, provides an 'ask' and a 'tell' for async processing across worker actors. Akka also seems to compete quite favorably with the likes of ZMQ in terms of speed of messaging and is documented far better in my experience.

One thing Akka does not have is cross-language support, but we're using the ZMQ extension to achieve this now. The combination of ZMQ and Akka has proven to be a very powerful and flexible platform indeed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!