DEV Community

Recca Tsai
Recca Tsai

Posted on • Originally published at recca0120.github.io

Fix Redis TCP Backlog 511 Warning: Raise somaxconn

Originally published at recca0120.github.io

Problem

When starting Redis, this warning appears:

The TCP backlog setting of 511 cannot be enforced because
/proc/sys/net/core/somaxconn is set to the lower value of 128
Enter fullscreen mode Exit fullscreen mode

Redis defaults to a TCP backlog of 511, but the Linux kernel's somaxconn is only 128, so Redis can't use the queue length it wants. Under heavy connection load, this can cause dropped connections.

TCP backlog limited by somaxconn

Solution

Increase somaxconn with root privileges:

echo 512 > /proc/sys/net/core/somaxconn
Enter fullscreen mode Exit fullscreen mode

This won't persist after a reboot. To make it permanent, add the setting to /etc/sysctl.conf:

net.core.somaxconn=512
Enter fullscreen mode Exit fullscreen mode

Then reboot or run sysctl -p to apply.

Top comments (0)