The data centres and data transmission networks powering the digital economy are estimated to be responsible for 2-3% of global energy use (according to the IEA) and projected to increase. To be on track with the IEA’s Net Zero Scenario, it should instead drop by half until 2030. Needless to say, every little contribution will be more than necessary. Yet, we cannot improve what we cannot measure.
Which begs the question: can we measure the energy consumption of our (cloud) apps? This was the starting question of one of my absolute favourite projects of last year. Although it might sound like an easy “yes” (hyperscalers are data-driven by design and most companies have sooo much big data too, don’t they?), the question is a lot more complicated and deeper than that.
If you want to measure and compensate for the consumption of your digital product or you’re starting to build one and want to minimise its energy needs or you’re just excited about the topic, join me and read along!
Warmup Question: What Is Your Web Browser Consuming?
To get a feeling for the magnitude of the challenge, let’s start with a highly simplified version of the above question: can we measure the energy consumption of our Web browser (e.g. Chrome or Safari)? Tracking the overall energy consumption of your entire laptop is easy: the capacity of the battery is known and you can easily measure how long it takes to be empty. Or for an extra accurate measurement, you can always use a watt-hour meter between your laptop and your wall plug.
By contrast, attributing fractions of that consumption to individual apps (like a Web browser) is more difficult and depends highly on your laptop’s hardware components and on how the operating system (e.g. Windows, macOS or Linux) is managing the hardware. Thankfully, as battery-powered devices have taken over the personal compute market, the need for app-level energy measurements and optimisation has resulted in practically every operating system offering some sort of solution to this problem:
In Windows, the Task Manager shows “Power Usage” per application, albeit with only qualitative indicators (e.g. high, moderate, low) out-of-the-box. Nevertheless, it seems to be possible to estimate metrics for the application of your choice based on the Power Metering and Budgeting Infrastructure in Windows and Windows Server operating system versions.
In MacOS, the Activity Monitor provides an “Energy Impact” per application, defined as “a relative measure of the current energy consumption of the app”. For absolute metrics, the command-line utility powermetrics provides the raw data that could be used to estimate each application’s consumption. Nevertheless, Apple cautions that “average power values reported by powermetrics are estimated and may be inaccurate – hence they should not be used for any comparison between devices, but can be used to help optimise apps for energy efficiency”.
In Linux, the command line utility powertop estimates the instantaneous power consumption (in mW) per application.
Coming back to the initial warmup question “Can we measure the energy consumption of our Web browser?”, the obvious answer based on the above is that we can certainly estimate it, but we cannot really measure it in the same way as we do with a watt-hour meter plugged between a device (e.g. laptop) and an outlet.
The main reason: the energy is, in fact, consumed by the hardware and the fraction of consumption attributable to a single app is mediated by the operating system in ways that are impossible to accurately reflect in an energy consumption model. So, where does this leave cloud-hosted apps?
(P.S. If you actually want to start estimating your browser’s consumption and emissions, check out the Carbonlyser addon by French think-tank The Shift Project.)
With cloud computing, similarly to above, an app’s consumption continues to be mediated by an operating system (OS). But in addition to the OS, cloud computing needs extra layers of OS-like software (e.g. hypervisors, orchestrators etc) to make it possible to seamlessly and efficiently and share hardware resources across physical boundaries. While this has immense advantages (including being vastly more sustainable than on-premise infrastructure), it also makes the precise measurement of a single app’s energy consumption that much more difficult. That being said, it is encouraging to observe that numerous industry and research groups are making progress in developing the tools for these or related measurements.
Measuring the Consumption of Cloud-hosted Apps
Open Source Version
The bustling open-source and research community already offers several advanced tools targeted at obtaining consumption data despite the many layers of software and the lack of direct access to the underlying hardware infrastructure. Many of them can be used on the hyperscalers (Google’s GCP, Microsoft’s Azure or Amazon’s AWS) as well. Here is an (likely non-exhaustive) overview.
The free and open source Cloud Carbon Footprint (CCF) project sets out to provide visibility and tooling to measure, monitor and reduce one’s cloud carbon emissions, especially by converting cloud utilisation into estimated energy usage and carbon emissions. It is designed to work on multiple cloud providers (including the above three), a significant advantage for multi-cloud organisations. It is well-documented and supported by several partner organisations led by Thoughtworks.
The free and open source Kepler project offers a way to estimate power consumption at different software layers, enabling different levels of granularity. Its architecture is designed to be extensible, enabling industrial and research projects to contribute novel power models for diverse system architectures. Instructions are available for deploying it in the IBM cloud or in AWS.
The free and open source PowerAPI project has set itself the goal of providing software-defined power meters (similar to the wall-plugged watt-hour meter in the warmup question) to measure the power consumption of software programs. The project is sponsored by various large French research and industry organisations.
The free and open source Scaphandre project is a monitoring agent, dedicated to energy consumption metrics. It enables apps running in cloud environments to gain access to energy metrics similar to ones described in the warmup question above. It is led by the French consultancy Hubblo.
The free and open source Impact Framework incubation project by the Green Software Foundation is a toolset to help you measure and reduce your software's carbon emissions, and choose when and where you run your software to make it greener. It addresses the typical architecture of cloud-hosted applications composed of many smaller pieces of software running on many different environments, for example, private cloud, public cloud, bare-metal, virtualized, containerized, mobile, laptops, and desktops. Every environment requires a different way of measurement, and there is no single solution you can use to calculate the carbon emissions for all environments.
Measuring the Consumption of Cloud-hosted Apps
Hyperscalers’ Version
Contrasting the above, the largest cloud providers offer rather coarser-grained (yet, possibly more comprehensive) and carbon-focused options.
Google GCP does not directly offer energy consumption metrics. However, since 2021, the Carbon Footprint product is available, which allows customers to monitor their cloud emissions over time by project, product, and region. The methodology used for the estimation is published as part of the product documentation, with updates to it being captured in the product’s release notes.
Microsoft’s Azure does not offer energy consumption metrics, but it has been developing its sustainability offerings over years. Their newest tool (in preview) is the Azure carbon optimization service, which includes tracking and analysing the emissions associated with one’s Azure resources and subscriptions, as well as optimisation opportunities and access to the raw data via API. This is set to complement the more rudimentary Emissions Impact Dashboard. The estimation methodology is published in a comprehensive report.
Amazon’s AWS does not offer energy consumption metrics, relying instead on their Customer Carbon Footprint Tool, which allows customers to “view estimates of the carbon emissions associated with your AWS products and services”. The tool includes emissions by service and geography, but it has a delay of three months for gathering and processing the data needed for the estimates. A very brief description of the estimation methodology is provided, which reveals rather coarse-grain calculations.
The Bottom Line
Measuring the energy consumption of (the software parts) your apps or digital products is extremely challenging (impossible?) due to the many layers of mediation between the application and the physical hardware it is running on (which consumes the energy). Nevertheless or perhaps because of that, numerous tools addressing this challenge exist and are in full swing, enabling consumption estimation even in the most diverse and complex cloud environments.
Now, software is obviously just one factor in a digital product’s emissions. Many detailed analyses and resources exist, looking at this issue from a broader viewpoint, such as Benjamin Davy’s piece diving deep into an AdTech stack, Microsoft’s Sustainable Software blog or the Canadian Climate Product Leaders’ brand new guide for sustainability in product management!
Have I missed an initiative or product? Please let me know in the comments!
Found a new open source tool to add to the list 🤩 (Thanks to Arne Tarara at green-coding.io for reaching out!)
Green Coding has a "Green Metrics Tool" that can be downloaded from Github: https://www.green-coding.io/projects/green-metrics-tool/
Enjoy!