Skip to main content

5 ways to build sustainability into your software architecture

Reducing energy consumption is at the heart of sustainable architecture. Here are five areas where your design choices can make a difference.
Two girls making a heart with their hands

Photo by Markus Eisele, CC BY-SA 4.0

Rolling into summer in the Northern Hemisphere, still recovering from the last two years, another global thread is popping back into people's minds: climate change. Extreme heat waves followed by severe weather phenomena remind us that climate change is a reality.

As a father of two wonderful children that will hopefully live beyond 2090, I think about the impact of software architecture on global warming and climate change and how I can build better and more sustainable solutions.

Global temperature change chart showing rising temperatures
(Source: University of Reading, Institute for Environmental Analytics)

I'll start by looking at the word "sustainability" and its definition. The first occurrence of the German word "Nachhaltigkeit" dates back to 1713 in Hans Carl von Carlowitz's work about forestry. He used the term to describe the long-term, responsible use of a natural resource. The idea, however, goes back even further to ancient cultures and traditional societies, which had practices restricting the use of natural resources.

The United Nations Commission on Environment and Development has heavily influenced modern use of the word. 1983's Bruntland Report defines sustainability as development that "meets the needs of the present without compromising the ability of future generations to meet their own needs." I'll maintain this angle in this article, even if modern use is typically extended to a three-pillar view: business, environment, and socio-ecological.

How software architecture affects sustainability

Digital sustainability deals with "basic conditions for sustainable digital artifacts and their ecosystems." Like other definitions of sustainability, it:

  • Is geared towards the present and future, and thus gives a temporal reference.
  • States that resources should be protected, especially if they are not renewable.
  • Ensures the continued existence of a reference object in the short and long term.

Reducing resource consumption is at the heart of sustainable architecture. The most important resource to consider in our industry is energy consumption. This is mainly fossil fuel burning, which generates most of the electricity to manufacture and power our hardware. For example, the hyperscalers are looking at this; Azure posted its sustainable architecture guide in 2020, and in late 2021, AWS added sustainability to its Well-Architected Framework pillars.

[ Learn how the automated enterprise can transform your business and unify your people and processes. ]

There have also been several global studies looking at how much energy we are wasting, where we're wasting it, and how we can we influence that. For example, German Bitkom did a meta-study and correlated studies published from 2012 to 2019. The main findings are:

  • 90% of the greenhouse gases in datacenters result from usage.
  • Datacenters were expected to be responsible for 200 to 250 metric tons of CO2 in 2021.
  • 60% of greenhouse gases originate from servers, networks, and storage components.

These results indicate two main categories for conserving energy: applications and infrastructure.

I adopted the following infographic from AWS Well-Architected Framework.

Sustainability on the infrastructure vs. of the infrastructure
(Source: Markus Eisele, adapted from AWS Well-Architected Framework)

How to build sustainability into your software architecture

Before I dive into any specific recommendations, I want to share a quote by engineer W. Edwards Deming:

Without data, you're just another person with an opinion.

This is a general reminder that any recommendation has no relevance if you don't define it and can't measure it. You must measure the impact of your workload and model its future impact. For example, establish long-term sustainability goals for each cloud workload, such as reducing the compute and storage resources required and defining sustainability improvements for existing workloads.

Following are five areas to consider when designing applications with an eye on sustainability and some recommendations for ways to do so.

1. Data design, usage, and storage

Reduce data storage and usage to an absolute minimum. You can reach this goal by implementing a data classification policy. Define which data to store, how long, and why.

Define fast and slow access classes and storage types. Start by understanding your data's impact on consumed resources, and delete unnecessary data while using data life-cycle policies. Minimize overprovisioning storage, and prevent data movement across network boundaries as much as possible. Use data-access technologies that support location-aware data retrieval and different storage patterns.

2. Application design

Define component usage guidelines. Ideally, nothing should be "always-on" and consuming energy. Make sure to enable resources to work in parallel and asynchronously. Jobs that are not time-critical should be split and computed asynchronously to run when low-carbon electricity is available. Use demand shifting or demand shaping to schedule application parts where necessary. Integrate suitable application monitoring elements to track runtime changes and effects on sustainability. Shift responsibilities to better suited (and sustainably run) managed services where applicable.

3. Platform deployments, utilization, and scaling

This is a tricky one, as it implies some specific architectural choices. Utilization and scaling-first technologies like Knative and serverless come to mind, and both have been referenced in various places, such as the Going green with serverless podcast.

A common Kubernetes environment often uses the "one cluster per app" pattern or sometimes "several clusters [staging/prod/dev] per app." Utilization is low in those clusters. That means even if a pod scales down to zero, you're still paying for the overhead of Kubernetes, plus all the embodied carbon in the hardware. Although the workload's electricity usage is lower, which is exactly what you want (assuming spin-up costs are low, as they would be with frameworks like Quarkus), it could be a marginal improvement.

Therefore, take a detailed look at your overall setup before throwing additional technologies at your application. Ideally, use the minimum viable representative environments to develop and test your application. Enhance your design with complete automation approaches to maximize the utilization of your environments.

[ Learn how IT modernization can help alleviate technical debt. ]

Technologies with burst capabilities offer another big advantage. One example could be a standard Jenkins with defined sets of worker and management nodes versus a scalable Tekton build pipeline. Also, strongly consider using specific hardware for your workloads. This approach is geared towards floating-point unit and graphics processing using (FPU/GPU) and compute-heavy calculations but can quickly extend to instance types suitable for particular workloads.

4. Code efficiency

As the Green Software Foundation writes, "The most efficient code is no code at all and the best time to spot unnecessary work is as early as possible in the design process." A lot might be achieved with relaxed goals or requirements. Changing log file retention time or adjusting service-level agreements (SLAs) to reality are just two examples.

Even if regulatory requirements are unavoidable, it is absolutely necessary to challenge drivers and identify them. If you think that using a specific programming language will give you a head start, I can reassure you that you can continue using your favorite language. Research from 2017 (updated in 2021) concludes that: "Although the most energy-efficient language in each benchmark is almost always the fastest one, the fact is that there is no language which is consistently better than the others."

5. Operations

There is a significant advantage in the high compute density of managed cloud services. Such services share resources between thousands or millions of users, achieving extremely high utilization and reducing the burden of maintaining site-reliability engineering (SRE) teams to run your infrastructure and applications.

[ Get the free eBook: Modernize your IT with managed cloud services. ]

On top of that, there's a growing number of open source projects that help you achieve your sustainability goals. For example:

  • Kube-green is a simple Kubernetes add-on that automatically shuts down (some of) your resources when you don't need them.
  • Cloud Carbon Footprint is a tool to estimate energy use and carbon emissions from public cloud usage.
  • Scaphandre is a metrology agent dedicated to electrical power consumption metrics.
  • Kube-downscaler scales down or "pauses" Kubernetes workloads during non-work hours.
  • Kepler (Kubernetes Efficient Power Level Exporter) uses eBPF to probe energy-related system stats and exports as Prometheus metrics.

Every saving counts

Code + Data = Energy = Carbon emissions

If you care about this simple equation and can not only define but also measure your resource consumption, you are on the right track.

Many of the recommendations in this article are primarily applicable in specific architectural contexts, including event-driven or microservices architectures. While those are certainly better suited to addressing the challenges around optimized energy consumption, traditional three-tier architectures can also profit from smaller changes.

The reality is that every saving counts today. The 2022 IPCC Sixth Assessment Report assesses that there is a rapidly narrowing window to enable climate-resilient development. We must reduce carbon emissions by 45% within the next eight years. Honestly, application design alone won't solve this massive challenge. However, it will do its share, as we all do with each action we take.

Author’s photo

Markus Eisele

Markus is a Developer Strategist Red Hat EMEA and Java Champion. He's a former Java EE Expert Group member, founder of German JavaLand Conference, reputed speaker at Java conferences around the world, and a very well-known figure in the Enterprise Java world. More about me

Navigate the shifting technology landscape. Read An architect's guide to multicloud infrastructure.


Privacy Statement