zmq 与 redis 的 pub-sub 模式 [英] zmq vs redis for pub-sub pattern

查看:63
本文介绍了zmq 与 redis 的 pub-sub 模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

redis 支持 发布订阅
zmq 还支持 通过消息代理发布订阅

在它们之间进行选择的架构优点\缺点是什么?
我的目标是超出明显的用例特定性能基准测试应该完成的点(这里是 一个很好的例子).

What would be the architectural pros\cons for choosing between them?
I'm aiming at points which are beyond the obvious use-case specific performance benchmarking that should be done (here's a nice example).

假设使用 Python 等高级语言.

Assume use of a high-level language such as Python.

推荐答案

我使用 Python 处理过 ZeroMQ 和 Redis.我会说 ZeroMQ 更健壮,它提供了真正简单的负载平衡,而且不仅仅是发布-订阅,比如请求回复等等.但是如果你只是在 pub-sub 之后,redis 就简单多了.

I have worked with both ZeroMQ and Redis with python. I would say ZeroMQ is more robust, it offers real simple load balancing and also more than pub-sub, like request reply among others. But if you are only after pub-sub, redis is much simpler.

如果redis服务器崩溃或停止工作,所有客户端也将停止工作,使用ZeroMQ,即使没有服务器,客户端也能工作.

In case the redis server crashes or stops working, all the clients will stop working as well, with ZeroMQ, the clients work even if there is no server.

这两种服务都适用于任何编程语言,ruby、python、C、C++ 等.

Both services are available with any programming language, ruby, python, C, C++ and more.

总之,redis简单多了,非常可靠.ZeroMQ 非常可靠,但更复杂.

In short, redis is much simpler, very reliable. ZeroMQ is extremely reliable but more complex.

如果我只做pub sub,我会选择redis,否则我会选择ZeroMQ.如果我能预见到大量的流量,我会选择 ZeroMQ

If I was only doing pub sub, I would pick redis, else I would pick ZeroMQ. If I would forsee huge loads of traffic, I would pick ZeroMQ

这篇关于zmq 与 redis 的 pub-sub 模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆