Image: DeGreece/Getty
Facebook parent Meta now encourages its engineers to code high-performance backend services using the C++ and Rust programming languages.
Rust, which was initially developed at Mozilla, is joining META as an officially supported server-side language. According to Meta, adding Rust as a supported language was a “very careful and deliberate decision” to help engineers choose the best language for their projects.
“Meta is committed to providing long-term support for the programming languages used by our developers, and this move signals Meta’s long-term commitment to and support for the Rust language ecosystem,” it said.
Its 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 along with AWS, Google, Huawei, Microsoft and Mozilla.
See: What is coding and what is it used for? a beginners guide
Facebook has used Rust since 2016, a year after the 1.0 version of the language was released. Rust is the main language used for the DIAM (formerly Libra) stablecoin blockchain, its Mononoc source control server, and Move, Meta’s “new, secure programming language used for blockchains”.
Choosing Rust over C++ was a big decision for Facebook because most of its back-end code was written in C++, making it the obvious choice.
According to Facebook, adoption of Rust accelerated after Mononoke was successful, attracting engineers with Python and JavaScript backgrounds.
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”.
“Our products and services have a rapidly growing Rust footprint, and we remain committed to Rust for a long time and welcome early adopters,” says Eric Garcia, 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 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 support developer tooling.
The advantage of Rust over Facebook is that it easily interoperates with its C++ code to communicate with the back-end system on which the services are built.
“We need developers to be able to safely and easily use these libraries without sacrificing the benefits that Rust provides. Conversely, if we look to integrate Rust components with our larger C++ binaries, If we want to, we need smart runtime interoperability in asynchronous code. Facebook’s servers are highly distributed and heavily threaded. Rust functions to run well on C++ threadpools and share synchronization primitives and I/O resources safely. needs to be done,” Meta engineers recently explained.
AWS promotes Rust for building infrastructure software in its organization and encourages it for its low impact on energy consumption compared to Python and even Java. AWS services built on Rust include Firecracker, the technology behind its Lambda 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 included.
See: Cloud computing security: where is it, where is it going
Google allows contributors to the Android open source project to write new Android code in Rust, but the Chrome team has opted to stick 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 adopted it for coding in the cloud.
Rust is not as widely used as Python and Java, but it is consistently ranked the “most preferred” programming language in Stack Overflow’s annual developer surveys. Even ransomware gangs are rewriting their malware into Rust.
For ransomware developers, Microsoft sees the main advantages to using Rust: memory, data type and thread safety; Deep control over low-level resources: a user-friendly syntax; It has multiple mechanisms for concurrency and parallelization, thus enabling fast and secure file encryption; A good selection of cryptographic libraries; And relatively more difficult to reverse-engineer.
Source