← Knowledge Base
Hosting Guides
Kernel Hardening and sysctl.conf Tuning for High-Concurrency Web Workloads
Evidence-based Linux TCP backlog, SYN-cookie, file-descriptor and ephemeral-port tuning, with workload measurements instead of universal 50,000-request claims.
Reviewed 28 October 2026. A sysctl configuration is not a universal performance template. A server's RAM, kernel, application, load balancer, and workload determine appropriate values.1. Measure firstRecord kernel version (uname -r), actual listening queues (ss -lnt), socket statistics (ss -s), open files (cat /proc/sys/fs/file-nr), CPU, memory, and application-level latency. Establish a repeatable baseline with realistic traffic and compare P50/P95/P99 response times and errors after every adjustment.2. Distinguish TCP queuesnet.core.somaxconn controls the upper bound for the listen() backlog (Linux documentation lists a default of 4096 on modern kernels). net.ipv4.tcp_max_syn_backlog governs remembered incomplete TCP connection requests per listener. Increasing one is not a guarantee of higher throughput; the application, nginx/web server, socket accept rate and resource limits also matter. Diagnose queue overflow before increasing values.3. SYN cookiesThe kernel documents net.ipv4.tcp_syncookies=1 as a SYN-flood fallback, not a technique to accommodate legitimate overload. Ubuntu recommends leaving the conditional protection at 1 in normal circumstances. An observed SYN-cookie warning may indicate queue pressure requiring investigation. Do not set value 2 or disable syncookies as a generic optimization.4. Ephemeral portscat /proc/sys/net/ipv4/ip_local_port_range shows the local outgoing source-port range. Exhaustion usually affects outgoing connection patterns; expanding a range without investigating connection reuse, TIME_WAIT, NAT or upstream limits may not help. Avoid overlapping ranges reserved by services and coordinate with net.ipv4.ip_local_reserved_ports if appropriate.5. File descriptorsCheck per-process limits using cat /proc/PID/limits and systemd service LimitNOFILE settings; increasing fs.file-max alone does not increase every service's soft limit. Applications with too many concurrent connections can exhaust RAM and file descriptors even when the OS accepts higher limits.6. Change safelyUse an isolated file under /etc/sysctl.d/ after creating a backup, document the original values and rollback steps, then use sysctl --system in a maintenance window. Avoid copying numeric values blindly. If running inside a container, some network sysctls are controlled by the host.Verification: compare load-test metrics and service health before/after. No published evidence here supports a specific '50k+ requests per second' result for any Hostlah product.Primary sources:https://kernel.org/doc/html/latest/networking/ip-sysctl.htmlhttps://documentation.ubuntu.com/security/security-features/network/syn-cookies/