WebPageTest

Testing your website on different browsers? You may be using a Raspberry Pi server farm you never knew existed. Rob Zwetsloot uncovers the details.

one of the most invaluable tools to a web developer is the ability to quickly test your current build on a variety of browsers. Chrome, Firefox, Safari, Internet Explorer (unfortunately), and even mobile browsers need to be tested for. Fortunately, there are a lot of online services that can test it for you. One of these is WebPageTest (webpagetest.org), which just so happens to use a lot of Raspberry Pi boards. “I largely use the Raspberry Pis as POE-powered computers to control smartphones for testing mobile web performance,” its creator Patrick Meenan tells us. “The public instance of WebPageTest has upwards of 80 Raspberry Pis driving the mobile testing for all of the Android and iOS devices.” Patrick began using a similar setup while he was at Google working on web performance. Since then, he’s built it up and deployed it under the WebPageTest website, and the Raspberry Pi was the only option for it.

Perfect with Pi
“There are a ton of things that make them perfect for my use case,” Patrick explains. “They are inexpensive enough that I can use a dedicated Raspberry Pi for each phone or tablet in the lab. “They provide enough power over their USB port to both power and control most devices. They can be powered over PoE, which gives me a way to remotely hard-reboot a device if needed (used to be a regular issue, but it has been months since I have had to reboot a device).” He continues, “The hardware watchdog integrated with my software nicely so the device self-reboots automatically if anything goes catastrophically wrong. “The software and community support are unmatched. I tried other (faster) SBCs, but they all had issues with missing packages or lack of community support.”

Simple and sturdy
It’s a very simple setup beyond the software as well, merely using a PoE HAT on a Pi 3B+ with 3D-printed cases. All the individual phones are hooked up to the Pi so they can perform their testing duties. “They work amazingly well,” Patrick says. “It has gotten to the point where the mobile device testing is as stable as the desktop testing (which runs in VMs [virtual machines]). These days the mobile devices are set-and-forget. The software deployment is now fully scripted and I have a base image that I can clone to new SD cards and have a new device up and running in a few minutes.” For the moment, Patrick’s little Pi farm is holding up well, and is only occasionally maintained via the addition of more powerful models of Raspberry Pi when they become available. He hasn’t even lost an SD card so far – a true testament to the Raspberry Pi, SD cards, and Patrick’s smart coding.