Domain Registration

Rust programming language: We want to take it into the mainstream, says Facebook

  • April 29, 2021

Facebook has joined the Rust Foundation, the organization driving the Rust programming language, alongside Amazon Web Services, Google, Huawei, Microsoft, and Mozilla. 

Facebook is the latest tech giant to ramp up its adoption of Rust, a language initially developed by Mozilla that’s become popular for systems programming because of its memory safety guarantees compared to fast languages C and C++. Rust is appealing for writing components like drivers and compilers. 

The Rust Foundation was established in February with initial backing from Amazon Web Services, Google, Huawei, Microsoft, and Mozilla. Microsoft is exploring Rust for some components of Windows and Azure while Google is using Rust to build new parts of the Android operating system and supporting an effort to bring Rust to the Linux kernel

Facebook’s engineering team has now detailed its use of Rust beginning in 2016, a year after Rust reached its 1.0 milestone

“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,” Facebook’s software engineering team said. 

Facebook has joined the Rust Foundation at the highest tier alongside its tech giant peers, giving it a spot on the foundation’s board.  

“Facebook has embraced Rust since 2016 and utilizes it in all aspects of development, from source control to compilers,” says Joel Marcey, Open Source ecosystem lead at Facebook, and now board director at the Rust Foundation. 

“We are joining the Rust Foundation to help contribute to, improve and grow this language that has become so valuable to us and developers around the world. We look forward to participating with the other foundation members and the Rust community to make Rust a mainstream language of choice for systems programming and beyond.” 

Facebook has used Rust in a number of projects, including its controversial Libra cryptocurrency and blockchain effort, which is now governed by the Diem Association. Facebook is now just a core member of that association via its Novi digital wallet. Facebook notes that the Diem blockchain is primarily written in Rust. 

Before that Facebook turned to Rust for Mononoke, a source control server, in a 2016 project. 

“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,” Facebook engineers note. 

“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++.”

Adopting Rust was a big and risky decision due to the time required to learn a new language and the amount of time already invested in projects written in another language, as Facebook software engineer, Jeremy Fitzhardinge, explained at a talk at RustConf 2019.  

He liked Rust because of its ability to detect major bugs at compile time was orders of magnitude cheaper than discovering them when code was running on production systems. 

After proving a successful Rust transition for Mononoke, developer interest within Facebook grew. Facebook notes many of the engineers attracted to Rust came from Python and JavaScript backgrounds. That’s notable, given these are the two most popular programming languages. Python is popular for machine learning and backend systems development, while JavaScript rules web front end systems.   

“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,” Facebook notes. 

In 2020, Facebook created a Rust team in its Programming Languages unit, which is also responsible for its work on C++ standards and toolchains. 

That team focussed on Rust toolchains, code reviews of the Rust compiler, and ensuring Rust’s safe interoperability with C++ code. 

“We have a vast amount of C++ code that is necessary to communicate with the back-end systems that services are built on. We need developers to be able to use these libraries safely and easily from Rust without sacrificing the benefits that Rust offers,” Facebook explains.

“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. 

That team also supported and quickly adopted C++20’s coroutines, the C++ standard finalized by the Working Group 21 (WG21) in September. 

“Bringing Rust into the game will be an extension of that and will build on the excellent work already happening in the Rust asynchronous library stack.” 

Article source: https://www.zdnet.com/article/rust-programming-language-we-want-to-take-it-into-the-mainstream-says-facebook/#ftag=RSSbaffb68

Related News

%d bloggers like this: