Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux TCP: high Send-Q on sender, zero Recv-Q on receiver

Tags:

linux

tcp

sockets

How can it be that:

  1. There is a TCP socket between two machines
  2. After some succesful bidirectional communications, sender application is stuck on writing to the socket and receiver on reading from it
  3. netstat reports high Send-Q (a few megabytes) for the socket on the sender (and the value does not change even after a couple of hours of waiting)
  4. netstat reports zero Recv-Q for the socket on the receiver
  5. tcpdump reports that the only activity on the socket is a periodic (biminutely) ACK with no data from the sender and immediate ACK response with no data from the receiver

Why doesn't the sender machine attempt to send queued data to the receiver?

like image 711
Orivej Desh Avatar asked Dec 24 '16 12:12

Orivej Desh


People also ask

What is high send-Q in TCP/IP?

High Send-Q means the data is put on TCP/IP send buffer, but it is not sent or it is sent but not ACKed. So, high value in Send-Q can be related to server network congest, server performance issue or data packet flow control, and so on. Please note: The send and receive queue sizes are shown in bytes.

What is high recv-Q port in TCP/IP?

High Recv-Q means the data is put on TCP/IP receive buffer, but the application does not call recv () to copy it from TCP/IP buffer to the application buffer. Customer can check the application listening the port, and see if it is working as expected. For example, if you saw Recv-Q in the following connection:

Why is my send and recv Q so high?

The send and recv q can be high while the system is transferring data, streaming data to a server. You can make adjustments to the buffers, but keep in mind that it may add some latency to network communications. Tuning is an art and you are going to have to play with the settings to get them right for what you are doing.

What's the meaning of recv-Q and send-Q in netstat -an?

What's the meaning of Recv-Q and Send-Q in "netstat -an"? Generally, "netstat -an“ shows the state of all socket connections. tcp 0 0 *.111 *.* LISTEN tcp 0 0 *.657 *.* LISTEN However, sometimes, we can see some values on Recv-Q and Send-Q. What does that mean?


1 Answers

This is more likely caused by other problem, but below might help if you haven't tried (these numbers are examples, find your own numbers):

  1. Estimate your sender and receiver file system read/write speed as well as network speed, and set appropriate bandwidth limit in rsync: --bwlimit=1024 (1024 KBps)
  2. If sender and receiver have dedicated NIC in this local network, do yourself a favor, increase MTU on these NICs: ifconfig eth1 mtu 65744
  3. Increase sender transmission queue length: ifconfig eth1 txqueuelen 4096
  4. Increase kernel send/receive memory:
    add these to /etc/sysctl.conf file
    net.core.wmem_max=16777216
    net.core.rmem_max=16777216
    net.ipv4.tcp_rmem=4096 262144 16777216
    net.ipv4.tcp_wmem=4096 262144 16777216

    run sysctl -p afterwards.
  5. If you rsync a very large file system, make sure fs.file-max is large enough,
    to check it: sysctl  fs.file-max
    to increase it, add a line fs.file-max=327679 to the file /etc/sysctl.conf,
    on your rsync user, run: ulimit -n 327679
like image 67
Sproffer Avatar answered Oct 14 '22 01:10

Sproffer