This section gives an overview of Linux kernel, compiler, and OpenSSL settings that can impact Redis performance.
The request profile varies by use case, so there is no one-size-fits-all set of tuning parameters for Redis. Use the information below as a starting point, then measure the impact for your workload.
Memory-related kernel parameters can be changed temporarily with sysctl -w or made persistent by adding them to a file under /etc/sysctl.d/.
Use the following commands to apply the settings immediately:
sudo sysctl -w vm.overcommit_memory=1
sudo sysctl -w vm.swappiness=1
To make the settings persistent across reboots, create a Redis-specific sysctl file:
printf "vm.overcommit_memory = 1\nvm.swappiness = 1\n" | sudo tee /etc/sysctl.d/99-redis.conf
sudo sysctl --system
vm.overcommit_memory should be set to 1 so Redis background save and rewrite operations are less likely to fail during fork().
vm.swappiness controls how aggressively Linux swaps memory pages. A low value helps reduce Redis latency caused by paging under memory pressure.
Transparent Huge Pages (THP) can increase Redis latency and memory use, especially when Redis forks for RDB snapshots or AOF rewrite. Disable THP at the kernel level on systems used for Redis performance tuning.
Check the current THP setting:
cat /sys/kernel/mm/transparent_hugepage/enabled
Disable THP until the next reboot:
echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
Linux network stack settings can be changed temporarily with sysctl -w or made persistent by adding them to a file under /etc/sysctl.d/.
Documentation on each of the parameters discussed below can be found in the admin-guide and networking documentation within the Linux source.
Run the command below to list all kernel parameters.
sudo sysctl -a
Shown below are network stack settings used for Redis performance tuning.
sudo sysctl -w net.core.somaxconn=65535
sudo sysctl -w net.ipv4.tcp_max_syn_backlog=65535
These settings raise connection queue limits so the kernel is less likely to be the bottleneck during high connection churn.
net.core.somaxconn:tcp-backlog setting.net.ipv4.tcp_max_syn_backlog:If you build Redis from source, use a recent GCC version from your Linux distribution. Compiler flags such as -mcpu and -flto can change performance, but they should be tested against your workload before use. Usage of these flags is explained in the
Migrating C/C++ applications
section of the
Migrating applications to Arm servers
learning path.
For Redis build instructions, review the build Redis from source documentation.
Redis uses OpenSSL for TLS. TLS adds encryption and integrity-check overhead, so it can reduce the maximum throughput of a Redis instance. Typically, the Linux distribution default OpenSSL version is sufficient.
To build Redis with TLS support, install the OpenSSL development libraries for your distribution and build Redis with:
make BUILD_TLS=yes
Only test a newer OpenSSL version if TLS is part of the workload. If clients connect without TLS, OpenSSL does not affect Redis command throughput.