Sustainable Software Design

Sustainable Software Design: Background and Best Practices

Despite ever-increasing energy consumption in the IT sector, the software industry still lacks objective quality standards for sustainable software design and development. At Fraunhofer IESE, one area of our activities is research and development of sustainable solutions. In this article, we present the most important influences on software-related power consumption and address techniques for improving the energy balance sheet.

The discourse about sustainability in information and communication technology (ICT) is populated by many similarly worded expressions, so let’s first get a grip on terminology: “Green computing“ summarizes all efforts of both “Green by IT”  and “Green IT” initiatives. The “Green by IT” type of activity describes the improvement of ecological sustainability in all matters of life and work through the utilization of computer technology. “Green IT”, however, is concerned with all aspects of operating IT technology itself in a sustainable way. Green IT touches questions such as:

  • What are the environmental costs for producing IT equipment?
  • How can decommissioned devices be returned to the raw materials cycle?
  • How often does IT equipment need to be replaced?
  • What to do with the waste heat from data centers?
  • How can the energy consumption of computers and networks be reduced to a minimum?

The latter question about reducing the IT equipment’s energy consumption sounds like a challenge primarily for electronics engineers – but this is only half the truth. Within the limits of the technical properties of computers, software engineers have a huge influence on this factor. One line of research at Fraunhofer IESE analyzes the effects of software architectures and technologies on sustainable IT operations and the development of concepts and solutions for the reduction of environmental costs. In this article, we address measures that every software developer can take to design their software as a “greener” product.

Background, or why should software design become more sustainable?

The figure below shows the basic relationship between computer utilization and power consumption. Computer utilization is defined as the degree of all activations of electronic components such as CPU, GPU, memory, hard disk, network, and others. The level of computer utilization is primarily dependent on the software and operating system in use and the intensity of its operation. Even when idle, your PC consumes a considerable amount of power Pon, which increases non-linearly up to the maximum power consumption Pmax depending on the degree of utilization [1].

 

This diagram means that if you’re able to keep your PC’s utilization low through the use of high-performance, highly optimized software, you will save energy. This becomes even more important in data centers: If the efficiency of software for a planned data center can be increased by 100%, in theory only half the servers are needed. This does not only reduce the power supply by half, but also eliminates the entire environmental costs for production and procurement of half of the servers required before optimization of the software. In this scenario, the environment therefore benefits twofold from an increase in software efficiency.

But how realistic is such an increase in software energy efficiency?

Impact of programming languages on sustainable software design

Programming languages as the basic tools of developers have a considerable influence on the energy efficiency of software. In a 2017 study, Portuguese researchers examined the energy consumption of three benchmarks in 27 different programming languages [2].

As expected, many compiler languages performed better than interpreter or VM languages because they translate program code directly into machine-readable instructions and optimize it in the process. Interpreter and VM languages, on the other hand, abstract their instructions from the concrete processor hardware and therefore require energy-intensive intermediate steps. The resulting differences in energy consumption can be huge. The next figure shows an excerpt from the comparison of four common programming languages for three benchmarks: binary trees, fannkuch-redux and fasta.

 

The difference between the most energy-efficient language (C) and the least efficient one (Python) is more than 4000% on average when solving the same computational problems. Let’s translate this to an automotive analogy: If a car representing the language C consumes 5 l of gasoline per 100 km, the Python car requires a staggering 200 l per 100 km or more. If there were an EU energy label for programming languages, it might look like the one on the right side of the table.

To be fair, it must be mentioned that these programming languages are usually applied in different domains and use cases, i.e., they are not used competitively. So, the car analogy was basically a comparison between apples and oranges. There are good reasons to use languages other than just C. For instance, a web UI requires an encapsulated runtime environment for security reasons alone. In current technology, the web UI can’t and shouldn’t be developed with a compiler language.

But the fact that JavaScript or Python have found their way into server (backend) applications reveals significant savings potential in intensively used modules. Software architects and developers should therefore carefully plan which language to use for which use case. Migrating substantial amounts of code to another language for energy reasons becomes very expensive when software has grown beyond a certain point.

However, even an energy-efficient language is of little use when the implemented algorithms are inefficient. One bad decision at a central point of the software architecture can raise the energy consumption of the entire application by orders of magnitude. Delivering tools and methods for enhancing energy efficiency in software development is one of Fraunhofer IESE’s research goals.

Influence of mobile and cloud computing on sustainable software design

Under sustainability aspects, the rising usage of mobile devices and cloud services is a critical driver of the overall increase in ICT energy consumption. Conversely, both trends offer significant potential for reducing environmental costs. In mobile computing, there is already a direct incentive to increase the energy efficiency of applications: extending battery runtimes. Cloud computing, too, incentivizes efficient coding, although indirectly.

The two most popular models for moving software to the cloud are Infrastructure as a Service (IaaS) and Platform as a Service (PaaS). In both cases, the cloud provider charges its customers based on usage. The fewer servers a company books in the IaaS model or the fewer services it books in the PaaS context, the lower the operating costs. Evidently, these rental fees do not equal the environmental costs, but there is a strong correlation. If efficiency goes up, operating costs go down and vice versa. So, the desire to keep operating costs low can act as a driver for efforts that directly benefit sustainability.

IaaS offers less potential in Green IT as it still uses dedicated servers for each customer by limiting the ways hardware resources can be shared and lowering average hardware utilization as shown below. In this scenario, each cluster of servers always reserves sufficient resources for the individual application’s worst-case load. The PaaS model, on the other hand, allows much more efficient use of hardware resources as these are shared among all customers and applications. Thus, the average utilization of computer hardware is much higher. Additionally, load peaks of different applications will spread out over time, requiring much less overall computational reserve.

 

In any case, there are considerable differences in self-commitment to an environmentally friendly operation of data centers between various cloud providers such as Amazon AWS, Microsoft, Google, and smaller competitors. Unfortunately, the operations of the largest player, Amazon, appear to be the least sustainable among the three hyperscalers for the time being [3]. Nonetheless, driven by public opinion and government guidelines, all providers are moving towards climate neutrality. The EU Commission, for instance, aims at having regulations to ensure climate-neutral operation of European data centers in place by 2030.

Energy-efficient and sustainable software design 

Only some of the effort for energy-efficient and sustainable software design requires deep engineering. Most measures are equivalent to best practices of everyday energy savings, like “Lights off!” or “Shut the door”. In many cases, the respective effort just requires a bit more diligence in development. By category, the necessary measures are:

  • Select an efficient algorithm after analyzing the complexity of the problem at hand.
  • Avoid regular and high-frequency polling by applying asynchronous communication patterns.
  • Pick an energy-efficient programming language for high-intensity modules.
  • Reduce network traffic through data compression and limitation of data transfer, e.g., by introducing GraphQL for your REST APIs.
  • Reduce data scope by transferring, querying, or processing only the relevant data.
  • Use caches where possible and appropriate.
  • Apply data lifecycle management, i.e., increase query and processing efficiency by removing irrelevant data from the current working set, e.g., by deleting data or moving it to an archive.
  • Perform database tuning by using standard analysis and tuning tools.
  • Evaluate pushing your software to the cloud, preferably via PaaS to climate-neutral cloud operators.
  • Create a lean web UI by avoiding resource-consuming animation and frameworks.
  • Perform dynamic code analysis to identify code passages with high energy consumption.
  • Use Artificial Intelligence (AI) wisely, i.e., only where necessary and only trained to the level required by the application.

Conclusion

The idea of Green IT will increasingly influence software engineering. However, one key challenge for the software industry and for society is the lack of norms and standards in this area. One reason for this absence is a rather technical deficiency: There is no transparency for software engineers regarding how much energy their product consumes or how effective their efforts have been in terms of resource conservation. If you can’t measure exhaust gas levels in the air, you cannot formulate meaningful air purity regulations. Similarly, if you can’t easily monitor software-related power consumption, you’re lost trying to devise meaningful norms and standards in green and sustainable software design.

Fraunhofer IESE, with its strong experience in software engineering and its background in socially relevant technological topics, is researching methods, tools, and best practices for Green IT. This includes developing tools and monitoring software, investigating the efficacy of power conservation measures, and proposing standards.

Literature:

  • [1] Fan, Weber, Barroso, 2007. Power Provisioning for Warehouse-sized Computer, Proceedings of the ACM International Symposium on Computer Architecture, pp. 13-23
  • [2] Pereira et. al., 2017. Energy Efficiency across Programming Languages, Proceedings of the 10th ACM SIGPLAN International Conference on Software Engineering, pp. 256-267
  • [3] Kamiya, September 2022, Report Data Centres and Data Transmission Networks, International Energy Agency (IEA)