-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Description
Summary
Enable native read/write separation for Redis Sentinel deployments in Jedis. This would allow applications to route writes to the Sentinel-elected master and reads to replicas, while transparently handling topology changes driven by Sentinel.
Motivation
Currently, Jedis in Sentinel mode only connects to the master. Applications that want to take advantage of replicas for read scaling must implement their own connection management and failover handling. This increases complexity and risk.
A built-in feature would:
- Simplify application code
- Reduce operational errors during failover
- Improve scalability by offloading reads to replicas
Proposal
Introduce Sentinel-aware connection handling that:
- Maintains connections to both the master and replicas.
- Automatically updates pools when Sentinel events occur (master switch, replica changes).
- Routes read operations to replicas, and write operations to the master.
- Falls back to master for reads when no replicas are available.
Benefits
- Transparent handling of failover and topology changes
- Improved scalability via replica reads
- Less boilerplate and custom failover logic in applications
Considerations
- Reads from replicas are eventually consistent
- Optionally allow fallback to master when replicas are unavailable
- Ensure predictable behavior during master failover events
Related Work
- PR Implemented read-write separation based on sentinel #4209 explored adding a replica pool for Sentinel.
- Community discussions have highlighted the need for native support to avoid duplicate custom implementations.
Metadata
Metadata
Assignees
Labels
No labels