Disabling nagle algorithm

Peter Teoh htmldeveloper at gmail.com
Mon May 30 03:39:52 EDT 2011


On Mon, May 30, 2011 at 12:47 PM, C K Kashyap <ckkashyap at gmail.com> wrote:
>
>
> On Mon, May 30, 2011 at 9:53 AM, Anupam Kapoor <anupam.kapoor at gmail.com>
> wrote:
>>
>> is tcp_nodelay not an option ?
>>
>
> Is this a socket option or is there a system wide setting for tcp_nodelay?

Yes, TCP_NODELAY is a socket option:

Going back to the kernel source:

include/linux/tcp.h:

#define TCP_NODELAY             1       /* Turn off Nagle's algorithm. */

and this:

       u8      nonagle     : 4,/* Disable Nagle algorithm?             */

and looking into the kernel source code:

./fs/ocfs2/cluster/tcp.c:
	ret = sock->ops->setsockopt(sock, SOL_TCP, TCP_NODELAY,

./net/rds/tcp.c:
	sock->ops->setsockopt(sock, SOL_TCP, TCP_NODELAY, (char __user *)&val,
the above are just two of the examples of how to set TCP_NODELAY in the kernel.

At the userspace level:

http://www.linuxquestions.org/questions/other-*nix-55/how-do-i-disable-the-nagle-algorithm-in-enterprise-linux-3-kernel-ver-2-4-21-4-a-556170/

should be the correct way, except that the poster is attempting to do
it in a kernel that does not support it.

As documented in http://linux.die.net/man/7/tcp, the supported kernel
is 2.5.71 and onwards.

-- 
Regards,
Peter Teoh



More information about the Kernelnewbies mailing list