In August 2011, Facebook introduced Messenger, an iPhone and Android app that spun off the social network’s chat feature into a stand-alone experience. Meant to compete with texting plans from wireless carriers—and made possible by Facebook’s acquisition of a messaging startup called Beluga—the app was an instant hit. And it’s been an enduring one: Messenger hit one billion monthly active users in 2016 and was the world’s most-downloaded app in 2019, according to App Annie.
Along the way, it supplemented its original text-based conversations with everything from voice and video calls to games to payments to bots to Snapchat-style stories. As its user base and ambitions grew, so did its size. What had been a wafer-thin 8.5MB download in 2012 expanded to take up 130MB of space on users’ iPhones. That’s about twice the size of WhatsApp, another Facebook messaging app that offers many similar features.
But now Facebook has put the iOS version of Messenger on an extreme weight-reduction plan. By rewriting it from scratch, it’s shrunk Messenger’s footprint on your iPhone down to an eminently manageable 30MB, less than a quarter of its peak size. According to the company, the new version loads twice as fast as the one it’s replacing. The update is so compact that Facebook was able to quietly build it into the existing version and test it by exposing it to a subset of users. (It will arrive in stand-alone form for the rest of us gradually over the coming weeks.)
As a giant piece of programming, the downsizing is even more dramatic. Messenger is going from 1.7 million lines of code to 360,000, for an 84% reduction.
Code-named “LightSpeed” and announced at Facebook’s F8 conference in April 2019, the new version was originally supposed to ship last year; completing it was an even more vast undertaking than Facebook had anticipated. VP of Messenger Stan Chudnovsky compares the effort to remodeling a house and discovering new problems when contractors open up the walls: “You can only find stuff that is worse than you originally anticipated,” he says.
Now, you may not have noticed Messenger getting more portly over the years, especially if you have a new (or at least newish) smartphone with processing power and memory to spare. However, plenty of people like to hold onto aging iPhones that may struggle with apps that are too huge. For them, the old Messenger could be noticeably sluggish.
“On a low-end device, you’ll see very quickly that the performance [of the new version] is visibly different,” says Messenger director of engineering Mohsen Agsen, one of the people responsible for the sweeping rewrite. “Even on a high-end device, you’ll see a little bit more consistency. A high-end device starts behaving like a low-end device if you’ve just finished running a big game or loading the camera and the phone is under memory pressure. So then the size of the app that you’re about to run next matters.”
Given that people may hop in and out of Messenger dozens of times a day, zippy performance is an overarching imperative, contends Agsen. If Facebook’s family of apps is like a lineup of cars, he says, “some of them are the sedans, and they need to be the sedans. We really felt that messaging really should be more of the sports car, dominated by speed and reliability at its core.”
Messenger director of engineering Mohsen Agsen
We scrutinized every line of code and every millisecond.”
LightSpeed’s strategic importance to Facebook runs deeper than any resulting uptick in minutes spent. Mired in scandal, embarrassment, and controversy relating to its stewardship of user information and abuse of its network by bad actors, the company sees Messenger as a crucial part of rebuilding trust.
In March of last year, CEO Mark Zuckerberg posted a 3,200-word manifesto, “A Privacy-Focused Vision for Social Networking.” It outlined plans to integrate the company’s portfolio of services—its namesake social network, Messenger, Instagram, and WhatsApp—and increase the emphasis on private messaging over more public sharing. “In a few years, I expect future versions of Messenger and WhatsApp to become the main ways people communicate on the Facebook network,” he wrote. “We’re focused on making both of these apps faster, simpler, more private and more secure, including with end-to-end encryption.”
Almost a year later, Facebook still hasn’t shared much in the way of details about how—and when—it will turn this vision into reality. And in its debut form, LightSpeed doesn’t introduce encryption or new integrations with other services. But having replaced an old, bloated, and crufty codebase with a streamlined, modern update, the company is in better shape to reimagine the Messenger experience henceforth. “This is a brand-new platform that allows us to do many things we wouldn’t have been able to do before,” says Chudnovsky.
The same only different
For now, Messenger isn’t undergoing a radical reinvention in terms of the aesthetics, functionality, and organization that users experience. The app still looks a lot like Messenger 4, the simplified version that Facebook deployed in October 2018. The new version is simpler still. It removes the Discover tab—which showcased businesses with a Messenger presence—and revamps the People tab with a splashier look and greater emphasis on the stories feature. But those revisions weren’t part of the LightSpeed mandate, just changes that Facebook was ready to make as part of Messenger’s ongoing evolution.
Indeed, one of the things that made LightSpeed so ambitious was that Facebook wanted to greatly reduce Messenger’s size without eliminating functionality. (It did temporarily yank a few features, such as inbox read receipts and polls, but plans to bring them back before long.) The company also couldn’t retool the aspects of the service that are powered by Facebook’s data centers, since the back end had to continue to operate with Messenger’s Android and web versions, neither of which are part of the LightSpeed update.
A large part of shrinking Messenger down, the company concluded, would require ruthlessly eliminating redundancies in its code. The good news was that there were all sorts of redundancies to target, in part because Messenger is the work of a large team that had traditionally been decentralized. (The most specific Facebook gets is that “hundreds” of engineers now work on the product; by contrast, Beluga, the minimalist messaging app that served as the basis of the original 2011 version, had been created by a three-person team.)
Messenger designer Alice Chuang
For us, LightSpeed is kind of like our Marie Kondo moment.”
Did engineers ever bristle at having to adopt more generalized functionality that wasn’t crafted for their exact purposes? “Of course! Absolutely!” laughs technical program manager Akila Kesavasamy. But “once people were rallied around the spirit of what we were trying to build and why we were doing LightSpeed, it was magical how the teams actually came together.”
Though the goal wasn’t to wind up with a Messenger that looked strikingly different, this subtraction of parts under the hood did lead to Facebook’s designers performing a comparable streamlining of interface elements. That was a useful clutter-reducing exercise in itself: “For us, LightSpeed is kind of like our Marie Kondo moment,” says product designer Alice Chuang.
According to Chuang’s colleague Mike Arndt, the design rationalization involved creating templates that imposed consistency on the Messenger experience wherever possible, with some degree of customization available for special circumstances. “When you see a four-in-one or eight-in-one screwdriver, you know how to handle screws,” he says by way of comparison. “But every once in awhile, there’s a flathead or a Phillips or a hex bolt.”
All of this effort didn’t just demand careful coordination among Messenger staffers at Facebook’s Menlo Park headquarters and satellite offices in Seattle, New York, and London. Facebook employees outside the Messenger organization—for instance, those responsible for the payment and Marketplace features—also had to buy in and update their work. “There’s like 40 different partner teams actually that most of us are not even aware of,” says Kesavasamy.
Along with weeding out instances of repetition, Facebook was careful not to invent new solutions to problems that had already been solved. It even un-invented some solutions it had built in the past. As Messenger had expanded its capabilities over the years, engineers had stuffed it full of custom microservices that talked directly to servers. That’s a typical development path for a big, sophisticated app, but these microservices needed to perform such complex data-wrangling tasks as managing caches. With LightSpeed, the company found that it could replace much of this functionality with the widely used SQLite open-source database. “We made a bigger bet on it,” says Agsen. “Things we would have done in memory, we put in a database.”
Not your everyday update
Almost any app that’s been around for as long as Messenger would probably benefit from as thorough an overhaul as LightSpeed. But in my discussions with some of the people responsible for the new version, they emphasized how rare a decision it is to reengineer an existing product as thoroughly as they have. Agsen and Endres evoked the ground-up operating-system transitions that Windows and the Mac went through years ago—points of reference that make particular sense when you learn that both men worked at Microsoft in the 1990s.
Now that the new version of Messenger is starting to reach users, I wondered if Facebook planned to give any of its other offerings a similarly dramatic revision. The company says that it has no plans to apply the same degree of tough love to the Android version of Messenger, a download that currently takes up 40MB-45MB depending on your device. But it does intend to incorporate some of the techniques it developed for LightSpeed in future Android updates.
How about other products—maybe even the big blue Facebook app itself, which, at its current iPhone download size of 225.3MB, is not exactly a featherweight? The company isn’t saying. But one LightSpeed lesson that seems relevant to Facebook’s plans to embrace privacy and integration across its suite is that unprecedented projects require a unique degree of project management. “Could we have done more planning? Probably,” acknowledges Messenger chief Chudnovsky.
Just keeping Messenger small and fast as it adds new features sounds like it will require effort. Evenson says that the new version provides a solid foundation. “There’s one way to do everything now,” he says. “And by enforcing that, we hope to keep the app in the same state moving forward.”
“We’ve learned a lot, and we’ve spent a lot of time thinking about the sustainability of the performance, and the team is investing in that,” adds Endres, who’s careful to caution that “a year is an awfully long time in the software industry.” If Messenger never balloons back into a 130MB monster, we’ll know that LightSpeed is a permanent state of mind rather than a temporary fix.