Re: Constant Socket Receive Buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 6 Dec 2007, Tharindu Rukshan Bamunuarachchi wrote:

> Dear Stephen,
> 
> Thankx for the quick reply....
> 
> On Dec 6, 2007 10:40 AM, Stephen Hemminger
> <shemminger@xxxxxxxxxxxxxxxxxxxx> wrote:
> >>On Wed, 5 Dec 2007 23:58:59 +0530 "Tharindu Rukshan Bamunuarachchi"
> <tharindunix@xxxxxxxxx> wrote:
> >>
> >> Dear All,
> >>
> >> How can I maintain constant/minimum socket receive buffer.
> >>
> >> I have used setsockopt() with SO_RCVBUF value for  256bytes
> >>
> >>
> >>
> >Why? Is your application limited? or is the network so busted it can't
> >take outstanding data?
> 
> - We are trying to throttle 'sender application' by not reading from TCP
> stack (from receiver side) after reading certain number of messages.
> - Here we wanted to limit number of data buffered in the receiver side when
> receiver application stops reading from TCP stack.
> 
> >Setting RCVBUF less than MTU size is likely to be ignored, otherwise
> >the sender on the other
> >size would be do silly window avoidance.
> 
> - we set SO_RCVBUF value to 512 bytes before listen, then TCP negotiated 768
> bytes while  establishing a connection. We stopped reading from TCP stack
> after some time and we observed that TCP advertising window size reduced to
> 0. Subsequently receiver advertised higher values such as 1152, 2304, 1460.
> - Does this mean that receive buffer size has grown beyond initially set
> value (512 bytes)?
> 
> 11:48:46.887136 IP v20z-10.28902 > 172.25.41.159.2963: S
> 1720573913:1720573913(0) ack 253836197 win 768 <mss 1460,nop,nop,sackOK>
> 11:48:46.894547 IP v20z-10.28902 > 172.25.41.159.2963: . ack 113 win 656
> 11:48:46.897735 IP v20z-10.28902 > 172.25.41.159.2963: P 1:92(91) ack 113
> win 656
> 
> 11:48:47.295885 IP v20z-10.28902 > 172.25.41.159.2963: . 144498:145958(1460)
> ack 3321 win 11
> 11:48:47.328583 IP v20z-10.28902 > 172.25.41.159.2963: . ack 3321 win 1152
> 11:48:47.329513 IP v20z-10.28902 > 172.25.41.159.2963: . ack 4473 win 0
> 11:48:47.331274 IP v20z-10.28902 > 172.25.41.159.2963: . ack 4473 win 1152
> 11:48:47.332186 IP v20z-10.28902 > 172.25.41.159.2963: . ack 5625 win 1152
> 11:48:47.333379 IP v20z-10.28902 > 172.25.41.159.2963: . ack 6777 win 2304
> 11:48:47.374390 IP v20z-10.28902 > 172.25.41.159.2963: . ack 8237 win 1460

A couple of points.  Linux doubles what you request so request x
gets 2x, but then only 3/4 of that is available for real data, so
receiver's advertised window winds up being 2*3/4x or 1.5x.  And
you also may need to set /proc/sys/net/ipv4/tcp_moderate_rcvbuf
to 0 to disable Linux's autotuning feature.  Some of this also may
depend on the specific kernel version you're running.  And the
minimum setting from tcp_rmem may have an effect or may not be
allowed to drop below the MTU size as Stephen pointed out.

						-Bill
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux