The digital sector generates 4% of global greenhouse emissions. Data centers and hardware are the main contributors to that impact. But those machines — not to mention all software, websites, apps and more — run on code written by developers. This means their work’s impact is far from negligible. So how can engineers, and indeed anyone shaping tech today, reduce that impact?
In part 2, we looked at how cloud, hardware, software and websites’ impact could be measured. Now, our third chapter dives into concrete cases of how green IT principles were applied, and the results they gave. Read on for inspiration!
Telco makes 30% energy savings by simplifying codebase
One compelling example of the power of green coding comes from consultancy BCG — via the Green Software Foundation (GSF) — which worked with a major telecommunications company to improve the efficiency of its codebase. After a SonarQube analysis established the code’s efficiency was optimizable — notably because it wasn’t being cached — BCG worked to simplify the code, notably by improving patterns and by avoiding using unnecessarily large clusters.
In cases like this, when the refreshed codebase is then used at scale throughout a large organization, the energy savings can be considerable. And indeed they were! BCG tracked a 30% reduction in energy used by the telco’s IT systems, 2019-2020. This was accompanied by a lowering of its SCI, or Software Carbon Intensity, the level of emissions coming from its infrastructure’s software.
Other factors that can help here, says the GSF, are very simple: good, straightforward, efficient code consumes less energy per se; and turning off unused servers at night. Look no further!
10-15% energy savings with greener hosting & eco-design
Hosterra, a French startup founded in 2022, offers ‘green hosting’ to its clients, who are principally web agencies. To do so, it uses Bare Metal products hosted in Scaleway’s own DC5 (below, one of Europe’s most sustainable data centers, as it uses 30-40% less energy and 90% less water than standard facilities). Thanks to Scaleway’s publicly available energy and water consumption data, Hosterra regularly shares with its clients how much energy and water their websites are consuming.
This approach is particularly relevant for Kodama, a web agency based in Lille (Northern France), which specializes in creating sustainable, or “eco-designed” websites. Conscious that, like physical products, the full life cycle of a website can have different degrees of impact, it charges clients a monthly fee, rather than a set one. This way, it takes care of clients’ websites from creation, to maintenance, and then to decommissioning.
“We discovered that combining two virtuous companies gave a twice-as-virtuous result”, says Hosterra founder Pierre Lannoy, who notably suggested Kodama use LiteSpeed web servers as an alternative to Apache, as the former “requires 30% less CPU cycles than Apache to do the same job”.
As a result, Kodama’s Yannick Chizzolini says websites created by Kodama consume 10-15% less energy since it started working with Hosterra; as well as incalculably large savings in terms of the water consumed to cool servers. Indeed, DC5 relies on free cooling most of the year, and only needs water during warmer summer months, when it moistens paper membranes through which air is passed, to then cool down the servers.
“It would have been challenging for Kodama to make these changes without us”, says Lannoy. “Some of their clients even ask for websites that are 96% compliant with the RGESN” (France’s extremely strict guidelines for eco-designed websites, which are set to become the European gold standard).
Expectations are high… as indeed they should be!
Static websites: a frugal alternative to WordPress
As covered in part 2, the average website page weight has jumped by 191% in the past 10 years. One way to combat this trend is to entirely bypass traditional CMS, like WordPress, which is currently used to make around 40% of the world’s websites. Why? Because, as Scaleway DevOps Engineer Bastien Wirtz points out, they tend to call on considerable server resources (PHP & MySQL in particular) to generate HTML content on-demand, both when a page is consulted, and when it’s modified.
An alternative is static websites, or sites that are served as statically rendered HTML, instead of dynamically generated by a web server. By using a workflow based on content pre-rendering, they only generate HTML when content is modified, not when it’s consulted. As such, if you’re looking to eco-design a website, this is a great option to look into.
Just how “eco” are static sites though? Wirtz made a test site, and deployed it on Wordpress, and on static site creation tool Hugo… and the results speak for themselves:
Total size (source code)
Number of requests
Although this is just a test case comparing a basic Hugo site with a similarly spartan WordPress one, Wirtz established that static sites’ HTML can be 24 times less heavy. And this is just the start of static sites’ advantages. Because their server needs are so small, hosting costs are minimal, both in terms of energy consumption, and financially speaking.
Furthermore, as the HTML is decorrelated from the website source code itself, the latter needs no updates, nor does it require maintenance of PHP, or other engines. And as added bonuses, security breach risks are reduced, as there is no code on the server side; and static sites load much quicker than regular ones, which is also ideal both for SEO and for energy consumption.
That said, static websites can’t do everything standard ones can. For example, they can’t process data directly, so are limited when it comes to databases. But they can draw on external services, via their API. Serverless functions — which also only use energy when they’re being used — are particularly apt here, says Wirtz.
Discover a comprehensive list of static site building tools here; find out in more detail how to create a static website here; and look out for Wirtz’ own full guide soon, right here on Scaleway Blog!
Saving 59 tons of CO2 with one WordPress plugin
- 2 million websites: the number of websites the plugin is activated on
- 40 GB of data saved… if each site has just one visitor
- 400,000 GB of data could be saved per month if each site averages 10,000 monthly visitors
- If each GB transmitted takes 0.5 kWh of electricity, and 295 grams of CO2 per kWh of energy…
- …59,000 kg, or 59 tons, of CO2 is saved per month thanks to the initial 20 KB saving.
Van Kooten also recommends a web developer classic for reducing emissions of WordPress sites: using lower-resolution files, in particular photos and videos. Of the tools that can help with this:
- Chrome Lighthouse, which serves a similar function, but for entire websites. With this tool, you can measure the impact of adding a new WordPress theme or plugin, by measuring the performance drop after installing it, and deciding if it’s worth it.
Making Serverless & Kubernetes more sustainable
Some cloud technologies are more sustainable than others. As specified above, Serverless is ideal for eco-design strategies, as it only works when needed, rather than constantly consuming energy by being “always on”.
To make your Serverless architecture even greener, you can use Serverless Sustainability Audit, a tool which allows you to to assess how many energy-saving principles it respects. As these principles are universal, many of them can be applied to other cloud architectures. They include (examples in brackets):
- Store less data (delete old user accounts, set retention periods for logs)
- Use less energy intensive media (use ARM instead of Intel processors; move old S3 data to nearline storage)
- Batch bulk operations (send many files in groups rather than one at a time)
- Cache (avoid templating a page every time it’s served if it won’t change)
- Monitor and optimize (profile database queries to find and improve the most compute-intensive).
Serverless Sustainability Audit’s added bonus is that you can make its results public, for example on your website, to demonstrate how “green” your cloud infrastructure is. Why not give it a whirl? Even if you don’t publish the results publicly, just sharing the principles internally can help you and your team make more sustainable architectural decisions in future.
Kubernetes is also worth a look, as it can “make carbon-aware decisions balanced against the technical requirements of the system”, says Bill Johnson, Principal Software Engineering Manager for Microsoft Azure. Johnson notably explains how, thanks to APIs like WattTime, K8s can be configured to only place new pods when local energy grids’ carbon mix is as low as possible. “We can query the API to get the carbon intensity of the location of each of our Nodes and feed this to the Scheduler’s algorithm to make a carbon-aware decision about where to place the new Pod,” he writes. Be sure to check out in detail how to do this!
Golem.ai’s Cloud infra optimization for greener AI
French AI startup Golem.ai also uses Kubernetes to leverage the advantages of “infrastructure on demand”, and thereby save resources. As the company’s Platform Engineering Manager William Guerdezer explains here, Golem.ai used the combined possibilities of Horizontal Pod AutoScaling, Cluster Autoscaling and Keda to stop the unnecessary resource consumption of its machines which were allocated and powered up, but unexploited during off-peak hours.
The above graph shows, with gray dashes, the IT resources saved thanks to autoscaling. By identifying that these resources weren’t necessary at given times of the day, Golem.ai was able to go from a full-time consumption of 56 to 27 production machines — i.e. half their total usage — thanks to intelligent management.
Golem.ai also took the simple yet obvious step of turning off at night those machines that were only solicited during business hours.
Such initiatives considerably help reduce Golem.ai’s emissions; as does the fact that it’s focused on symbolic AI, which consumes way less data — and therefore energy and water — than large language models like GPT-3. More on that soon!
This blogpost is extracted from the Scaleway white paper "How can engineers make IT more sustainable?", which you can download in full for free here!