Article View: news.software.nntp
Article #12623Re: [LONG] Analysis: Networking slow-down 2.5<->SunOS 4.1.4
From: Adam Morrison
Date: Sun, 24 Nov 1996 00:00
Date: Sun, 24 Nov 1996 00:00
105 lines
5732 bytes
5732 bytes
In article <56se3e$eic@news.Informatik.Uni-Oldenburg.DE>
"Christian Kuehnke" <Christian.Kuehnke@arbi.Informatik.Uni-Oldenburg.DE> wrote:
> A hint from our local guru about using "setsockopt" with "SO_SNDBUF"
> and "SO_RCVBUF" and its possible effect on window sizes on SunOS let
> me to the following experiment: I grabbed the "rsh" sources from
> FreeBSD, modified them to compile on SunOS [only replacing some error
> handling functions by fprintf/perror was necessary], and inserted the
> following code:
[...]
> Now the question is, whether there is a kernel hack to increase
> the default window size for TCP in SunOS 4. Or what?
Yes. The default socket buffer sizes for TCP sockets are in
tcp_recvspace and tcp_sendspace in BSD stacks.
# adb -w /vmunix /dev/kmem
not core file = /dev/kmem
tcp_sendspace/D
_tcp_sendspace:
_tcp_sendspace: 4096
tcp_sendspace/W0t8192
_tcp_sendspace: 0x1000 = 0x2000
tcp_sendspace?W0t8192
_tcp_sendspace: 0x1000 = 0x2000
Increasing the send buffer size certainly increases throughput
in bulk data transfers, between SunOS boxes too. (Just remember
to kill and restart inetd for the changes to effect your daemons.)
But I've seen something more subtle going on. Here's my trace
of this test.
In this trace, snd is a SunOS 4.1.4 box with tcp_sendspace==4096,
and rcv is a Solaris 2.5 box, untouched.
13.356785 snd.1023 > rcv.shell: S 796736000:796736000(0) win 4096
<mss 1460>
13.357498 rcv.shell > snd.1023: S 768441916:768441916(0) ack 796736001 win
8760 <mss 1460> (DF)
[...]
14.146136 snd.1023 > rcv.shell: P 93507:94683(1176) ack 2 win 4096
14.147414 snd.1023 > rcv.shell: . 94683:96143(1460) ack 2 win 4096
14.148865 snd.1023 > rcv.shell: P 96143:97603(1460) ack 2 win 4096
14.149104 rcv.shell > snd.1023: . ack 96143 win 8760 (DF)
14.150921 snd.1023 > rcv.shell: . 97603:99063(1460) ack 2 win 4096
14.174849 rcv.shell > snd.1023: . ack 99063 win 8760 (DF)
[...]
14.416214 snd.1023 > rcv.shell: P 138563:139739(1176) ack 2 win 4096
14.417445 snd.1023 > rcv.shell: . 139739:141199(1460) ack 2 win 4096
14.418666 snd.1023 > rcv.shell: P 141199:142659(1460) ack 2 win 4096
14.419006 rcv.shell > snd.1023: . ack 141199 win 8760 (DF)
14.420698 snd.1023 > rcv.shell: . 142659:144119(1460) ack 2 win 4096
14.445729 rcv.shell > snd.1023: . ack 144119 win 8760 (DF)
The exact same thing happens all over the trace; snd sends its entire
4096 byte buffer. Rcv processes the first segment, and marks the
connection for a delayed ack. Then it processes the second segment,
and since there's a previous, unacked segment, it acks them both.
Now it processes the third segment, and again, marks the connection for
a delayed ack. (That's the flow of events under BSD, anyway --
can anyone who has read the Solaris stack sources say if Solaris is
behaves differently?)
Meanwhile, the receiver sends another segment, and now something
peculiar happens. Rcv doesn't ack this segment immediately
(like it did before, when there was a preceding segment that hasn't
been acked). Instead it waits 25ms and then acks it. (The
tcp_deferred_ack_interval variable was 50ms.) I'm really
not sure why it's doing this.
Compare this to the following trace, in which rcv is a SunOS box
with tcp_recvspace==8760. Throughput wasn't nearly as bad --
~5 sec compared to ~17 sec in the SunOS -> Solaris case.
36.371889 snd.1021 > rcv.shell: S 661888000:661888000(0) win 4096
<mss 1460>
36.372245 rcv.shell > snd.1021: S 639744000:639744000(0) ack 661888001
win 8760 <mss 1460>
[...]
36.875527 snd.1021 > rcv.shell: P 130959:132135(1176) ack 2 win 4096
36.876780 snd.1021 > rcv.shell: . 132135:133595(1460) ack 2 win 4096
36.878016 snd.1021 > rcv.shell: . 133595:135055(1460) ack 2 win 4096
36.878291 rcv.shell > snd.1021: . ack 135055 win 8760
[...]
37.045803 snd.1021 > rcv.shell: P 247695:247847(152) ack 2 win 4096
37.047165 snd.1021 > rcv.shell: . 247847:249307(1460) ack 2 win 4096
37.048490 snd.1021 > rcv.shell: . 249307:250767(1460) ack 2 win 4096
37.048794 rcv.shell > snd.1021: . ack 250767 win 8760
First of all, none of that 25ms stuff. And a nice play of the
BSD algorithm for delayed acks. BSD doesn't ack every other
packet; it tests for when its receive window has changed by
more than 2*MSS. Snd sends it entire buffer (1176+1460+1460), but
even if rcv reads the first two segments and not the third,
the window will have changed by less than 2*MSS, so the ack is sent
only after the third segment, and you get exactly one ack for each three
segments (most of the time).
adam?
Technical Details
Message-ID:
<nmKmyMx52o5V083yn@math.tau.ac.il>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.sys.sun.admin.mbox.zip!not-for-mailReferences:
<82ybfzragk.fsf@parrot.eecs.umich.edu>Show Full Headers
Complete Article Headers
Message-ID: <nmKmyMx52o5V083yn@math.tau.ac.il> Subject: Re: [LONG] Analysis: Networking slow-down 2.5<->SunOS 4.1.4 Date: Sun, 24 Nov 1996 00:00:00 +0000 From: adam@math.tau.ac.il (Adam Morrison) References: <82ybfzragk.fsf@parrot.eecs.umich.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.sys.sun.admin.mbox.zip!not-for-mail X-Deja-AN: 198452854 Distribution: inet Summary: 25ms delay in the Solaris TCP stack? Organization: chuck-the-duck Keywords: solaris sunos slow-down delayed-ack Reply-to: adam@math.tau.ac.il Newsgroups: comp.sys.sun.admin,comp.unix.solaris,news.software.nntp Originator: adam@lune.math.tau.ac.il