Facebook parent Meta now encourages its engineers to use C++ and Rust programming languages for coding high-performance backend services.
Rust, initially developed within Mozilla, is joining Meta as an officially endorsed server-side language. Adding Rust as a supported language was a "very careful and deliberate decision" to help engineers pick the best language for their projects, according to Meta.
"Meta is committed to provide long-term support for programming languages used by our developer, and this move signals Meta's long-term commitment and support for the Rust language ecosystem," it said.
Here's a list of the most popular programming languages and where to learn them
Read nowIts status as a supported language is the next step in Facebook's adoption of Rust. It joined the Rust Foundation in April 2021 as a platinum member with AWS, Google, Huawei, Microsoft and Mozilla.
SEE: What is Coding and What is it Used For? A Beginner's Guide
Facebook has used Rust since 2016, a year after version 1.0 of the language arrived. Rust is the main language it used for the Diem (formerly Libra) stablecoin blockchain, its Mononoke source control server, and Move, Meta's "new, secure programming language to be used for the blockchain."
Choosing Rust over C++ was a big decision for Facebook since most of its back-end code was written in C++, making it the obvious choice.
Rust adoption gained momentum after Mononoke was deemed a success, drawing engineers with Python and JavaScript backgrounds, according to Facebook.
Now, Rust is a primary supported server-side language along with Hack, C++, and Python.
Rust is now recommended for writing command line interface (CLI) tools and "performance-sensitive back-end services".
"There's a rapidly increasing Rust footprint in our products and services, and we're committing to Rust long-term and welcome early adopters," says Eric Garcia, a Meta software engineering manager.
Hack is preferred for business logic and "relatively stateless" applications, while Python remains "the language of choice" for data science, ML applications, and Instagram.
Meta also supports Java, Erlang, Haskell, and Go for specific use cases.
Meta says it carefully considers the question of supporting a new language because of the risks it involves to efficiency, productivity and developer time. It prefers to keep the list narrow to reduce the number of core libraries, reduce complexity when building security and privacy features, avoid language fragmentation to reduce operational risk, and developer tooling support.
Rust's advantage at Facebook is that it easily interoperates with its C++ code for communicating with back-end systems that services are built on.
"We need developers to be able to use these libraries safely and easily without sacrificing the benefits that Rust offers. Inversely, if we want to see Rust components integrated with our larger C++ binaries, we need smart runtime interoperability in asynchronous code. Facebook's servers are highly distributed and heavily threaded. Rust tasks need to play nicely on a C++ threadpool and safely share synchronization primitives and I/O resources," Meta engineers recently explained.
AWS has fostered Rust in its organization for building infrastructure software and encourages it for its reduced impact on energy consumptioncompared to Python and even Java . AWS services built on Rust include Firecracker, the technology behind its Lamba platform for containerized apps, Amazon Simple Storage Service (S3), Elastic Compute Cloud (EC2), its CloudFront content delivery network, and Bottlerocket, a Linux-based container OS.
SEE: Cloud computing security: Where it is, where it's going
Google allows contributors to the Android Open Source Project to write new Android code in Rust, but the Chrome team has opted to stay with C++ over Rust as the primary language for the foreseeable future. Microsoft has been experimenting with Rust for Windows as an alternative to C and C++ since 2019, while the Azure team has embraced it for coding in the cloud.
Rust isn't as widely used as Python and Java, but it is consistently rated "the most loved" programming language in Stack Overflow's annual developer surveys. Even ransomware gangs are rewriting their malware in Rust.