Puzzling TCP performance over 3G / UMTS
I'm using 3G as my primary internet connection, and TCP over this thing is getting more puzzling every day. For example:
-
Downloading from kernel.org is crazy fast:
$wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.6.8.tar.bz2
increases to ~500kB/s after a few secs !
Some servers are incredibly slow, for instance www.graphic-pc.com:
Same thing, downloading a big file with wget it starts at ~30kB/s for a split second, then collapses to 5-10k or even worse.Web browsing is decent but somewhat unreliable. Randomly, a page will take really long to load or even fail to load, but a reload can succeed almost immediately.
Now, by chance i started playing with OpenVPN over UDP on top of the 3G connection, and OMG suddenly everything's extremely fast !
Same www.graphic-pc.com now shoots at 100-200kB/s !
- What's going on here ???
- How come it is so much better with the VPN than without ??
- And why does graphic-pc.com crawl when kernel.org flies ?
Something to do with my tcp stack (or the server), or some buggy router in between ??
Notes:
Setup is laptop running Ubuntu Lucid and a Huawei 3G dongle (So direct pppd connection).
I can reproduce this pretty much any time during the day and I'm not moving, so it's clearly not cell environment or internet congestion. (although kernel.org without VPN sometimes does worse in the evening, 60kB or so - but still 500kB with VPN !)
For 2) wireshark shows retransmitted packets, dup ack's, even out of order sometimes.
I've tried playing with different /proc/sys/net/ipv4 parameters (tcp_rmem, window_scaling, tcp_congestion...) doesn't seem to make a difference.
Update:
Tried under windows 7 (no VPN) with some interesting results:
tcp settings : default tcp_optimizer
kernel.org : 10 kB/s 20 kB/s
graphic-pc.com: 8 kB/s 70 kB/s !
tcp_optimizer turned on ctcp among other things. Have to check what os graphic-pc.com is running, my bet is linux's tcp_westwood and ms ctcp don't mix well here...
Problem solved:
Tested with another file type (.zip) on graphic-pc.com. Guess what, at the same time it's fast for this file and slow for the other one (which btw is .mp3). So that's clearly the ISP doing deep packet inspection and throttling.
As for the strange results under windows, i tested again today and now it's exactly the same as linux. Also, the throttling is dynamic and changes during the day. I guess i was really unlucky and both rebooted and ran tcp_optimizer right when the throttling changed ...
Still curious about the real impact of 3G on TCP performance as there's a number of papers on the subject, but as far as this is concerned it's just traffic shaping crap, nothing wrong with 3G !
First off, 3G/4G connections are not designed to be your primary connections to the internet and they are subject to throttling, if the traffic is flowing thru them matches a certain pattern, or you exceed a un-spoken limit amount of traffic. Don't believe your carrier (even those data-only unlimited touting outfits) when they say you have no limits.
After all it is air time and the air bandwidth is subpar to that of fiber and copper. When they have traffic congestion, they will have no other option but throttle traffic from the end nodes.
The graphic-pc site you mentioned is a very flash (or similar) heavy site and takes up about 60 seconds on my OC-3 connected work internet. So, having a low measuring rates accessing this site over a standard 3G is not a big surprise. Kernel.org is faster you say. Considering the text based nature of this site, I am sure the traffic can be compressed and uncompressed on the fly with your 3G connection at very good success rates, where as this is not a possibility with image/flash/music/etc heavy websites.
Last but not the least, more you want to cram into your pipe, i.e., your 3G connection, less favorable customer you will be, to you ISP and they will throttle you no matter what. And if you read your TOS, you will see that they have a legal right to do so, under reasonable use (which is not 24/7 non-stop connection)
When you go thru a VPN connection, you are encrypting all your network traffic. So your ISP, is no longer able to inspect your packets, hence, can not tell a text page request from a flash page request. So, you circumvented their deep packet inspection to a certain extent. But having a VPN has its own speed penalty, as you will have to encrypt every packet leaving your connection, which comes at a cost. But in your case this cost sounds like minimal or negligible.
Hope this explains it a bit