Take the 2-minute tour ×  I'm doing some capacity planning and I
was wondering if there is a formula that I could use to predict
(from a memory standpoint) how many TCP connections I could
handle on my server. At the moment, I'm only concerned about
memory requirements.  Some variables that I think will show up
in the formula are:    • sysctl's net.ipv4.tcp_wmem (min or
default value)   • sysctl's net.ipv4.tcp_rmem (min or default
value)   • the size of the sock, sock_common, proto and other
per-socket data structures.  I'm not sure how much of the
tcp_wmem and tcp_rmem are actually allocated and when that
memory is allocated. At socket creation time? On demand?
share|improve this question add comment  3 Answers  up vote 1
down vote accepted  If you can modify the source code, then use
rusage data to measure the RSS and record how many TCP
connections are in play at the time of the measurement.  If
source code cannot be changed, then use the RSS of the network
app as reported by top or ps and get the number