30 November, 2016

Optimization of Redis

In this Post, I am going to cover how to optimized REDIS  (recently i was reading this random blog giving more clear insight on what is redis and what the use of it in real world) instances as per our requirement. if you are not aware about REDIS at all, you can refer to my previous post where i have covered

  1. How To install REDIS on Centos/Redhat servers which goes here.
  2. How To Create Multiple instances of REDIS which goes here.
  3. What is the Best Standard method to configure REDIS which goes here.

So, Lets see how to optimize our redis server. few points you need to keep in mind that which are important while doing optimization and we are going to learn more about shortly.

For Freelance Work & Queries Contact me by Email Id support@linuxforeveryone.com

  1. Remove any errors you are seeing under redis logs
  2. Check the amount of cache size your site is using for each port
  3. Set proper eviction policy for redis keys
  4. Set proper kernel Settings to make redis run properly.

1) Disable HugePage for kernel

  • # echo never > /sys/kernel/mm/transparent_hugepage/enabled
  •  Add above line in /etc/rc.local file as well so that after server reboot it should be there,else your optimized value will be vanish.

2) Tcp-backlog

  • echo 511 > /proc/sys/net/core/somaxconn 
    •  add it to your /etc/rc.local as well


      •   For Full Page Cache set =  (as per the data you get by running below command + 500 MB)
      •   For session/cache = (as per the data you get by running below command + 200 MB)

      Command :   redis-cli -h [Redis Local IP] -p [redis_port] info | grep "used_memory.*human"

      4) Maxmemory-policy

        • maxmemory-policy allkeys-lru

          5) To avoid background save fail under low memory condition

          • Add 'vm.overcommit_memory = 1' to /etc/sysctl.conf (if not present)
          • Run command "sysctl vm.overcommit_memory=1" as root (if not present)