Facebook today open-sourced Augmented Traffic Control (ATC), a Wi-Fi tool for testing how mobile phones and their apps handle networks of varying strength, over on GitHub. ATC simulates 2G, Edge, 3G, and LTE networks, and allows engineers to switch quickly between various simulated network connections.
ATC came into existence after years of attempts, mostly at Facebook hackathons (starting in January 2013), to create test network conditions that simulate what users experience in the real world. Since Facebook wants as many people as possible to access its services at their full potential, it follows that the company should be able to test on wireless connections that more accurately reflect those that many ultimately use.
Until recently, when Facebook built, tested, and launched a new app or feature, it did so on its powerful wireless networks from its various North America offices. A large percentage of Facebook’s users around the world access the social network from a significantly slower and less reliable wireless network. With ATC, the company can optimize its apps for various conditions and allow its software engineers to empathize with people using Facebook in less-than-ideal network environments.
Facebook first tried to recreate a small-scale 2G network using two secondhand base stations and a few mobile phones. Simulating a 2G connection in this way proved successful as Facebook engineers quickly figured out how to make voice calls, send SMS messages, and transmit Internet data. It was ultimately deemed problematic, however, since acquiring reasonably priced cellular radios that would reliably run open source base station software was time-consuming.
Eventually, Facebook pivoted to a Wi-Fi network that could be set to different simulation speeds via a user interface built using Django and Bootstrap. An early version made its way into the Facebook campus wireless network so every engineer could use it, and thus ATC was born. The most common network connections in countries such as Brazil, India, Indonesia, Kenya, Nigeria, and the Philippines were all made available.
Once Augmented Traffic Control became reliable, it was offered to internal teams whose work was affected by network conditions. Facebook says those who used ATC found that it helped save time and pointed out weaknesses in their work.
The company offered a specific example:
The team working on an update to Messenger that would make the app run faster and more reliably used ATC to check how things would run when the network connection wasn’t as strong. They ran automated tests in which the bandwidth connections were changed in order to look at how long Messenger should wait before timing out and how many retries were optimal to send messages.
This information allowed the Messenger team to choose a selection of small A/B tests to run. By zeroing in on where the weaknesses were in different networks, they were able to more quickly identify problems and save development time. The Messenger team also uses ATC APIs in automation to measure call quality on different network configurations.
Engineers were able to reduce their use of A/B tests because they could quickly learn how their code behaved across different network strengths and then recreate the results to ensure it was consistent behavior. In some cases, developers could even recreate issues that would only happen on extremely slow networks, investigate them, and handle those conditions accordingly.
On mobile, tests often can’t start for weeks or months because updates can take a long time to ship, putting off when comparisons can be verified. Because ATC lets developers easily switch from one connection strength to another, a feature can be demoed in real time.
By open-sourcing ATC, Facebook is letting any individual or business test and build for emerging markets and poor networks. The hope is that this will result in better connectivity for everyone, but that can only happen if companies choose to leverage ATC in their daily development.