Redis 发布订阅:Redis 是否保证即使在巨大压力下也能传递消息? [英] Redis publish-subscribe: Is Redis guaranteed to deliver the message even under massive stress?

查看:58
本文介绍了Redis 发布订阅:Redis 是否保证即使在巨大压力下也能传递消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设订阅的客户端和发布消息的服务器都保持连接,Redis 是否能保证最终始终将发布的消息传递给订阅的客户端,即使在客户端和/或服务器压力很大的情况下?或者我应该计划一下 Redis 可能会在事情变得热"时偶尔丢弃消息的可能性吗?

Provided that both the client subscribed and the server publishing the message retain the connection, is Redis guaranteed to always deliver the published message to the subscribed client eventually, even under situations where the client and/or server are massively stressed? Or should I plan for the possibility that Redis might ocasionally drop messages as things get "hot"?

推荐答案

Redis 绝对不为发布和订阅流量提供任何保证交付.这种机制仅基于套接字和事件循环,不涉及队列(即使在内存中).如果发布发生时订阅者未在侦听,则此订阅者的事件将丢失.

Redis does absolutely not provide any guaranteed delivery for the publish-and-subscribe traffic. This mechanism is only based on sockets and event loops, there is no queue involved (even in memory). If a subscriber is not listening while a publication occurs, the event will be lost for this subscriber.

可以在 Redis 之上实现一些有保证的交付机制,但不能使用发布和订阅 API.Redis 中的列表数据类型可以用作队列,并作为更高级队列系统的基础,但它不提供多播功能(因此没有发布和订阅).

It is possible to implement some guaranteed delivery mechanisms on top of Redis, but not with the publish-and-subscribe API. The list data type in Redis can be used as a queue, and as the the foundation of more advanced queuing systems, but it does not provide multicast capabilities (so no publish-and-subscribe).

AFAIK,没有明显的方法可以轻松地使用 Redis 同时实现发布和订阅和保证交付.

AFAIK, there is no obvious way to easily implement publish-and-subscribe and guaranteed delivery at the same time with Redis.

这篇关于Redis 发布订阅:Redis 是否保证即使在巨大压力下也能传递消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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