Optimize network throughput on your Apple TV

This is specially helpful if you are using your Apple TV wireless adapter instead of plugging it directly to the network with an Ethernet cable.

This small tweak assumes that you already have sshd access to your Apple TV, if not please check out AwkwardTV on how to do that.

I had some problems watching HD DivX files in my AppleTV, they were skipping frames and freezing in the most awkward moments, I have all of my files in a mac mini and shared on the network using AFP. The files are mounted in the Apple TV using the ATVFiles plugin and the aTV-ShareMounter plugin.

What needs to be added to give the network buffer enough buffer space on the network is tweak the kernel options at startup, that can be done as in Mac OS X editing the file /etc/sysctl.conf which in the Apple TV version of Mac OS X does not exist by default, you’ll have to create it, don’t worry I’ll put here two quick ways to do it.

How to edit /etc/sysctl.conf (if it does not exist)

First Option – The fast kamikaze strategy (will work for everybody, but be really careful!).

Second Option – The slow wise monk strategy (this will work in all cases)

Edit a sysctl.conf in your computer (just be sure that if you’re in a Posix system you’re not editing your local /etc/sysctl.conf).

Add these values to the file

Copy it to your Apple TV through scp and make sure it ends up in its correct position at /etc/sysctl.conf on your Apple TV

The changes you do will be available on the next reboot, I find it better to do it this way so you’re 100% sure that all the changes are loaded at the same time.

I hope this solves Leo Laporte streaming problems to his Apple TV ;)

9 thoughts on “Optimize network throughput on your Apple TV

  1. DJLM says:

    Thank you so much, I have been using the TV in exactly the same way, AFP files played over it’s Airport interface, and suffering the same annoying issues… You read my mind exactly as to what I suspected the problem was but you saved me looking up and figuring out what to set the variables to!

    Many thanks!!!

  2. DJLM says:

    Just wondering, are any of these values able to be safely increased any further? I’m down to maybe one skip per video I watch, so it wouldn’t need to be much of an increase?

    Thanks!

  3. You forgot to put the “sudo” in front of the echo commands. An alternative to the following:

    sudo echo “kern.ipc.somaxconn=512\

    net.inet.tcp.mssdflt=1460\

    net.inet.tcp.sendspace=98304\
    
net.inet.tcp.recvspace=98304\

    kern.ipc.maxsockbuf=1048576\
    
net.inet.udp.maxdgram=57344\

    net.inet.udp.recvspace=42080\
net.local.stream.sendspace=98304\
net.local.stream.recvspace=98304\

    net.inet.tcp.delayed_ack=0\

    net.inet.tcp.rfc1323=1\

    net.inet.tcp.rfc1644=1\

    net.inet.tcp.newreno=1” > /etc/sysctl.conf

  4. lynxman says:

    @Graham Booker

    Oh thanks for the correction, I’ll modify the article accordingly :)

    @DJLM It should be okay to increase them a bit, but I found that to have more dangers than gains, some of this kernel parameters don’t play well when increased beyond this limits so please make sure that you have a way to go back to your previous settings!

  5. Pingback: somaxconn

Leave a Reply

Your email address will not be published. Required fields are marked *