POSTED ON APRIL 29, 2021 TO DEVINFRA, OPEN SOURCE
A brief history of Rust at Facebook
Facebook is embracing Rust, one of the most loved and fastest-growing programming languages available today. In addition to bringing new talent to its Rust team, Facebook has announced that it is officially joining the nonprofit Rust Foundation. Alongside fellow members including Mozilla (the creators of Rust), AWS, Microsoft, and Google, Facebook will be working to sustain and grow the language’s open source ecosystem.
For developers, Rust offers the performance of older languages like C++ with a heavier focus on code safety. Today, there are hundreds of developers at Facebook writing millions of lines of Rust code. And while it’s clear that Facebook is increasingly invested in the future of the language, it’s important to understand how we grew to this point. 
2016–2017: Early use in source control
Our oldest Rust codebase dates to 2016, when the rate of source code changes in Facebook’s monorepo started to encroach on the maximum commit rate that the Mercurial source control management tool could keep up with. In response to this, Facebook’s Source Control team launched a rewrite project called Mononoke with the goal of increasing Mercurial’s commit rate by some additional orders of magnitude to serve Facebook’s thousands of developers and automated processes.
Developing Mononoke in C++ was the obvious choice at first. At the time, Facebook’s back-end codebase was very C++ heavy, meaning Mononoke would have been implemented in C++ by default. But the Source Control team needed to consider the reliability needs of the source control back end. When corruption or downtime can potentially bring services to a halt, reliability is a top priority. That’s why the team chose to go with Rust over C++.
Jeremy Fitzhardinge, a software engineer in production confidence at Facebook, describes this experience in a talk at RustConf 2019.
Mononoke served as a great test bed because it was naturally fairly isolated from other Facebook systems. As long as Mononoke could use the Mercurial protocol to speak with client services and the Thrift protocol to communicate with some storage systems, choosing Rust wouldn’t affect anything outside of the Source Control team’s work.
The Source Control team was willing and able to support itself in any Rust-specific tooling and infrastructure. This played out well, and Mononoke has been the production back end for our monorepo since 2019, successfully scaling over the years.
2017–2019: The adoption curve
With Mononoke as evidence that it was viable and lived up to its claims, over time, other projects considered and adopted Rust as well. At first, these were typically developer tooling projects that didn’t need to integrate with the broader service infrastructure, or small services/daemons that could do their work with just a few handwritten wrappers around some C++ client libraries.
Many of the engineers at Facebook who adopted Rust came from Python and Javascript backgrounds. They appreciated Rust’s combination of high performance with compile-time error detection. As more success stories, such as performance improvements at two to four orders of magnitude, circulated within the company, interest grew in using Rust for back-end service code and exploring its use in mobile apps as well.
2019–2020: Some dedicated support for Rust
From 2017 through 2019, the Source Control team doubled as the unofficial Rust support team within Facebook. But by 2019, the number of Rust developers at Facebook had grown exponentially, to over 100. 
As one significant example of that growth, Rust is the leading language in the development of the Diem (formerly Libra) blockchain, which is overseen by the independent Diem Association. Facebook, through its digital wallet Novi, is a member of the Diem Association. The Diem blockchain is primarily written in Rust, covering 94 percent of the open source codebase. In addition, Move, a new, secure programming language to be used for the blockchain, was developed with Rust.
Given this growth in need, the part-time assistance of the Source Control team wasn’t enough to support the number of teams standing to benefit.
We created a small Rust developer experience team, which dedicates its attention to tooling and integration challenges, such as building themechanism for using the language’s open source package registry ecosystem in production non-Cargo builds. The team formed a central point of contact for Rust developers across the company to unblock use cases, prioritize short-term developer experience concerns, improve core libraries, and generally set the fledgling Rust codebase up for success as it passed the million-line mark.
Onward (2021 and beyond)
At the end of 2020, we re-upped our commitment by launching a Rust team in our Programming Languages organization, the same org responsible for Facebook’s C++ standards work and toolchains.
This team has a longer-term focus beyond immediate developer experience priorities in the context of our codebase. In particular, all contributions to grow and sustain Rust as a healthy and productive language and community are now in scope.
In the short term, this new team is focused on four areas:
Rust’s journey within Facebook is far from finished. This team is small, but it will grow over time as support needs scale. We are excited and optimistic about the trajectory of Rust within Facebook and across the industry. Our plans for work inside Facebook, open source contributions, and more community-oriented work will develop over the course of 2021.
Prev
Reverse debugging at scale
Next
Most of computing’s carbon emissions are coming from manufacturing and infrastructure
Read More in DevInfraView All
SEP 2, 2021
CacheLib, Facebook’s open source caching engine for web-scale services
MAR 3, 2021
Boosting the performance of virtual machines with Jump-Start
FEB 17, 2021
Faster, more efficient systems for finding and fixing regressions
FEB 9, 2021
Minesweeper automates root cause analysis as a first-line defense against bugs
FEB 5, 2021
Open-sourcing Thrift for Haskell
DEC 30, 2020
2020 year in review: Connectivity innovations, faster apps, and progress toward net zero
Related Posts
Oct 14, 2020
Introducing resctl-demo: Better resource control with simulation
Oct 22, 2020
PPL Bench: Creating a standard for benchmarking probabilistic programming languages
Jul 06, 2020
Retrie: Haskell refactoring made easy
Related Positions
Software Engineer, Language
PARIS, FRANCE
Software Engineer, Language
LONDON, UNITED KINGDOM
Front End Engineer
LONDON, UNITED KINGDOM
Software Engineer, Core ML
PITTSBURGH, US
Software Engineer, Core ML
MENLO PARK, US
See All Jobs
Facebook © 2021
About​Careers​Privacy​Cookies​Terms​Help
To help personalize content, tailor and measure ads, and provide a safer experience, we use cookies. By clicking or navigating the site, you agree to allow our collection of information on and off Facebook through cookies. Learn more, including about available controls: Cookies Policy
Facebook EngineeringOpen SourceFacebook Open SourceAndroidiOSWebCore DataData InfrastructureDevInfraProduction EngineeringSecurityConnectivityData Center EngineeringNetworking & TrafficVideo EngineeringVirtual RealityResearch PublicationsML ApplicationsAI ResearchResearch PublicationsWatch Videos