redis / jedis

Redis Java client
MIT License
11.71k stars 3.85k forks source link

Allow to set keepalive socket options for SentinelPool +switch-master subscriber connection #2614

Open kamran-redis opened 2 years ago

kamran-redis commented 2 years ago

Redis Sentinel subscribes to +switch-master channel to listen for changes. For pub/sub connections client libraries should give the ability to set socket keep alive settings to detect dead servers or broken connections see https://github.com/redis/redis/issues/7855 Linux socket setting that are required are

/proc/sys/net/ipv4/tcp_keepalive_time
/proc/sys/net/ipv4/tcp_keepalive_intvl
/proc/sys/net/ipv4/tcp_keepalive_probes

and are supported in modern versions of Java per socket ExtendedSocketOptions

Ask Allow the ability to set TCP_KEEPINTERVAL, TCP_KEEPIDLE, TCP_KEEPCOUNT.

Current workaround to set the values at OS level

yangbodong22011 commented 2 years ago

Lettuce already support ExtendedSocketOptions, https://github.com/lettuce-io/lettuce-core/commit/b08891dc5f7d4799b7ea837ca57447bf127989cc and I agree add this to Jedis, so self-assigned.

ps : this feature need jdk11

github-actions[bot] commented 6 months ago

This issue is marked stale. It will be closed in 30 days if it is not updated.