aTV Webserver – The Results.

It is amazing what one tweet can start. In 24 hours, we saw nearly 15,000 visitors to a webpage hosted on an Apple TV. The surprising result was that nothing crashed, nothing died, nothing even got warm to the touch. There were times when the web page would time out, but once lighttpd caught back up it kept on with its zippy self.

We’d like to thank everyone who tweeted and blogged about this project. A special thanks goes out to macstories.net, cultofmac.com, osxdaily.com, and slashdot.org.

The web page hosted on the aTV Webserver was a static version of our website with most of the unused CSS and JavaScript removed. The project was ‘out in the wild’ before there was time to fully optimize the page and graphics. The aTV Webserver itself didn’t have scripts running and lighttpd was not writing an access log. An error log was written and we had seven timeout errors at 360 seconds for one of our larger images. Our goal was to keep overhead on the A4 processor as low as possible. There wasn’t much time to write and test a script to watch CPU load without possibly disrupting the test itself. In its place, we watched the CPU load with the ‘uptime’ command, paying specific attention to it during large traffic spikes. CPU load never rose above 2.11.

Measuring traffic was done a few different ways. We gave this page it’s own Google Analytics tracking code. Analytics reported 15,048 visits and 14,525 unique visitors during the 24 hour test period. We also had another javascript based tracking that showed around 250 visitors on the site consistently during the test. The network traffic itself peaked to 7.68Mbps and hovered around 2-3Mbps for the remainder of the test. We had the aTV Webserver running in an office instead of the data center, and there was no real time to make the switch without causing downtime and disrupting the test. The ‘consumer-level’ router seemed to be one of the bottlenecks that we experienced.

If you watched the blog comments and tweets you’d see that some people experienced some slow downs and timeouts. Lighttpd never crashed and the machine kept running during the entire test. The other bottleneck seemed to be the web server software itself. We did mention the errors logged, but it just seemed like if there were enough people trying to bring it down, it would have to work through the requests before returning back to normal.

    The Apple TV really surprised us and there are a few reasons why we think it did so well:

  • It was a single static HTML page stored in the aTV’s flash storage.
  • iOS itself is a minimal OS compared to a traditional Server OS.
    The test would have gone even better if:

  • We put it in the datacenter before tweeting.
  • We optimized the web page and minimized js/css.
  • We had a script to watch the aTV vitals in more detail.
    The Apple TV would be a great webserver if:

  • There were more built in tools like top, vim, etc.
  • Firewall software would be nice.
  • Overall there was more control over the software running.
  • It didn’t require starting from scratch and jailbreaking if a software update was needed.

Comments: