java - Should I read from a Redis Cluster slave? -


we have cluster configuration redis used cache. due normal pattern of write master , read slave (with other databases), trying same thing redis cluster.
after investigation found none of redis clients (in java) redisson, jedis , spring data redis support this. seem have found workaround seems ugly , thinking if worth it?

here use case

  • approx highest qps: 1000
  • payload size: huge 1 mb max (after compression)
  • cluster size 3 master each 2 slaves(pretty high spec machines)
  • cringe part: actual network bandwidth cluster max 1gb (1 gb separately intra-cluster talk)

with in mind have following questions:

  • will (reading slave) me in way?
  • are there pit holes should avoid (any special server side config)?
  • is narrow path going problem?
  • is there standard way (library/client) doing correctly

any (blogs, case study, suggestions) appreciated.

what expectation slave reads?

it's possible , usual pattern read slaves comes set of effects.

  1. slave reads introduce stale data reads
  2. reading more 1 source allows controlling read source. useful when dealing availability issues (e.g. master down can go slave reads maintaining availability) or latency issues (e.g. using node lowest latency reads)
  3. you can use slave reads distribute server load. while possible, redis requires excessive load see effect

quoting http://redis.io/topics/cluster-spec#scaling-reads-using-slave-nodes:

normally slave nodes redirect clients authoritative master hash slot involved in given command, however, clients can use slaves in order scale reads using readonly command.

readonly tells redis cluster slave node client ok reading possibly stale data , not interested in running write queries.

jedis has no built-in support read other nodes master node. redisson , lettuce provide built-in support master , slave reads. redisson uses internally balancer (random, round-robin, weighted) distribute operations, lettuce provides preference-driven (master only, master preferred, slave, nearest) approach.

spring data redis built on top of jedis , lettuce not provide generic feature read slaves.

a rule of thumb using slaves availability, not performance.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -