Squid slowing youtube video (solved I think)?

  • I'm at the end of my rope.
    Let me explain. I've noticed that when playing any youtube content it seems to be throttled to say 1.5Mbit.
    If I bypass squid by entering the IP address of the computer that's watching youtube the throttling disappears.
    This doesn't help me much as that IP isn't regulated by squid(guard) for anything else.

    This is my current setup.

    Intel Pentium 4 @ 3.06GHz
    Kernel version FreeBSD 7.2-RELEASE-p5 #0 Sun Dec 6 23:20
    80GB Sata HDD
    512MB DDR Memory
    VIA VT6102 Rhine II 10/100BaseTX (PPOE, ADSL 7Mbit Down, 700kbps up)
    3Com 3c905-TX Fast Etherlink XL (LAN side)

    Installed Packages
    File Manager
    IP-Blocklist (disabled)
    Squid (Proxy interface LAN, Log rotate 2 days, Transparent Proxy, Memory cache size=64mb, HDD cache= 1GB, everything else default)
    squidGuard (blacklist = http://www.shallalist.de/Downloads/shallalist.tar.gz, blocking typical porn stuff)

  • Netgate Administrator

    Well here's a howto for deliberately throttling youtube:

    Squid has a feature called "delay pools" which can be used to throttle YouTube. Just add the following to squid.conf:
    delay_pools 1
    delay_class 1 1
    acl youtube dstdomain .youtube.com
    delay_parameters 1 250000/250000
    delay_access 1 allow youtube
    This limits YouTube to 1 Mbps of your valuable bandwidth.

    So maybe check that don't have this in place.


  • This is all that I'm seeing.

    Always allow localhost connections

    http_access allow localhost

    quick_abort_min 0 KB
    quick_abort_max 0 KB
    request_body_max_size 0 KB
    reply_body_max_size 0 allow all
    delay_pools 1
    delay_class 1 2
    delay_parameters 1 -1/-1 -1/-1
    delay_initial_bucket_level 100

    Throttle extensions matched in the url

    acl throttle_exts urlpath_regex -i "/var/squid/acl/throttle_exts.acl"
    delay_access 1 allow throttle_exts
    delay_access 1 deny all

    Setup allowed acls

    Allow local network(s) on interface(s)

    http_access allow localnet

    Custom options

    redirect_program /usr/local/bin/squidGuard -c /usr/local/etc/squidGuard/squidGuard.conf
    redirector_bypass on
    redirect_children 3

    Default block all to be sure

    http_access deny all

  • havp will do it if you have it set to scan for video streams

  • Are you saying that if I have havp installed it could cause this?

  • yes

  • Netgate Administrator

    I'd check the contents of /var/squid/acl/throttle_exts.acl


  • I checked the contents of /var/squid/acl/throttle_exts.acl and it's empty.

    I also do not have havp installed.

  • at the bottom of the havp proxy settings page there is this option:

    Scan media stream
    Check this for scan media (audio/video) stream. Use this for additional scan exploits for players.

    if this is checked it will download the stream to pfsense, scan it using havp, then forward it to the requesting device.

  • Netgate Administrator

    Do you get throttling on other sites, viddler, dailymotion etc?
    If so then it's a problem with streaming flash rather than youtube. It seems that youtube changed it's policy to allow local caching of video a while back where as other sites may not.

    You may have to create a rule to stop squid caching flash/video.


  • No. Other video sites don't seem to be affected. Downloads beautifully at full connection speed.

    Am I correct in assuming that "VideoCache" for squid would not help in this situation?

  • What version of the squid package are you using?  I used to see similar problems, but for whatever reason they seem to be resolved in the most recent package.

  • I removed squidguard to see if that would have any effect and nothing changed.
    Then removed squid (ver. 2.7.9_4) and everything work nice and fast with youtube.
    Installed squid3 alpha for the heck of it and youtube works nice and quick. But it seems as though squidguard
    doesn't play nice with squid3.

  • I even went so far as to reinstall pfSense on this box.
    Does anyone else experience poor YouTube performance like this?
    If not, maybe it's some kind of hardware glitch.

  • Netgate Administrator

    Just to be straight you have:
    A fresh install of pfsense 1.2.3 release.
    Squid package installed.
    Bandwidth throttling on Youtube only.

    You may be able to prevent caching of youtube. E.g. http://www.comfsm.fm/computing/squid/FAQ-7.html#ss7.8

    However youtube uses a number of domains to stream from so you may want to prevent caching of flash video instead.

    I'm no expert on this though! Maybe?

    acl NOCACHE rep_mime_type -i video/flv
    no_cache deny NOCACHE

  • I tried reinstalling pfSense again and configuring the bare minimum. Only package installed is squid.
    I even disabled the onboard VIA Rhine ethernet and install a new Intel gigabit card thinking that might do it.

    I also tried modifying the squid.conf to include the no_cache code;

    acl NOCACHE rep_mime_type -i video/flv
    no_cache deny NOCACHE

    Made no difference.

  • I'm not sure if this would be a bug of some sort but I believe that I've fix this issue.
    I ended up playing with the "Hard disk cache system". I initially changed it to null and rebooted to see if that would change anything.
    Loaded a 720p YouTube video no hiccups and full 7Mbit speed. Then I figured I'd change it back to ufs and rebooted again.
    Now the YouTube video should be stalling right? Cause this is what it was set at originally.
    But It's still working without hiccup or any sort of throttling.

  • Netgate Administrator

    Hmm odd, sounds like something hasn't changed. Did you try several videos to make sure it's not cached on your local machine?
    I'm pretty sure the no_cache option is the way to go but like I said I'm no expert and I pretty much just pulled that code out of the air! You need someone more experienced to point out why it made no difference. (probably some syntax problem).


Log in to reply