A recent post on the AWS Open Source blog announced that AWS “is investing in the sustainability of Rust, a language we believe should be used to build sustainable and secure solutions.”
It was written by the chair of the Rust foundation (and leader of AWS’s Rust team) with a Principal Engineer at AWS, and reminds us that Rust “combines the performance and resource efficiency of systems programming languages like C with the memory safety of languages like Java.”
But there’s another reason they’re promoting Rust: Worldwide, data centers consume about 200 terawatt hours per year. That’s roughly 1% of all energy consumed on our planet… [C]loud and hyperscale data centers have been implementing huge energy efficiency improvements, and the migration to that cloud infrastructure has been keeping the total energy use of data centers in balance despite massive growth in storage and compute for more than a decade… [I]s the status quo good enough? Is keeping data center energy use to 1% of worldwide energy consumption adequate..? [Will] innovations in energy efficiency continue to keep pace with growth in storage and compute in the future? Given the explosion we know is coming in autonomous drones, delivery robots, and vehicles, and the incredible amount of data consumption, processing, and machine learning training and inference required to support those technologies, it seems unlikely that energy efficiency innovations will be able to keep pace with demand…
[J]ust like security, sustainability is a shared responsibility. AWS customers are responsible for energy efficient choices in storage policies, software design, and compute utilization, while AWS owns efficiencies in hardware, utilization features, and cooling systems…. In the same way that operational excellence, security, and reliability have been principles of traditional software design, sustainability must be a principle in modern software design. That’s why AWS announced a sixth pillar for sustainability to the AWS Well-Architected Framework. What that looks like in practice is choices like relaxing service-level agreements for non-critical functions and prioritizing resource use efficiency. We can take advantage of virtualization and allow for longer device upgrade cycles. We can leverage caching and longer times-to-live whenever possible. We can classify our data and implement automated lifecycle policies that delete data as soon as possible. When we choose algorithms for cryptography and compression, we can include efficiency in our decision criteria.
Last, but not least, we can choose to implement our software in energy efficient programming languages.
There was a really interesting study a few years ago that looked at the correlation between energy consumption, performance, and memory use…. What the study did is implement 10 benchmark problems in 27 different programming languages and measure execution time, energy consumption, and peak memory use. C and Rust significantly outperformed other languages in energy efficiency. In fact, they were roughly 50% more efficient than Java and 98% more efficient than Python. It’s not a surprise that C and Rust are more efficient than other languages. What is shocking is the magnitude of the difference. Broad adoption of C and Rust could reduce energy consumption of compute by 50% — even with a conservative estimate….
No one developer, service, or corporation can deliver substantial impact on sustainability. Adoption of Rust is like recycling; it only has impact if we all participate. To achieve broad adoption, we are going to have to grow the developer community.
That “interesting study” cited also found that both C and Rust execute faster than other programming languages, the blog post points out, so “when you choose to implement your software in Rust for the sustainability and security benefits, you also get the optimized performance of C.”
And the post also notes Linus Torvalds’ recent acknowledgement that while he really loves C, it can be like juggling chainsaws, with easily-overlooked and “not always logical” type interactions. (Torvalds then went on to call Rust “the first language I saw which looked like this might actually be a solution.”)
The Rust Foundation is a non-profit partnership between Amazon Web Services (AWS), Google, Huawei, Microsoft, and Mozilla.