Home > Back-end >  Redis runs after period of time, can't subscribe to the news
Redis runs after period of time, can't subscribe to the news

Time:10-04

The realization of the function of the scene: use redis pubsub subscribe to multiple netty server messages sent (there are two kinds of circumstance websocket - & gt; Redis - & gt; Netty and netty - & gt; Redis - & gt; Websocket) and then by websocket update relevant data on a page,

Problem: the beginning of project operation is no problem, but after a period of time, netty end can't subscribe to news from the websocket,

Online:
(1) the config set client - the output buffer - limit pubsub 0 0 0, this setting will not limit the size of the cache news, but I don't think this is reasonable, the official don't recommend this solution, https://blog.csdn.net/luyaoying001/article/details/80264347

(2)
https://tcspecial.iteye.com/blog/2316033My phenomenon and this article is very similar, but he finally give the solution, I don't know what is the principle?



The friend encountered similar problems, help to provide the train of thought, thank you very much


CodePudding user response:

I also met, can't, only through the timer calls every 30 seconds. Redis convertAndSend method can ensure continuous line, feels more sb

CodePudding user response:

TCP keepalive - the impact of this configuration, the configuration of the default is 0 official suggested value of 60 units are seconds,
This configuration is used to check the health of the connection time, can be understood as a heartbeat
If set to 0 will not check the heart information, can cause the connection has been disconnected actually, but the client don't know, also won't throw exceptions, where also silly blpop,

The TCP keepalive - 60 can solve this problem
  • Related