I am using blocking BOOST ASIO socket on Linux platform. In some read() operations, I see a massive latency of 500+ ms. (Mostly the latency is good but one off such huge latency is unacceptable)
I have already disabled Nagle's algorithm using the option
_socket->set_option( tcp::no_delay( true) );
I tried to search on the internet, and it seems that there are other things like Delayed Ack and PUSH flag which can ensure this latency goes away.
I am using Linux, PUSH flag setting is probably not available in Linux. Not sure of the setting for Delayed Ack on BOOST. (Should I use native socket descriptor extracted from boost socket?)
Closing this question, the delay was from the receiver side. The underlying protocol implemented between client and server is such that receiver does not give a flag to the sender for sending more packets. Nothing in there at TCP level. Application level implementation is bad.