Estimating the Number of TCP Sessions per Host

Another day, another stateful debate, this time centered on the number of flows per hypervisor. Previously I guestimated 2.500 connections-per-second-per-(user-facing)gigabit and 37.500 concurrent sessions per user-facing gigabit, but wanted to align my numbers with reality before reaching any conclusions.

My web sites are way too small, so I asked a few of my friends to help me get more realistic figures.

Specifically, I asked for outputs of

$ netstat –n –t | grep ESTABLISHED | wc –l
$ netstat –n –t | grep ESTABLISHED | grep ':HTTP-SERVER-PORT ' | wc –l
$ ss -s

Willing to share your numbers? Please post them in a comment. Thank you!

Initial results

I expected to see approximately three categories of web sites:

  • Sites with small number of sessions (similar to my web sites);
  • Higher-volume sites with incoming connections load-balanced across a scale-out farm of web servers;
  • The real outliers.

However, I was still amazed how closely grouped the higher-volume web sites were. Almost all printouts I got back (from news portal, regional search engine, municipal, academic ... web sites) indicated individual servers had approximately 1000 sessions. Sometimes these sessions were mostly user sessions, sometimes almost half of them weren’t (typical for dynamic content fetched from a back-end database).

Based on this totally unscientific anecdata sample it seems it’s somewhat safe to assume a typical web server having between 1000 and 2000 sessions (more if it uses modern application architecture with a farm of Memcached servers).

Estimating the number of sessions per Gbps

Someone was kind enough to send me load balancer printouts:

Load balancer throughput

New connections per second

Maximum number of connections

Using these printouts it’s pretty easy to estimate

  • Average session bandwidth (bandwidth / active connections) = ~8 kbps
  • Number of active sessions per gigabit = ~120K
  • Number of new connections per second per gigabit = ~1000
  • Average session length (active connections / connections-per-second) = ~ 100 sec (my guestimate assumed 15 seconds, so my figure should have been ~18.000 concurrent sessions per user-facing gigabit)

The load balancer was handling user-facing HTTP(S) sessions; sessions between web servers and back-end database/app/caching servers were not included.

My guestimates weren’t that far off, although I did over-estimate the number of new connections (and consequently the total number of connections).

The outliers

More frequently visited web sites have a crazy number of connections – I got printouts from a Linux-based load balancer deployed at a web site with mid-tens Alexa rank: over 250.000 active TCP sessions per Linux system, half of them facing the end-users, the other half internal web servers. Obviously it’s possible to solve not just the C10K problem but also the C100K problem.

Huge thank you!

I would like to thank Chris Marget, Bob McCouch, Simeon Lisec, Matjaž Straus and Bob Plankers for helping me get some of the numbers mentioned in this article.


  1. Take a peek at
    Also PF_RING is interesting to have feeling how Linux can perform on the network
Add comment