How did Facebook tweak the infrastructure behind its Messenger applications to focus on mobile speed and performance? Software engineers Jeremy Fein and Jason Jenks detailed the process in a post on the social network’s engineering blog.
Fein and Jenks described how Facebook moved from a pull-based protocol to a push-based protocol, as well as how the social network uses Iris to deliver its users a totally ordered queue of messaging updates, adding that the new protocols lower non-media data usage by 40 percent, and the decreased congestion on the network slashed the number of users who experience errors while trying to send messages by 20 percent.
The two engineers offered the following overview of the process:
Messages have been part of Facebook for many years, beginning as direct messaging similar to email (available in your inbox the next time you visited the site) and then eventually evolving into a real-time messaging platform that provides access to your messages on a number of mobile apps or in a browser. But until recently, the back-end systems hadn’t evolved much from early iterations, and Messenger’s performance and data usage started to lag behind — especially on networks with costly data plans and limited bandwidth. To fix this, we needed to completely reimagine how data is synchronized to the device and change how data is processed in the back end to support our new synchronization protocol.
The version of Messenger we released at the end of last year was the first taste of a “mobile-first” experience for Facebook Messenger. For the past year, while our app-developer teammates have been improving the UI (user interface) and expanding Messenger’s feature set, the Messaging infrastructure team has been working to make the platform more reliable on the back end and use less data. As a result, we created a new Messenger sync protocol that decreased non-media data usage by 40 percent and developed a new service called Iris to power it. By reducing congestion on the network, we’ve seen an approximately 20 percent decrease in the number of people who experience errors when trying to send a message.
When building a high-quality real-time mobile app, it’s important to remember that the network is a scarce resource that must be used as efficiently as possible. Every byte wasted has a very real impact on the experience of the application. By sending less data and reducing HTTPS fetches, apps receive updates with lower latency and higher reliability. Extending desktop-focused infrastructure for a mobile world could work well, but building new mobile first infrastructure with protocols designed for pushable devices offers even better experiences.
Fein and Jenks also called out other engineers for their contributions to the project: Andrew Lutsenko, Andy Chen, Brian Tang, Changle Wang, Domas Mituzas, Harrison Fisk, Jeff Ferland, Olivia Bishop, Pierre-Luc Bertrand, Sachin Kulkarni, Thomas Georgiou and Ting Yang.
Readers: Did you realize that Messenger had undergone such drastic shifts on its back end?