DevTools Logo

Linux Sysctl Tuner

Linux Sysctl Tuner

Calculate starting-point kernel and network buffer settings for /etc/sysctl.d, with typical defaults shown.

Runs in your browser
Try an example

System and network

Bandwidth-delay product: 12,500,000 bytes · max buffer: 16,666,667 bytes

Generated sysctl.d file

99-tuning.conf
These are starting points. The right values depend on your workload, kernel version and hardware: apply on a test host, measure, and keep the previous values so you can roll back.
fs.inotify.max_user_watches may be lower than your kernel's default (up to 1,048,576 on kernel 5.11+). Check with sysctl before applying.
# /etc/sysctl.d/99-tuning.conf
# Generated by Linux Sysctl Tuner. Starting points, not optimal values: test before production.
# Inputs: RAM 16 GB, RTT 100 ms, bandwidth 1000 Mbps, profile Web server.
# Apply with: sudo sysctl --system   (check current values first: sysctl <key>)

# Receive buffer ceiling: 4/3 of the 12500000 bytes BDP (1000 Mbps x 100 ms), with a 4 MiB floor; typical default: 212992
net.core.rmem_max = 16666667
# Send buffer ceiling, set to the same BDP-derived 15.9 MiB so a single flow can fill the link; typical default: 212992
net.core.wmem_max = 16666667
# TCP receive triplet: minimum 4096, default 87380 (an older kernel default), maximum 16666667 for autotuning; typical default: 4096 131072 6291456
net.ipv4.tcp_rmem = 4096 87380 16666667
# TCP send triplet: minimum 4096, default 16384, maximum 16666667 for autotuning; typical default: 4096 16384 4194304
net.ipv4.tcp_wmem = 4096 16384 16666667
# Web server workload: caps the accept() queue at 4096; typical default: 4096 (kernel 5.4+), 128 (older)
net.core.somaxconn = 4096
# Web server workload: allows 8192 half-open TCP handshakes during bursts; typical default: 128 to 4096, scales with RAM
net.ipv4.tcp_max_syn_backlog = 8192
# Global file-handle ceiling: 4194304 (262,144 per GB of RAM, never below 131,072); typical default: about RAM in KiB / 10
fs.file-max = 4194304
# Watcher budget: 131072 (8,192 per GB, never below 65,536); typical default: 8192 (before 5.11), up to 1048576 (5.11+, scales with RAM)
fs.inotify.max_user_watches = 131072
# Web server profile: 10 makes the kernel prefer dropping page cache over swapping; 0 avoids swap until memory is nearly exhausted (it does not disable swap); typical default: 60
vm.swappiness = 10
ParameterValueUnitTypical defaultReason
net.core.rmem_max16666667bytes212992Receive buffer ceiling: 4/3 of the 12500000 bytes BDP (1000 Mbps x 100 ms), with a 4 MiB floor. The 4/3 factor is a heuristic, not a kernel rule.
net.core.wmem_max16666667bytes212992Send buffer ceiling, set to the same BDP-derived 15.9 MiB so a single flow can fill the link.
net.ipv4.tcp_rmem4096 87380 16666667bytes (min default max)4096 131072 6291456TCP receive triplet: minimum 4096, default 87380 (an older kernel default), maximum 16666667 for autotuning.
net.ipv4.tcp_wmem4096 16384 16666667bytes (min default max)4096 16384 4194304TCP send triplet: minimum 4096, default 16384, maximum 16666667 for autotuning.
net.core.somaxconn4096connections4096 (kernel 5.4+), 128 (older)Web server workload: caps the accept() queue at 4096. The application's listen() backlog is limited by this value.
net.ipv4.tcp_max_syn_backlog8192connections128 to 4096, scales with RAMWeb server workload: allows 8192 half-open TCP handshakes during bursts.
fs.file-max4194304file handlesabout RAM in KiB / 10Global file-handle ceiling: 4194304 (262,144 per GB of RAM, never below 131,072). Modern kernels already size this from RAM, so check the current value first.
fs.inotify.max_user_watches131072watches per user8192 (before 5.11), up to 1048576 (5.11+, scales with RAM)Watcher budget: 131072 (8,192 per GB, never below 65,536). Kernel 5.11+ may already default higher; check the current value first.
vm.swappiness100 to 20060Web server profile: 10 makes the kernel prefer dropping page cache over swapping; 0 avoids swap until memory is nearly exhausted (it does not disable swap).

About

Calculate BDP-aware TCP buffers plus connection queues, file handles, inotify watches, and swappiness locally in your browser.

Examples

Gigabit link at 100 ms RTT

Input
calculateSysctl({ ramGb: 16, rttMs: 100, bandwidthMbps: 1000, profile: "web-server" })
Output
bdpBytes: 12500000, maxBufferBytes: 16666667, tcp_rmem: 4096 87380 16666667

BDP is 1e9 × 0.1 / 8 = 12.5 MB; the 4/3 headroom ceils to 16,666,667 as the buffer ceiling.

Database vs web server

Input
calculateSysctl({ ramGb: 8, rttMs: 20, bandwidthMbps: 100, profile: "database" })
Output
vm.swappiness = 1, somaxconn = 2048

The database profile minimizes swap pressure (1 vs 10) and halves the accept queue versus web-server.

About this tool

Linux Sysctl Tuner derives kernel network and memory settings with calculateSysctl({ ramGb, rttMs, bandwidthMbps, profile }): the bandwidth-delay product (bandwidth bits/s × RTT seconds / 8) gets a 4/3 headroom factor via Math.ceil to form maxBufferBytes, floored at 4 MiB, which then feeds net.core.rmem_max/wmem_max and the tcp_rmem/tcp_wmem maximum triplets.

Profiles differentiate queueing and swap policy: web-server (somaxconn 4096, syn backlog 8192, swappiness 10), database (2048/4096/1), file-server (1024/2048/20), and k8s-node (4096/8192/0). RAM scales fs.file-max (262,144 per GB, floor 131,072) and fs.inotify.max_user_watches (8,192 per GB, floor 65,536), and every parameter ships with an explanation plus a ready-to-paste key = value config.

Inputs validate strictly: non-finite or non-positive RAM, RTT, or bandwidth throws, as does an unknown profile. A 1000 Mbps × 100 ms link yields exactly bdpBytes 12,500,000 and maxBufferBytes 16,666,667 — all computation is local, so host specs never leave the browser.

How to use this tool

  1. Enter link and host specs

    Provide RAM in GB, RTT in ms, and bandwidth in Mbps — all three must be positive numbers or the calculation throws.

  2. Pick the workload profile

    Choose web-server, database, file-server, or k8s-node to set somaxconn, syn backlog, and swappiness policy.

  3. Apply the generated config

    Copy the key = value lines into /etc/sysctl.d/99-tuning.conf, run sysctl --system, and verify with sysctl net.core.rmem_max.

Use cases

Sizing high-latency transfer hosts

Raise TCP buffer ceilings so long-fat links (cloud regions, inter-DC replication) can fill the pipe.

Tuning database nodes against swap

Pin swappiness to 1 so database pages stay resident while file cache absorbs the pressure.

Preparing Kubernetes nodes

Use the k8s-node profile (swappiness 0, deep queues) as a baseline for burst-heavy pod traffic.

Common mistakes

Mistake:Passing zero bandwidth or RTT and expecting a fallback.

Fix:Zero or negative inputs throw must be a positive number — validate form fields before calling, since there is no clamping.

Mistake:Applying the config without reloading sysctl.

Fix:Writing the file is not enough — run sysctl --system (or sysctl -p) and confirm each key took effect.

Frequently asked questions

What does this tool do?

It derives sysctl settings with calculateSysctl: BDP (bandwidth × RTT / 8) with 4/3 headroom sets rmem/wmem ceilings and tcp_rmem/tcp_wmem maxima, the profile sets somaxconn/syn-backlog/swappiness, and RAM scales file-max and inotify watches — emitted as key = value lines with explanations.

What is the reference calculation, and how do profiles differ?

1000 Mbps × 100 ms gives bdpBytes 12,500,000 and maxBufferBytes 16,666,667. web-server uses swappiness 10 with somaxconn 4096, database uses 1 with 2048, file-server 20 with 1024, and k8s-node 0 with 4096.

Is my host data uploaded or stored?

No. All arithmetic is local — RAM, RTT, and bandwidth never leave your browser.

Which inputs throw?

Non-finite or non-positive RAM, RTT, or bandwidth (including 0) throws must be a positive number, and an unknown profile throws Unknown profile. There is no clamping fallback.

References & standards