What is GreenFrame and how does it work?

GreenFrame is a command-line tool that estimates the carbon footprint of web apps at every stage of the development process. Put it in your Continuous Integration workflow to get warned about “carbon leaks”, and force a threshold of maximum emissions.

GreenFrame relies on a scientific model of the energy consumption of a digital system built in collaboration with computer scientists at Loria.

While running the scenario, GreenFrame uses docker stats to collect system metrics (CPU, memory, network and disk I/O, scenario duration) every second from the browser and containers.

It then uses the GreenFrame Model to convert each of these metrics into energy consumption in Watt.hours. GreenFrame sums up the energy of all containers over time, taking into account a theoretical datacenter PUE (set to 1.4, and configurable) for server containers. This energy consumption is then converted into CO2 emissions using a configurable “carbon cost of energy” parameter (set to 442g/kWh by default).

GreenFrame repeats the scenario 3 times and computes the average energy consumption and CO2 emissions. It also computes the standard deviation of energy consumption and CO2 emissions to provide a confidence interval.

For more details about the GreenFrame Model, check this article on the Marmelab blog:

GreenFrame.io: What is the carbon footprint of a web page?.

Which Factors Influence The Carbon Footprint?

Based on our research, the carbon footprint of a web page depends on:

The duration of the scenario The size of the page (HTML, CSS, JS, images, fonts, etc.) The amount of JS executed on the browser The number of third-party tags (ads, analytics, etc.) The complexity of the page (number of DOM elements, number of layout changes, etc.) Server containers have a low impact on the carbon footprint (around 5% in most cases).

This means that the lowest hanging fruit for optimizing the emissions of a web page is to use Web Performance Optimization (WPO) techniques.

Example

For instance, to estimate the energy consumption and carbon emissions of a visit to a public web page, call greenframe analyze:

$ greenframe analyze https://marmelab.com
✅ main scenario completed
The estimated footprint is 0.038 g eq. co2 ± 1.3% (0.085 Wh).