What is the formula to determine how much memory a socket consumes under Linux?

view full story

http://unix.stackexchange.com – 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. (HowTos)