Sustainable Software Engineering for a greener digital world
Tags: sustainabledevelopment, energy, architecture
Published: 2023-07-23 16:48:54

When it comes to sustainability, what can we as software engineers and architects do? It turns out, quite a lot. We have the power 😜 to make a difference, and I'm going to show you how by starting with the core concepts of Sustainable Software Engineering (SSE). It’s a lot easier and more in reach than you might think.

## Core concepts and philosophies of Sustainable Software Architecture & Sustainable Software Engineering

Sustainable Software Engineering is built upon two core philosophies and eight core principles. Let's delve deeper into these concepts, understanding this will help with the practical applications later.

### **Philosophies**

**Everyone has a part to play in the climate solution:**

It might not always seem like it but we **can all** make a difference. We have a lot more to offer when it comes to the climate solution than we think, and it’s easier to make these changes than we think. 

I will talk more about this in the upcoming sections. 

**Sustainability is enough, all by itself, to justify our work.**

This philosophy may seem strange at first glance, but it’s really important to be sustainable to be able to keep on doing what we are doing for generations to come.  Hopefully this sets a precedent for how people can easily do this going forward. Sustainable practices can also help financially by reducing waste and increasing efficiency. This can save money and make businesses more profitable in the long run.

### **Eight Core Principles**

1. **Carbon:** Minimise the carbon emissions generated by your software and its underlying infrastructure. This includes optimising code, reducing computational complexity, and selecting energy-efficient hardware.
    
    *Suggestions:*
    
    - Utilise energy-efficient algorithms and data structures.
    - Monitor and minimise power consumption of your software.
    - Choose cloud providers that prioritise renewable energy sources.

2. **Electricity:** Reduce the electricity consumption of your software and hardware by optimising resource utilisation and eliminating waste.
    
    *Suggestions:*
    
    - Implement techniques such as dynamic voltage and frequency scaling (DVFS) to optimise power usage.
    - Use virtualisation and containerisation to optimise resource utilisation.
    - Optimise idle times, sleep states, and power-saving modes.

3. **Carbon intensity:** Be aware of the carbon intensity of the energy sources powering your software and infrastructure, and prioritise lower-carbon options when possible.
    
    *Suggestions:*
    
    - Choose data center locations with low-carbon energy sources.
    - Work with cloud providers that prioritise carbon reduction strategies.
    - Consider carbon offset programs to balance out your emissions.

4. **Embodied carbon:** Understand the carbon footprint of your software's entire lifecycle: including production, distribution, and disposal of hardware.
    
    *Suggestions:*
    
    - Prioritise hardware with lower embodied carbon.
    - Implement effective recycling and disposal policies for hardware.
    - Promote hardware longevity through software compatibility and modularity.

5. **Energy proportionality:** Strive for energy usage that is proportional to the workload, ensuring that idle resources consume less energy.
    
    *Suggestions:*
    
    - Use auto-scaling features to dynamically allocate resources based on demand.
    - Implement energy-efficient workload scheduling.
    - Optimise server utilisation through load balancing and resource management.

6. **Network efficiency:** Optimise network usage to minimise energy consumption and reduce latency.
    
    *Suggestions:*
    
    - Minimise data transfer by compressing and caching data.
    - Optimise API calls and utilise content delivery networks (CDNs) to reduce latency.
    - Use edge computing to move computation closer to the data source.

7. **Demand shaping:** Manage and shape user demand to spread it across time, reducing peak loads and energy consumption.
    
    *Suggestions:*
    
    - Implement features that incentivise off-peak usage.
    - Utilise demand forecasting and load management techniques.
    - Encourage users to adopt energy-saving settings and behaviors.

8. **Optimisation:** Continuously improve and optimise your software's energy efficiency and carbon footprint through monitoring, analytics, and automation.
    
    *Suggestions:*
    
    - Set up monitoring and analytics to track energy consumption and carbon emissions.
    - Implement automated testing and optimisation tools to continuously improve efficiency.
    - Encourage a culture of sustainability within your organisation.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0h6l2q9mbe5drnzhwcf.png)

### **Normalising Conversations about SSE**

For SSE to become a standard practice in the software industry, it's important to normalise conversations around it. Encourage your colleagues and peers to discuss sustainability, share best practices, and create a culture of accountability for environmental impact.

### **Cascading Benefits of SSE**

Adopting SSE practices not only benefits the environment but also has cascading benefits for businesses and individuals. Sustainable practices can help financially by reducing waste, increasing efficiency, and ultimately saving money. This makes businesses more profitable and supports long-term growth.

### **Embodied Carbon**

Embodied carbon is the carbon footprint of a product or service throughout its entire lifecycle, from production to disposal. By understanding and reducing the embodied carbon of software and hardware, engineers can make a significant impact on overall carbon emissions.

It does not matter in which space you might find yourself, working with cloud services or on-premise. Whether you’re working on the backend or building for devices (including web) you have a role to play. 

## **Practical Applications of SSE**

In this section, we will explore some practical applications of SSE in different domains, including cloud services, devices, networking energy usage, and demand shaping.

### Cloud Services

The cloud has created an illusion of abundant resources, making it easy to overlook the actual physical resources consumed. Remember that "the cloud is just someone else's computer." The abstraction hides the fact that we still use power from the region where the data centers are located and that hardware components are produced using rare earth metals.

When running a server at only 10% utilisation, the server still consumes static power, resulting in a low power-to-work ratio. By provisioning only the capacity you need and avoiding overprovisioning, you can achieve a higher power-to-work ratio and reduce costs.

### Devices

Developers often encounter device compatibility issues. While it may be frustrating to address these problems, consider the carbon footprint of the devices you build for. Devices have a larger carbon footprint during manufacturing than usage over their lifetime. The more often people have to replace their devices, the larger their carbon footprint.

By continuing to support older devices, you can help reduce the overall carbon footprint of your users.

### Networking Energy Usage

Network infrastructure consumes power, and the further data needs to travel over a network the more devices are needed and the more power is consumed. When designing software, try to have your data be as close as possible to the consumer. This not only reduces energy consumption but also helps with latency, giving you a double win.

### Demand Shaping

In the digital cloud world, demand shaping involves balancing when and how people use online services to avoid overloading servers during peak times. This helps reduce the energy used by the servers and makes the digital world more sustainable.

For example, imagine an online video game company encouraging players to play during off-peak hours when fewer people are online. They could offer in-game rewards or bonuses to incentivise off-peak gaming, helping to spread out the demand for game servers. This way, servers don't have to work as hard and use as much energy all at once.

By implementing similar strategies, you can shape demand to match supply and contribute to a more sustainable digital world.

Sustainable Software Engineering is not just a responsibility for software engineers and architects; it's an opportunity to create a positive impact on our environment. By understanding the core concepts of SSE, normalising conversations around sustainability, and implementing sustainable practices in our work, we can play a crucial role in building a greener world.