[vox-tech] Very slow TCP transfer over loopback
Ken Herron
vox-tech@lists.lugod.org
Sun, 29 Feb 2004 18:54:25 -0800
--On Sunday, February 29, 2004 08:56:42 PM -0500 Mike Simons
<msimons@moria.simons-clan.com> wrote:
> Hello All,
>
> Got a mystery here... transferring data over the loopback interface
> on a old RHAS 2.1 kernel (2.4.9-e.25enterprise) even a modern 2.6.1
> kernel, is _very_ slow. When the SO_RCVBUF is set low.
>
> As you can see from the tcpdump below after the session gets going,
> only one data packet is exchanged every .2 seconds, the sending side
> of the pipe seems to be waiting for something...
>
> - Anyone have a place to look in the RFCs or such that would explain
> why it's waiting, for what?
Seems pretty quick to me:
Run while stracing the server:
> dd if=/dev/zero bs=1024 | time nc -q 0 localhost 2222
Command exited with non-zero status 1
0.07user 0.88system 0:38.67elapsed 2%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (144major+26minor)pagefaults 0swaps
363244+0 records in
363243+0 records out
Fixed the sample program to setsockopt() the accepted file and straced
the server:
> dd if=/dev/zero bs=1024 | time nc -q 0 localhost 2222
Command exited with non-zero status 1
0.06user 0.79system 0:30.18elapsed 2%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (144major+26minor)pagefaults 0swaps
277564+0 records in
277563+0 records out
Run while tcpdumping the loopback interface:
> dd if=/dev/zero bs=1024 | time nc -q 0 localhost 2222
Command exited with non-zero status 1
0.17user 1.98system 0:21.79elapsed 9%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (145major+27minor)pagefaults 0swaps
818739+0 records in
818738+0 records out
Just let it run a while:
> dd if=/dev/zero bs=1024 | time nc -q 0 localhost 2222
Command exited with non-zero status 1
0.33user 4.90system 0:23.38elapsed 22%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (144major+26minor)pagefaults 0swaps
2045878+0 records in
2045877+0 records out
--
Ken Herron