Skip to content
ENExplore Calculators

TCP Connection Calculator

Calculate maximum concurrent TCP connections a server can handle given port and memory limits.

About TCP Connection Calculator

Each outbound TCP connection to a given remote (IP, port) pair consumes one unique local (source IP, source port) combination, so the theoretical connection ceiling from a single host is the ephemeral port range size multiplied by the number of local source IPs available to bind from. In practice, connections lingering in TIME_WAIT after close continue to occupy their port for roughly 2×MSL, so the effective available capacity for new connections is lower than the theoretical maximum — a common bottleneck for high-throughput proxies and load generators making many short-lived outbound connections to the same destination.

Formula

Maximum connections

max_conns = ephemeral_port_range × local_IPs

P_{high}
high end of ephemeral range
P_{low}
low end of ephemeral range
I_{local}
local source IPs

Worked example

With the default values below, TCP Connection Calculator returns Max Concurrent Outbound Connections of 28,232. Change any input above and every figure here is recalculated in your browser.

Inputs used

Ephemeral Port Range — Lowaccepts 1,024–65,535
32,768
Ephemeral Port Range — Highaccepts 1,024–65,535
60,999
Local Source IPsminimum 1
1
Fraction of Connections in TIME_WAITaccepts 0–99
30

Results

Max Concurrent Outbound Connections
28,232
Effective Available (excl. TIME_WAIT)
19,762
Ephemeral Port Range Size
28,232
Ports Tied Up in TIME_WAIT
8,470

Step by step

  1. 1Values used
  2. 2Maximum connections
  3. 3Max Concurrent Outbound Connections= 28,232
  4. 4Effective Available (excl. TIME_WAIT)= 19,762
  5. 5Ephemeral Port Range Size= 28,232
  6. 6Ports Tied Up in TIME_WAIT= 8,470

Assumptions and limits

  • The result is derived only from the 4 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 check my system's ephemeral port range?

`cat /proc/sys/net/ipv4/ip_local_port_range` prints the low and high bounds (default is often 32768–60999). Widen it with `sysctl -w net.ipv4.ip_local_port_range="10000 65535"` if you're hitting connection ceilings.

Why does adding more local IPs increase the connection ceiling?

The (source IP, source port, dest IP, dest port) 4-tuple must be unique per connection to the same destination — binding outbound connections across multiple local IPs multiplies the number of distinct 4-tuples available, effectively giving each IP its own independent ephemeral port range against the same remote endpoint.

How can I reduce TIME_WAIT pressure without disabling it entirely?

Enable `net.ipv4.tcp_tw_reuse=1` (safe for outbound/client connections), reduce `net.ipv4.tcp_fin_timeout`, or better, reuse persistent connections (HTTP keep-alive, connection pooling) so fewer short-lived connections are created in the first place.

TCP Connection Calculator | Calcrivo