edrichhans
edrichhans

Reputation: 111

What is the behavior of Redis slave when using it as a cache?

I am quite new to Redis, and I am trying to figure out the behavior of Redis slaves in caching. Two of my Redis slaves has a 0% hit rate, where one of them has 100+ keyspace_misses while the other has 900+ keyspace_misses. I have the master slave configured like this:

Master     Slave
1          5
2          6
3          7
4          8

The other slave has 0 keyspace_misses while the last slave has 0 keyspace_misses and 2 keyspace_hits. Is it normal for Redis slaves to do lookups? Or is it caused by by a problem in master? Are there logs to show this problem?

Upvotes: 0

Views: 629

Answers (1)

swayamraina
swayamraina

Reputation: 3158

So how this works is,

  1. set command is executed in master.
  2. this data is sent for replication to slave.
  3. when there is a get request, it lands on any of the node (master or slave) where it is searched and the value is returned if found.

What you say:

  • Two of my Redis slaves has a 0% hit rate - You might be missing slaveof ip_to_contact_master port_to_contact_master in your redis.conf file
  • one of them has 100+ keyspace_misses while the other has 900+ keyspace_misses - Keyspace misses are normal as the incoming key may not be in redis or may have been expired or may have not been replicated yet.

You can read about scaling reads in redis here

Upvotes: 2

Related Questions