当前位置:网站首页>Redis publishing and subscription
Redis publishing and subscription
2022-07-07 18:48:00 【Gravel under Mount Everest】
What is publish and subscribe
Generally speaking , Publish and subscribe ( also called pub/sub) Is characterized by subscribers (listener) Subscribe to the channel (channel), Publisher (publisher) Responsible for sending binary string messages to channels (binary string message). Whenever a message is sent to a given channel , All subscribers to the channel will receive messages . We can also think of channels as radio stations , Subscribers can listen to multiple stations at the same time , The sender can send messages on any radio station .
Common publish and subscribe commands
command | meaning |
---|---|
subscribe | subscribe channel [channel …]---- Subscribe to a given channel or channels |
unsubscribe | unsubscribe channel [channel…]---- Unsubscribe from a given channel or channels , If no channel is given at the time of execution , Then unsubscribe all channels |
publish | pushlish channel [channel …]— Send a message to a given channel |
psubscribe | psubscribe pattern [pattern…]— Subscribe to all channels that match the given pattern |
punsubscribe | punsubscribe pattern [pattern …]— Unsubscribe from the given mode , If no mode is given at the time of execution , Then unsubscribe from all modes |
Rarely used Redis The reason for publishing and subscribing to
- Reason one and redis The stability of the system . For the old version Redis Come on , If a client subscribes to one or more channels , But it doesn't read messages fast enough , Then the continuous backlog of information will make Redis The volume of the output buffer becomes larger and larger , This may lead to Redis It's slowing down , Even the immediate collapse . It can also lead to Redis Killed by the operating system , Even the operating system itself is not available . new edition Redis There won't be such a problem , Because it will automatically disconnect the nonconformity client-output-buffer-limitpubsub Subscription clients required by configuration options .
- The second reason is related to the reliability of data transmission . Any network system may encounter disconnection during operation , The continuous error caused by disconnection usually causes one end of the two ends of the network connection to reconnect . however , If the client is disconnected during the subscription operation , Then the client will lose all messages sent during the disconnection .
边栏推荐
- 性能测试过程和计划
- Unlike the relatively short-lived industrial chain of consumer Internet, the industrial chain of industrial Internet is quite long
- idea彻底卸载安装及配置笔记
- Wireshark analyzes packet capture data * cap
- Nunjuks template engine
- Yunjing network technology interview question [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
- Some key points in the analysis of spot Silver
- socket编程之常用api介绍与socket、select、poll、epoll高并发服务器模型代码实现
- Tips of this week 141: pay attention to implicit conversion to bool
- Backup Alibaba cloud instance OSS browser
猜你喜欢
Datasimba launched wechat applet, and datanuza accepted the test of the whole scene| StartDT Hackathon
Comparison and selection of kubernetes Devops CD Tools
Hash, bitmap and bloom filter for mass data De duplication
The report of the state of world food security and nutrition was released: the number of hungry people in the world increased to 828million in 2021
AntiSamy:防 XSS 攻击的一种解决方案使用教程
五种网络IO模型
【软件测试】从企业版BOSS直聘,看求职简历,你没被面上是有原因的
讨论| 坦白局,工业 AR 应用为什么难落地?
RIP和OSPF的区别和配置命令
Wireshark analyzes packet capture data * cap
随机推荐
debian10编译安装mysql
String type, constant type and container type of go language
[paper sharing] where's crypto?
Idea completely uninstalls installation and configuration notes
【剑指 Offer】59 - I. 滑动窗口的最大值
Static routing configuration
Chapter 3 business function development (safe exit)
Comparison and selection of kubernetes Devops CD Tools
回归问题的评价指标和重要知识点总结
[principles and technologies of network attack and Defense] Chapter 3: network reconnaissance technology
Five simple ways to troubleshoot with Stace
[principle and technology of network attack and Defense] Chapter 1: Introduction
Hutool - 轻量级 DB 操作解决方案
A few simple steps to teach you how to see the K-line diagram
Yearning-SQL审核平台
Thread pool and singleton mode and file operation
GSAP animation library
Summary of debian10 system problems
[paddleseg source code reading] add boundary IOU calculation in paddleseg validation (1) -- val.py file details tips
SQLite SQL exception near "with": syntax error