LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Change kernel to always be in tcp quick ack mode (https://www.linuxquestions.org/questions/linux-networking-3/change-kernel-to-always-be-in-tcp-quick-ack-mode-686095/)

jbraswell314 11-25-2008 05:00 PM

Change kernel to always be in tcp quick ack mode
 
Hi, my Java program is running into some occasional-yet-significant delay when writing to a TCP socket. The problem seems to be that my side is delaying packets because it's waiting for the other side to send more data so that my side can piggy-back its data on the next ack to the other side.

It looks like I can fix this by calling tcp_enter_quickack_mode (found here: http://lxr.linux.no/linux+v2.6.27.7/...p_input.c#L178 ). However, i) I can't call this from Java, and ii) even if I use C/C++, I have to call it before every send because the kernel turns it back off after every send - it looks like the pingpong flag is the relevant one?

Has anyone ever modified the kernel so that this setting is always off? I'm no expert, so I'm a little wary of making changes without a voice of experience.

Thanks

unSpawn 11-26-2008 01:08 PM

Quote:

Originally Posted by jbraswell314 (Post 3354274)
The problem seems to be that my side is delaying packets because it's waiting for the other side to send more data so that my side can piggy-back its data on the next ack to the other side.

This network stack really is a well-constructed thing. ACK's play their own part in ensuring the connection is handled well. "Modifying" how your stack works may well break compatibility. From how you posted your question I think the problem is not sender-side but receiver-side. Maybe the default doc http://myhsc.pbwiki.com/Inside_Linux_TCP::Delayed_Ack can tell you (better than I can) why you shouldn't muck with this the way you want to?..

jbraswell314 11-26-2008 05:48 PM

Well, unfortunately, I have no choice but to muck with it...I only have a TCP API to work with in this case, and latency minimization is critical.

I made the change I discussed, but it didn't fix my problem. That change only made me send my acks faster.

I think the problem has to do instead with the congestion window. Is there a list somewhere of all the reasons a congestion window shrinks? (I have slow start disabled.)

jbraswell314 11-26-2008 06:49 PM

Hmm, looks like I can just set the minimum congestion window (min_cwnd) to something large enough to handle all of my data.

Sound right?

estabroo 11-26-2008 11:54 PM

you probably need to set socket option TCP_NODELAY on the sender side, what's most likely happening is the tcp packets aren't being sent until you've filled the buffer as opposed to immediately when you write a block of data. I think you can also set this with the tcp_low_latency in /proc but that would be system wide instead of just for one connection.


All times are GMT -5. The time now is 06:51 PM.