They were using the Redis Cluster with Sentinel for which they were facing issue regarding performance, whenever the connection request was high the Redis Cluster was not able to bear the load.
Since they were using a decent configuration of the server in terms of CPU and Memory but the result was the same. So now what????
The Answer was to tune the performance.
There are plenty of Redis performance articles out there, but I wanted to share my experience as a DevOps with Redis by creating an article which will include the most essential and important stuff that is needed for a Developer or a DevOps Engineer.
So let's get started.
# Update the value to 0 tcp-keepalive 0
You can also see in the graph as well.
Pipelining will increase the performance of redis drastically.
sudo vim /etc/rc.local # make sure this line is just before of exit 0. sysctl -w net.core.somaxconn=65365
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
RDB Persistence and Append Only File
sudo vim /etc/redis/redis.conf # Comment out these lines save 900 1 save 300 10 save 60 10000 rdbcompression no rdbchecksum no appendonly no
Transparent Huge Page(THP)
sudo vim /etc/rc.local # Add this line before exit 0 echo never > /sys/kernel/mm/transparent_hugepage/enabled
Some Other Basic Measures in Redis Configuration
70% of the system
maxmemory should be 70 percent of the system so that it will not take all the resource of the server.
It adds a random key with an expiry time
Loglevel should be "notice", so that log will not take too much resource
There should be a timeout value as well in redis configuration which prevents redis from spending too much time on the connection. It closes the connection of the client if it is ideal for more than 300 seconds.
There are multiple factors which are yet to be explored to enhance the performance of Redis if you find that before I do, please let me know to improve this blog.
In my next blog, I will discuss around how can we do Redis Performance Testing and how we are doing it in our Organisation.