KeyDB loadbalancing and HAProxy


We are currently running 4 KeyDB servers, each as a standalone server. They are used for website cache and some basket information for our webshop. They all run as in memory only, so no writing to disk, as the data does not exist for long anyway.

I would like to load balance them with a HAProxy, we allready use HAProxy for website loadbalancing, but I´m a bit confused as to how to go about it.
Currently we just configure our sites to use a specific KeyDB server, but that gives a problem when a site get too much traffic, and overloads the KeyDB CPU usage (4 cores in a VM). KeyDB uses 4 threads.

Would it be possible to just continue to run them as standalone and then just do roundrobin loadbalancing in the HAProxy? Would I loose any data?

Or should I use the built-in master-slave in KeyDB?
Looking for a simple setup, if possible.

Hi @Kaare_Petersen,

If you are load balancing, you need a way to ensure you are reading the correct data off the correct server. We have an HAPrroxy example here:, however more for use with high availability setups. If you have a number of active replica nodes you could load balance across the same dataset to assist with read workloads but will eventually get limited by write workload.

Other option is consolidate all your nodes to a sharded dataset, but may be more work than youre looking for right now and pending your client supports it.

Thanks for the feedback @benschermel

I will see if active replica might do it for us. I guess this depends on if we are hit by high read or high write load.

I´m not familiar with shards, and I don´t know if the client supports it. Our websites are made in .NET, so guess it´s a .Net client.