Connections establish slowly, while download rate is great -Linux

EDIT: I have seen this problem elsewhere with an ADSL connection and not only USB modems or cell network.

I have my cell network USB modem attached and configured, running under Ubuntu 10.04 The connection is slow in general, although the data flow is good after a connection is established, the problem is it takes too long to actually establish the connections. IP lookups are done super fast so it's not likely the problem at all. I have tried ssh, skype and FTP. There is no problem with any of these.

The problem is mainly seen in HTTP connections, especially with sites with many resources that are gathered from multiple sources, eventually one or two of these resources (image, CSS or JS file) fail to load, the the browser keeps reporting "Waiting for example.com ..." for munites, freezing and keep waiting for this single resource to be loaded. I guess that here could be a clue. I tried browsers other than Firefox: Chrome and Opera and the problem is there as well!

What could be going behind the scenes? Any questions are welcome.


If other services than HTTP are running good for you, maybe your Internet Provider is using an overloaded reverse proxy to cache things and save bandwidth. You can try to connect to a remote HTTP server running on a non-standard (but the ISP can use a layer-7 fw to intercept your requests) or setup an openvpn server somewhere and tunnel all your traffic over it.


Cell networks are likely to have high latencies, thus your packet round-trip-time is probably somewhere in the magnitude of up to one second. Just check that by issuing a ping to some internet host with a known constant latency, e.g.:

# ping www.gogle.de
PING www.l.google.com (74.125.79.99) 56(84) bytes of data.
64 bytes from ey-in-f99.1e100.net (74.125.79.99): icmp_seq=1 ttl=53 time=12.7 ms
64 bytes from ey-in-f99.1e100.net (74.125.79.99): icmp_seq=2 ttl=53 time=16.1 ms
64 bytes from ey-in-f99.1e100.net (74.125.79.99): icmp_seq=3 ttl=53 time=17.2 ms
^C
--- www.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 12.794/15.377/17.218/1.886 ms

TCP is able to adapt for high-latency networks due to its internal buffering and ability to send a fair amount of data without the need to receive immediate responses, so you might well see good throughput rates for bulk transfers with your connection. But high latency of course will greatly impact the performance of TCP handshakes (i.e. the connection initiation) and every "ping-pong-style" protocol where one side waits for the response of the other before doing any further processing (like HTTP with many small objects to fetch, even worse if they depend on each other like it would be the case with frames and iframes and included javascript files).

Edit: You should use something like Firebug to see what's happening in more detail. Or even run a Wireshark trace for protocol-level information. If you get data that is pointing to a problem with the ISP, you might want to complain to them. Apart from that, using a smaller MTU might be worth a try - some transmissions might suffer from MTU blackholes.


You should investigate the DNS settings. If IP lookups are fast, then you are probably waiting for a response from a slow DNS server, or you are configured to poll multiple DNS servers and the first few are down/unresponsive. On Ubuntu you can edit the /etc/resolv.conf to temporarily change your DNS settings. First delete everything in the file and replace with this:

nameserver 8.8.8.8
nameserver 8.8.4.4

If your USB browsing situation improves, then the DNS configuration for the USB modem is what's causing you troubles.