For AWS, the Rust language opens new perspectives for programming


Just seven years ago, the Rust programming language reached version 1.0, making it one of the youngest languages ​​and a very promising language for large codebases written in C and C++. Today, Amazon, Google and Microsoft support this language, which was originally a personal project of Graydon Hoare before becoming a research project at Mozilla in 2010. For teams in the Cloud branch of Amazon, Amazon Web Services (AWS), it’s very simple: Rust stands out above all because it is the least energy-intensive programming language.

Rust is however not as popular as Java, JavaScript or Python. However, it has established itself as an essential language for building systems such as the Linux kernel, Windows, Chrome and Android. A founding member of the Rust Foundation, AWS is an early supporter of Rust and has even launched a dedicated recruiting campaign to curry favor with developers specializing in the language.

It must be said that the latter has arguments to make. Rust indeed allows developers to avoid a multitude of memory-related flaws, common to C/C++, which ultimately cost companies in security updates. The language got its most visible support when Microsoft revealed that it was experimenting with it for Windows, mainly to avoid memory bugs.

Rust, an environmental revolution?

For Shane Miller and Carl Lerche, both Rust advocates and engineers at AWS, the language isn’t just good at memory safety and mitigating security vulnerabilities. According to them, it is a much greener language than Python and Java. In this sense, he supports the plan concocted by Amazon to make its data centers less harmful to the environment, the company aiming for its data centers to be completely renewable by 2025.

Remember that data centers represent 1% of global energy consumption, or about 200 terawatt hours of energy per day, and the programming languages ​​used can also have an impact on energy consumption.

AWS’ Rust-based services include Firecracker, the technology that powers its Lamba serverless platform for containerized applications, Amazon Simple Storage Service (S3), Elastic Compute Cloud (EC2), its CloudFront content delivery network, and Bottlerocket, a Linux-based container operating system. “It’s no surprise that C and Rust are more efficient than other languages. What is shocking is the magnitude of the difference. Widespread adoption of C and Rust could reduce computer power consumption by 50%, even with a conservative estimate,” says Shane Miller, citing a study showing the relative energy efficiency of languages, from Google’s C to Go. , Lua, Python, Ruby and old Fortran.

“Rust offers the energy efficiency of C without the risk of undefined behavior. We can cut power consumption in half without losing the benefits of memory security,” he says. As an example, he cites the performance of an application from cybersecurity firm Tenable that was previously written in JavaScript, but is now written in Rust. The Rust application outperforms JavaScript in CPU performance, cutting latency in half, CPU usage by 75%, and memory usage by 95%.

A dry and difficult language to grasp

Popular messaging app Discord has also moved to Rust, having originally been built on Python, Google’s Go, and Elixir. “Because Go is a garbage collector (GC) language, when objects are created and freed, the GC must, from time to time, stop program execution and perform a pass collecting crumbs, ”explains on the side of AWS. Rewriting this service in Rust would have made it 10x faster and drastically reduced latencies, which translates into less server count and, therefore, less energy.

“Rust is not the first effective language. C has been around for a long time, but Rust is the first mainstream programming language that is efficient without sacrificing security. 70% of all high-severity security vulnerabilities written with C and C++ are due to memory insecurity, and Rust gives you efficiency without feeling like you’re playing with fire,” says Shane Miller.

Still, Rust is not without its drawbacks, in particular its learning difficulty. It takes three to six months of study for experienced engineers, supported by access to subject matter experts, to become productive with Rust, note Shane Miller and Carl Lerche. “Some engineers have compared learning Rust to learning how to eat its vegetables, and while many of them love it once they’re productive, many engineers decide not to learn it or give up effort before becoming productive. Rust’s potential impact on sustainability and safety will only materialize if we turn broccoli into a brownie. ” An entire program.

Source: ZDNet.com





Source link -97