Deploying Redis on Linux
Although you can install Redis on almost all modern operating systems (OS) by compiling its source code, Linux is the most common OS running Redis. Before you start the Redis instance, it is often necessary to set some Linux kernel and OS level parameters to proper values, in order to obtain the maximum performance in the production environment. In this recipe, we will introduce some vital kernel and OS parameters or settings for Redis.
Getting ready…
You need to finish the installation of the Redis Server, as we described in the Downloading and installing Redis recipe in Chapter 1, Getting Started with Redis.
How to do it...
The configurations for deploying Redis on Linux are as follows:
- Set the following memory-related kernel parameters:
~$ sudo sysctl -w vm.overcommit_memory=1
~$ sudo sysctl -w vm.swappiness=0
To persist these parameters add the following:
echo vm.overcommit_memory=1" >> /etc/sysctl.confecho "vm.swappiness=0" >> /etc/sysctl.conf
To check if...