1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Troubleshooting YouTube slowness

Discussion in 'Tomato Firmware' started by bhall7, Feb 12, 2013.

  1. bhall7

    bhall7 LI Guru Member

    This has been driving me crazy lately and I wanted to see if anyone else is having similar issues. YouTube is extremely slow. Videos frequently stall after only a few seconds of playback. It is mostly isolated to portable iOS devices in our house running on WiFi. Things playback fine on my MacBook and other computers in the house. I'm running an ASUS RT-N16 with a recent Toastman build of Tomato USB (v1.28.7501 MIPSR2Toastman-RT K26 USB VPN). I don't suspect a WiFi problem, because everything else works beautifully through WiFi (including Netflix, web browsing, and other network operations), and I'm getting solid transfer rates (130-144Mbps on 2.4GHz).

    I just watched a TV episode on Netflix on my iPhone 5 without a single hiccup. Later, I tried to watch a YouTube video, but it completely stalled out after a couple of seconds, and took a few minutes before it played the next 15-20 seconds or so. I get the same problem whether viewing the YouTube video on the web or in the latest YouTube app from Google. I just ran a speed test using the SpeedTest app for iOS and got great results:


    In a frantic attempt to isolate the problem, I turned off USB support completely, disabled Samba file sharing, killed the DLNA media server, and turned off QoS. None of these actions made any improvements.

    Interestingly, when I disable WiFi on the iPhone 5, it connects to 4G LTE and the video plays back without any problems. Why would iOS devices struggle to playback YouTube videos over WiFi, but other machines can do so without any problems?
  2. koitsu

    koitsu Network Guru Member

    The issue has nothing to do with your router, setup, devices, or otherwise. It has to do with how Youtube does load balancing at numerous levels (some DNS, some anycast, some classic LB, some based on what kind of client device they detect through HTTP User-Agent headers, and Internet routing (often asymmetric) plays a huge role to boot). The problem is not with you. Google "Youtube slow" or "Youtube slowdown" and have a look at the tens of thousands of threads that have existed within the past year or so -- it's only going to get worse as time goes on. Think about how many people watch/use Youtube simultaneously across the globe. People's home connections today easily supersede the amount of bandwidth video streaming and video hosting providers can offer. There isn't a "bandwidth shortage" per se, but it's more about cost and trying to make do with what you can without spending more (not you, Google).
  3. bhall7

    bhall7 LI Guru Member

    If it isn't me, or my connection, then why is it that when I switch my iPhones to 4G LTE I have no problems with YouTube playback? But, the second I jump on my local WiFi, things start to slow down? As you mentioned, I too have poked around and have seen the universal complaint by many users about how YouTube is slow. At first, I thought it may be because I use OpenDNS for content filtering for my family (DNS settings pushed down to all DHCP clients from the Tomato). So, I disabled OpenDNS and used my ISPs DNS servers, but still experienced YouTube slowness.
  4. duprade

    duprade Serious Server Member

    I have a similar experience .. When I connect my iPhone 4S to WIFI ... youtube is slow .... but when I disable WIFI on the iPhone and connect through AT&T "4G" ... the videos load right away. Even when I play a video through WIFI on the iPhone ... it will take longer to download the whole video, than if I'm doing it through AT&T data network.
    bhall7 likes this.
  5. bhall7

    bhall7 LI Guru Member

    duprade, do you have Time Warner Cable as your ISP? In my research, I have found that this is a common problem among TWC subscribers. Apparently, it can be solved by blocking, which is a bandwidth throttling/peering server common to Time Warner Cable subscribers. I can't wait to get home tonight to test this out to see if it fixes the issue!
  6. duprade

    duprade Serious Server Member

    Hi bhall, I live in Miami and have Comcast.
  7. koitsu

    koitsu Network Guru Member

    The issue has nothing to do with your router, setup, devices, or otherwise. It has to do with how Youtube does load balancing at numerous levels (some DNS, some anycast, some classic LB, some based on what kind of client device they detect through HTTP User-Agent headers, and Internet routing (often asymmetric) plays a huge role to boot). The problem is not with you.
  8. bhall7

    bhall7 LI Guru Member

    I watched the raw HTTP traffic while loading several videos from my iPhone. I found that it hits redirector.c.youtube.com, which then sends the request off to any of a handful of different servers depending on the video being requested. Here are just some of the many server names I logged:

    r2---sn-q4f7dm7e.c.youtube.com ​
    r3---sn-o097zue6.c.youtube.com ​
    r16---sn-q4f7dm7k.c.youtube.com ​
    r17---sn-q4f7dm76.c.youtube.com ​

    When I did an IP geo search on all of the above, they all show the location as Mountain View, CA (Google HQ), but for all we know, they could really be located anywhere in the world. I wonder if the "rN" prefix refers to the data center location (found this map of Google data centers), which might explain why some of the videos I loaded worked and others didn't. From what I could tell, videos are hosted on a particular node, which may or may not have to do with geography--it's hard to tell. You can do a similar sort of forensic analysis on the HTTP traffic in Chrome by opening the built-in debugger (Command + Option + i on OS X; CTRL + Shift + i on Windows) and clicking the Network tab, then loading a YouTube video. The wonderful Firebug extension for Firefox will also show you the same thing.

    For example, the following YouTube video: when viewed in Chrome on my MacBook fetches its content from r10---sn-q4f7dm7r.c.youtube.com. The video plays back beautifully without any hiccups. The same video, whether viewed from the YouTube app on iOS 6.1 or on the YouTube mobile web site in Safari on iPhone 5, fetches its content from r20---sn-q4f7dm7z.c.youtube.com, and the video doesn't playback at all (either via the iOS app or the web interface in Safari).

    I don't know that any of the above information is at all helpful or gets us any closer to a better solution, but I can't help digging around! Whatever Google is doing with YouTube caching, content delivery, and load balancing, it sure isn't working very well, as evidenced by the endless postings by others found all over the interwebz. Bottom line: koitsu is spot on--depending on a lot of different factors, Google forwards you to a random server that may or may not be optimal for you. It's kind of comical in a sad way how broken it is.

    If there were a way to dynamically modify the HTTP request to spoof the user agent and all of the other factors to make a request coming from the iPhone/iPad look like it was a regular desktop client, that might produce better results (I get great results when I view from a regular notebook or desktop).

    I suppose it's a futile struggle to try to come to any solid conclusions. Thank you for entertaining my ramblings.
  9. Toastman

    Toastman Super Moderator Staff Member Member

    Where I live, browsing on a mobile device is just painful. I am so tired of trying to
    explain the reasons to people but when they see it working fine on my own PC
    they will simply not listen. I suppose no one can blame them for that!
    StarClout and bhall7 like this.
  10. koitsu

    koitsu Network Guru Member

Share This Page