Friday, February 1, 2013

Socket Stats

A bunch better tool than netstat...it can even show you memory usage for all your sockets:

http://www.cyberciti.biz/files/ss.html

What do all these memory letters represent?

Recv-Q Send-Q       
   0      0            
 mem:(r0,w0,f0,t0)

You can do man netstat to understand what Recv-Q and Send-Q mean:


 Recv-Q
     The count of bytes not copied by the user program connected to this socket.

 Send-Q
     The count of bytes not acknowledged by the remote host.

The rmem, wmem, fmem, and tmem refers to specific Linux kernel values:


rmem = sk->sk_rmem_alloc; 
wmem = sk->sk_wmem_queued; 
fmem = sk->sk_forward_alloc; 
tmem = sk->sk_wmem_alloc;

sk_forward_alloc is the forward allocated memory which is the total memory currently available in the socket’s quota.
sk_wmem_queued is the amount of memory used by the socket send buffer queued in the transmit queue and are either not yet sent out or not yet acknowledged.

http://www.cse.scu.edu/~dclark/am_256_graph_theory/linux_2_6_stack/structtcpdiag__meminfo.html#m1

For more information, see Chapter 9 of TCP/IP Architecture, Design and Implementation in Linux:
http://books.google.com/books?id=sKoo-cFNPYsC&lpg=PA300&ots=We7wmJfrVj&pg=PA298#v=onepage&q&f=false

No comments:

Post a Comment