Skip to content
Calcrivo

Kernel Parameter (sysctl) Calculator

Evaluate common sysctl tuning values (vm.swappiness, net.core.somaxconn) and their practical impact.

Inputs

vm.swappiness Impact

Balanced/default behavior — reasonable for general-purpose servers and desktops.

net.core.somaxconn Verdict

somaxconn (4096) covers the expected connection rate (1000/s) with 3096 headroom in the accept backlog.

Accept Backlog Headroom

3,096

fs.file-max

2,097,152

file-max per GB RAM

131,072

Step by step

  1. Values used

    vm.swappiness (0-100) = 60; net.core.somaxconn = 4,096; fs.file-max = 2,097,152; Expected New Connections/sec (for somaxconn check) = 1,000; System RAM (GB, for swappiness context) = 16

  2. Backlog headroom

    backlog_headroom = somaxconn − expected_connections_per_sec

  3. vm.swappiness Impact

    = Balanced/default behavior — reasonable for general-purpose servers and desktops.

  4. net.core.somaxconn Verdict

    = somaxconn (4096) covers the expected connection rate (1000/s) with 3096 headroom in the accept backlog.

  5. Accept Backlog Headroom

    = 3,096

  6. fs.file-max

    = 2,097,152

  7. file-max per GB RAM

    = 131,072

How it works

sysctl parameters tune kernel subsystem behavior at runtime without a reboot. vm.swappiness (0-100) biases the kernel's memory reclaim between swapping out anonymous pages versus reclaiming page cache — lower values favor keeping processes in RAM (better for databases), higher values favor keeping more page cache. net.core.somaxconn caps the accept() backlog queue depth for listening sockets — set too low relative to incoming connection rate, a burst of new connections can overflow the backlog and get refused even though the application itself has spare capacity. fs.file-max caps total open file descriptors system-wide, relevant for high-concurrency servers.

Formula

Backlog headroom

backlog_headroom = somaxconn − expected_connections_per_sec

S
somaxconn
R
expected new connections/sec

Frequently Asked Questions

How do I view and change sysctl values on a running system?

`sysctl vm.swappiness` reads the current value; `sudo sysctl -w vm.swappiness=10` changes it immediately but only until reboot. To persist, add `vm.swappiness = 10` to /etc/sysctl.conf or a file under /etc/sysctl.d/ and run `sudo sysctl -p`.

Does raising net.core.somaxconn alone fix connection refused errors?

Not necessarily — the application's own listen() call passes a backlog argument that is capped by (effectively min'd with) somaxconn; many servers (nginx, e.g. via its `backlog` directive) need their own configuration raised to actually use a higher kernel-level somaxconn.

What's a commonly recommended vm.swappiness for a database server?

Values of 1-10 are common recommendations for PostgreSQL/MySQL hosts to minimize the risk of swap-induced query latency spikes, since databases typically manage their own buffer caching and benefit more from staying resident in RAM than from the kernel's generic page cache heuristics.

You might also need