Skip to content
ENExplore Calculators

Kernel Parameter Calculator

Calculate recommended sysctl kernel parameter values for a given workload profile.

About Kernel Parameter Calculator

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

Worked example

With the default values below, Kernel Parameter Calculator returns vm.swappiness Impact of Balanced/default behavior — reasonable for general-purpose servers and desktops.. Change any input above and every figure here is recalculated in your browser.

Inputs used

vm.swappiness (0-100)accepts 0–100
60
net.core.somaxconnminimum 1
4,096
fs.file-maxminimum 1
2,097,152
Expected New Connections/sec (for somaxconn check)minimum 0
1,000
System RAM (GB, for swappiness context)minimum 0.5
16

Results

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. 1Values used
  2. 2Backlog headroom
  3. 3vm.swappiness Impact= Balanced/default behavior — reasonable for general-purpose servers and desktops.
  4. 4net.core.somaxconn Verdict= somaxconn (4096) covers the expected connection rate (1000/s) with 3096 headroom in the accept backlog.
  5. 5Accept Backlog Headroom= 3,096
  6. 6fs.file-max= 2,097,152
  7. 7file-max per GB RAM= 131,072

Assumptions and limits

  • The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

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.

Kernel Parameter Calculator – Calculate vm.swappiness Impact