Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client sends delayed FIN ACK (~500ms) to server

I have a node.js client (10.177.62.7) requesting some data from http rest service from server (10.177.0.1). Client is simply using node.js http.request() method (agent=false). Client is on Ubuntu 11.10 box.

Why client sends FIN ACK after 475ms? Why so slow? He should send FIN ACK immediately. I have many situations like this. About 1% of whole traffic is request with delayed FIN ACK.

Cpu idle on the client is about 99%, so nothing is draining CPU.

How to debug this? What could it be? Is there any sysctl option I need to tune?

On screenshot 2nd column is the elapsed time between packets.

Link to bigger picture.

enter image description here

like image 596
Tereska Avatar asked Jul 29 '12 17:07

Tereska


People also ask

What is FIN ACK in TCP?

TCP Connection termination is a 4-way handshake and not a 3-way handshake. To understand these requirements, it's important to remember two TCP flags: FIN-ACK — Indicates acknowledgment of FIN packet. FIN — Indicates no more data will be transmitted from the sender.

What is FIN ACK Wireshark?

A FIN is used to indicate the termination of a TCP session. The ACK bit is used to indicate that that the ACK number in the TCP header is acknowledging data.


1 Answers

This behaviour is the Delayed ACK feature of RFC1122 TCP stack.

Normally you should add the TCP_QUICKACK option to your Linux TCP socket to disable delayed ACK but I think it is not obvious with JavaScript Node.js API (I only saw socket.setNoDelay for TCP_NODELAY option).

So your idea to apply a system-wide change on TCP stack seems good but I found no sysctl matching this socket option behaviour. Here is another full list with explanation.

like image 157
Yves Martin Avatar answered Sep 22 '22 12:09

Yves Martin