What Should Be Noted When Using Redis for Pub/Sub?
The Redis official website describes Pub/Sub in detail. When using Redis for Pub/Sub, note the following:
- Your client must process messages in a timely manner.
Your client subscribes to a channel. If it does not receive messages in a timely manner, DCS instance messages may be overstocked. If the size of accumulated messages reaches the threshold (32 MB by default) or remains at a certain level (8 MB by default) for a certain period of time (1 minute by default), your client will be automatically disconnected to prevent server memory exhaustion.
- Your client must support connection re-establishment in case of disconnection.
In the event of a disconnection, you need to run the subscribe or psubscribe command on your client to subscribe to a channel again. Otherwise, your client cannot receive messages.
- Do not use pub/sub in scenarios with high message reliability requirements.
The Redis pub/sub is not a reliable messaging system. Messages that are not retrieved will be discarded when your client is disconnected or a master/standby switchover occurs.
Client and Network Connection FAQs
- Troubleshooting Redis Connection Failures
- Does DCS Support Cross-VPC Access?
- Why Is "(error) NOAUTH Authentication required" Displayed When I Access a DCS Redis Instance?
- What Should I Do If Access to DCS Fails After Server Disconnects?
- Why Do Requests Sometimes Time Out in Clients?
- What Should I Do If an Error Is Returned When I Use the Jedis Connection Pool?
- What If "ERR Unsupported CONFIG subcommand" is Displayed in SpringCloud?
- What Can I Do If I Fail to Access a DCS Instance Using Its Domain Name Address?
- What Should Be Noted When Using Redis for Pub/Sub?
- What Can I Do If Error "Cannot assign requested address" Is Returned When I Access Redis Using connect?
- Connection Pool Selection and Recommended Jedis Parameter Settings
- What Can I Do If a Lettuce 6.x Client Is Incompatible with My DCS Instance?
- Should I Use a Domain Name or an IP Address to Connect to a DCS Redis Instance?
- Is the Read-only Address of a Master/Standby Instance Connected to the Master or Standby Node?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
more