Subject: very slow TCP connection on localhost
To: None <tech-net@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-net
Date: 09/05/2006 18:45:24
Hi,
I've been tracking down a speed issue with an amanda backup. The bottleneck
seems to be a TCP socket between 2 processes on the backup server,
which can transfers data at only a few 10s KB/s. netstat shows that the
receive queue on the reader side is always empty, while the send queue
on the sender side is always full. ktruss shows that the reader blocks on
read on the socket, and can read one or 2 64k block per second.
The writer blocks writing on the socket and can write only one or two
64k block per second. A tcpdump shows very bursty traffic on lo0, with
long pauses. This really looks like a TCP issue to me, maybe waiting for a
timeout before sending ACK, or something like that.
This is a 3.0_STABLE system from march.
Attached is the output of tcpdump -w on lo0 for this TCP connection.
Anyone has an idea about such behavior ?

here is the sysctl net.inet.tcp on this box:
net.inet.tcp.rfc1323 = 1
net.inet.tcp.sendspace = 32768
net.inet.tcp.recvspace = 32768
net.inet.tcp.mssdflt = 512
net.inet.tcp.syn_cache_limit = 10255
net.inet.tcp.syn_bucket_limit = 105
net.inet.tcp.init_win = 0
net.inet.tcp.mss_ifmtu = 0
net.inet.tcp.sack.enable = 1
net.inet.tcp.sack.maxholes = 32
net.inet.tcp.sack.globalmaxholes = 1024
net.inet.tcp.sack.globalholes = 0
net.inet.tcp.win_scale = 1
net.inet.tcp.timestamps = 1
net.inet.tcp.compat_42 = 0
net.inet.tcp.cwm = 0
net.inet.tcp.cwm_burstsize = 4
net.inet.tcp.ack_on_push = 0
net.inet.tcp.keepidle = 14400
net.inet.tcp.keepintvl = 150
net.inet.tcp.keepcnt = 8
net.inet.tcp.slowhz = 2
net.inet.tcp.newreno = 1
net.inet.tcp.log_refused = 0
net.inet.tcp.rstppslimit = 100
net.inet.tcp.delack_ticks = 20
net.inet.tcp.init_win_local = 4
net.inet.tcp.do_loopback_cksum = 0

-- 
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
     NetBSD: 26 ans d'experience feront toujours la difference
--