Re: Invent Here, in an out-of-print AWS Re: invented in Las Vegas, Rust Foundation president Shane Miller and Tokio project manager Carl Lerche made a case for using Rust to minimize environmental impact, though its steep learning curve makes it difficult.
Miller is also a senior director of engineering for AWS and Lerche a senior engineer at the cloud giant.
How can Rust save the planet? The answer is that more efficient code requires fewer resources to function, which means less power consumption in data centers and also the environmental impact of manufacturing IT equipment and shipping it around the world. whole.
Shane Miller and Carl Lerche on Rust’s Efficiency and Safety at This Year’s AWS Re: Invent Show in Las Vegas
“Data centers consume… 1% of all the world’s energy,” Miller said, adding that the total energy consumed had changed little in ten years, thanks to advancements in technology and the trend in the cloud. reduce the proportion of unused resources.
The second part of the argument is that Rust is among the most efficient programming languages. The source cited for this is an article from 2017 [PDF] which measured the performance, memory usage, and power efficiency of 27 programming languages, and ranked C as the most efficient, but Rust just behind with just three percent more power consumption. Java uses almost double the energy, C # more than three times, and Python more than 75 times as much, according to the study.
It’s an AWS conference after all
Still, this is not so important since the effectiveness of Rust as a system language is beyond doubt, and Miller and Lerche did not rely solely on this research. Miller also referred to case studies of Discord and Tenable which showed huge efficiency gains.
Waste collection languages are inherently less efficient, Lerche said. Garbage collection is a common way to automate memory management and works by identifying objects that are out of range and freeing their memory.
Why not just use C and C ++? The reason is security and memory related bugs, Lerche said, citing research that “70% of all high-severity security vulnerabilities in C and C ++ software are due to [lack of] memory security.
Rust is revolutionary, he said, because “Rust is the first consumer programming language that is efficient while maintaining memory security.” Lerche explained how Rust achieves memory security using the idea of ownership, based on a concept called affine logic, where each object has one and only one owner at a time.
Ownership rules are checked at compile time, so there is no runtime overload. Concurrency is also easier and safer in Rust than in C or C ++, resulting in additional performance and efficiency gains.
It sounds too easy. All developers and the IT community need to do is migrate to Rust and the code will run faster and more securely, global power consumption will decrease, and AWS will be able to shut down half of its data centers (although we did not hear this last idea during the session).
“But,” Miller said, “if we’re going to meet carbon reduction targets… we’re going to need most of the new software written in energy efficient languages like C or Rust. But Rust has a somewhat noticeable learning curve… we see this adoption but we don’t see it everywhere.
Rust has a somewhat noticeable learning curve… we see this adoption but we don’t see it everywhere
So that’s the elephant in the room, “the famous learning curve,” Miller said. In a recent survey, “Among engineers who said they no longer use the language, 55% cited learning and productivity as the reason for dropping out. Experienced engineers need three to six months of study supported by a subject matter expert before they can be productive with the language.
Is there a possibility of reducing the learning curve? “Part of the challenge with the learning curve isn’t so much that it’s hard to use, but there are gaps in the developer experience, so we’re seeing comments from engineers that come from languages like Java and trying to use Rust which they are uncomfortable with the debugger experience, ”Miller said, in response to our question. “Performance profiling tools aren’t the same they’re used to. And this is an area that we are studying.
“Rust came, historically, as a replacement for C ++,” Lerche added. “It was aimed at this use case. But what we’re seeing is that there are a lot of apps at a higher level.
“If you come to create a service, you go through Rust’s book which is very comprehensive and you will get into lives and traits and trait models and all these concepts that are part of the language but are not required to write a. service.” There are plans, he said, to write simplified documentation which is “what you need to know to write a service.”
Also, further down the compute stack, the code is probably written in Rust, C, or C ++, because when it comes to the Linux kernel, or the core of a database engine, performance and high efficiency are already required.
However, the key point – that inefficient software is costly to the environment as well as to the customer – was well made and to which the IT industry is not paying enough attention, even though Rust did not. is only a small part of the solution. ®