Skip to content

Redis kernel optimization warnings

When running Redis, several warning messages may appear during startup if the underlying Linux kernel parameters are not tuned for high-performance operations. These warnings relate to network connection queuing, memory overcommitment handling, and memory management paging.^[600-developer__big-data__redis__redis-01-install.md]

TCP backlog warning

Redis may issue a warning that the net.core.somaxconn kernel parameter is set too low (e.g., 128) to enforce the configured TCP backlog of 511^[600-developer__big-data__redis__redis-01-install.md#L52-L54]. The somaxconn parameter defines the maximum limit of the socket listening queue.^[600-developer__big-data__redis__redis-01-install.md#L55-L60]

If the server processes requests slowly, this backlog queue can fill up, causing the kernel to reject new connection requests^[600-developer__big-data__redis__redis-01-install.md#L55-L60]. To resolve this, administrators should edit /etc/sysctl.conf to increase the value (e.g., to 32768) and apply the changes using sysctl -p^[600-developer__big-data__redis__redis-01-install.md#L66-L69].

Memory overcommitment warning

A warning regarding overcommit_memory indicates that the system is set to mode 0^[600-developer__big-data__redis__redis-01-install.md#L71-L72]. Under this default mode, the kernel may reject memory requests based on heuristics, which poses a risk for background save operations during low memory conditions^[600-developer__big-data__redis__redis-01-install.md#L71-L72].

To fix this, the parameter vm.overcommit_memory must be set to 1 in /etc/sysctl.conf, which instructs the kernel to always allow memory allocation attempts^[600-developer__big-data__redis__redis-01-install.md#L71-L72]. The setting can be applied immediately by running sysctl vm.overcommit_memory=1 without requiring a reboot^[600-developer__big-data__redis__redis-01-install.md#L71-L72].

Transparent Huge Pages (THP) warning

Redis warns if Transparent Huge Pages (THP) are enabled in the kernel, as this feature utilizes memory management mechanisms that can create latency and increase memory usage specifically for Redis workloads^[600-developer__big-data__redis__redis-01-install.md#L74-L75].

To disable THP, the command echo never > /sys/kernel/mm/transparent_hugepage/enabled must be executed with root privileges^[600-developer__big-data__redis__redis-01-install.md#L74-L76]. To ensure the setting persists after a system reboot, this command should be added to the system's startup script, typically /etc/rc.local^[600-developer__big-data__redis__redis-01-install.md#L74-L76]. Note that the Redis service must be restarted after disabling THP^[600-developer__big-data__redis__redis-01-install.md#L74-L76].

Sources

^[600-developer__big-data__redis__redis-01-install.md]

  • [[Redis]]
  • [[sysctl]]
  • [[Linux Kernel]]
  • [[Backlog]]