Although, as mentioned, in /proc you can see the current default socket buffer sizes, but you can also check them using sysctl (Note: although the name includes ipv4, these sizes also apply to ipv6 sockets - ipv6 code tcp_v6_init_sock () just calls the function ipv4 tcp_init_sock ()):
sysctl net.ipv4.tcp_rmem sysctl net.ipv4.tcp_wmem
However, by default, socket buffers are simply set when sock is initialized, and then the kernel dynamically resizes them (if not set using setsockopt () with SO_SNDBUF). The actual buffer size for currently open sockets can be checked using the ss command (part of the iproute package), which can also provide much more information about sockets, such as the congestion control parameter, etc. For example. To view the list of currently open TCP sockets (option t ) and their associated memory ( m ):
ss -tm
Here is an example output:
State Recv-Q Send-Q Local Address:Port Peer Address:Port ESTAB 0 0 192.168.56.102:ssh 192.168.56.1:56328 skmem:(r0,rb369280,t0,tb87040,f0,w0,o0,bl0,d0)
Here is a brief explanation of skmem (socket memory) - for more information, you need to take a look at the kernel source (for example, sock.h ):
r:sk_rmem_alloc rb:sk_rcvbuf # current receive buffer size t:sk_wmem_alloc tb:sk_sndbuf # current transmit buffer size f:sk_forward_alloc w:sk_wmem_queued # persistent transmit queue size o:sk_omem_alloc bl:sk_backlog d:sk_drops
Pierz May 23 '19 at 16:23 2019-05-23 16:23
source share