Subject: Re: very slow TCP connection on localhost
To: None <pavel.cahyna@st.mff.cuni.cz, tech-net@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-net
Date: 09/06/2006 11:25:15
On Wed, Sep 06, 2006 at 10:52:15AM +0200, Pavel Cahyna wrote:
> On Tue, Sep 05, 2006 at 06:49:08PM +0200, Manuel Bouyer wrote:
> > On Tue, Sep 05, 2006 at 06:45:24PM +0200, Manuel Bouyer wrote:
> > > [...]
> > > Attached is the output of tcpdump -w on lo0 for this TCP connection.
> > 
> > With the file attached, this time. Sorry
> 
> What does netstat -p ip and netstat -p tcp show before and after?

Unfortunably I don't have "before" anymore. Here is "after":
> netstat -p ip
ip:
        83823535 total packets received
        0 bad header checksums
        0 with size smaller than minimum
        0 with data size < data length
        0 with length > max ip packet size
        0 with header length < data size
        0 with data length < header length
        0 with bad options
        0 with incorrect version number
        200 fragments received
        0 fragments dropped (dup or out of space)
        0 fragments dropped (out of ipqent)
        0 malformed fragments dropped
        0 fragments dropped after timeout
        100 packets reassembled ok
        83784607 packets for this host
        2 packets for unknown/unsupported protocol
        0 packets forwarded (0 packets fast forwarded)
        38826 packets not forwardable
        0 redirects sent
        0 packets no matching gif found
        56291620 packets sent from this host
        2587 packets sent with fabricated ip header
        0 output packets dropped due to no bufs, etc.
        0 output packets discarded due to no route
        100 output datagrams fragmented
        100 fragments created
        0 datagrams that can't be fragmented
        0 datagrams with bad address in header

> netstat -p tcp
tcp:
        55301661 packets sent
                13468160 data packets (48765174014 bytes)
                142584 data packets (4668081807 bytes) retransmitted
                34049565 ack-only packets (39723827 delayed)
                0 URG only packets
                37 window probe packets
                7634105 window update packets
                7210 control packets
                0 send attempts resulted in self-quench
        82696703 packets received
                7720952 acks (for 48546121615 bytes)
                282855 duplicate acks
                0 acks for unsent data
                73536819 packets (135089199940 bytes) received in-sequence
                60 completely duplicate packets (1636 bytes)
                0 old duplicate packets
                0 packets with some dup. data (0 bytes duped)
                1433 out-of-order packets (238920 bytes)
                142483 packets (4667744870 bytes) of data after window
                71248 window probes
                964421 window update packets
                2 packets received after close
                0 discarded for bad checksums
                0 discarded for bad header offset fields
                0 discarded because packet too short
        1445 connection requests
        9728 connection accepts
        11172 connections established (including accepts)
        11275 connections closed (including 5395 drops)
        1 embryonic connection dropped
        0 delayed frees of tcpcb
        7705598 segments updated rtt (of 5708543 attempts)
        71252 retransmit timeouts
                0 connections dropped by rexmit timeout
        67 persist timeouts (resulting in 0 dropped connections)
        72 keepalive timeouts
                71 keepalive probes sent
                1 connection dropped by keepalive
        839353 correct ACK header predictions
        73495551 correct data packet header predictions
        19803 PCB hash misses
        165 dropped due to no socket
        0 connections drained due to memory shortage
        1 PMTUD blackhole detected
        0 bad connection attempts
        9731 SYN cache entries added
                0 hash collisions
                9728 completed
                0 aborted (no space to build PCB)
                0 timed out
                0 dropped due to overflow
                0 dropped due to bucket overflow
                3 dropped due to RST
                0 dropped due to ICMP unreachable
                0 delayed free of SYN cache entries
        0 SYN,ACKs retransmitted
        0 duplicate SYNs received for entries already in the cache
        0 SYNs dropped (no route or no space)
        0 packets with bad signature
        0 packets with good signature


> 
> I would also try reducing the MTU on lo0.

I'll try that too, if increasing the socket buffer size doesn't help.

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