Search code examples
redisload-balancingautoscalingtwemproxy

Can I use twemproxy for load balancing by redis queue size?


Can I use twemproxy as a load balancer for a pool of redis instances, according to size of redis queue (amount of keys per instance)? Is twemproxy able to turn off from the upstream one of the redis instances, if it reaches a preconfigured maximum amount of keys in it's database?

If so, how can I do that (I'm very new to redis and stuff, so I just possibly don't get this from documentation)?

Thanks in advance.


Solution

  • No, it is not possible to loadbalance on the exact number of keys or queue size per instance. The sharding is based on calculations based on the key name. (see hash, hash_tag and distribution settings) Usually you should get a pretty even distribution but with some bad luck some shards might get much more keys than others.