redis-rb / redis-client

Simple low level client for Redis 6+
MIT License
124 stars 60 forks source link

Enable TCP keepalive on redis sockets. #94

Closed casperisfine closed 1 year ago

casperisfine commented 1 year ago

Fix: https://github.com/redis/redis-rb/issues/1180

It sends a keep alive probe every 15 seconds for 2 minutes.

We could probably make it configurable, but that's some very advanced tuning, so I don't know if it's worth it.

If there's a need for it, let me know by commenting on this PR.

rishijain commented 1 year ago

Does this mean, if the user sits idle for more than 2 minutes the connection is dropped? It seems the case in my testing though. Thanks for working on it. :)

byroot commented 1 year ago

if the user sits idle for more than 2 minutes the connection is dropped?

Not quite, it ensures that the connection won't be dropped for 2 minutes, whether and when it is dropped after than depends on the system configuration, the redis server configuration, and the various network equipment configurations in the middle.

That default seem reasonable to me. As mentioned we can make it configurable, but that's very advance configuration, so not sure many people need that.