Skip to content

Read/Write Separation for Sentinel in Jedis #4229

@a-TODO-rov

Description

@a-TODO-rov

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:

  1. Maintains connections to both the master and replicas.
  2. Automatically updates pools when Sentinel events occur (master switch, replica changes).
  3. Routes read operations to replicas, and write operations to the master.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions