Programming for the Future

Sascha Giese, Head Geek at SolarWinds explains why green coding could revolutionise the technology industry.

0 473

What’s worse for the climate? Watching a series on Netflix, Amazon Prime, or Disney+ in the evening, or flying by plane. As trite as the question may seem, the answer isn’t as obvious as you might think. Commercial flights account for 2.4% of total global CO2 emissions, putting them in second place. With a total share of 2.5% to 3.7%, data centers are in first place. And Netflix and others need them for their services.

To be fair, even airplanes are now dependent on the services of hyperscalers and charge a portion of their emissions to the data centers. Fundamentally, almost everything today requires a data center in some way – thanks to global digitisation. And power consumption for operation and cooling is enormous. It’s only logical to become more sustainable here, too – and start with the smallest element: the code of the applications run on the data centers.

Smaller, faster, more efficient

The philosophy behind green coding is to become so efficient by optimising the code so it becomes sustainable. After all, efficient code requires little energy. To make code “green,” there are three adjusting screws:

  • Size: a “small” code takes up less space in deployment and, more importantly, in constant transfer between endpoints.
  • Speed: If a code is executed quickly, the period of time over which energy and power are needed is shorter. This also saves energy.
  • Resource-efficient: Codes can be written from the outset in such a way that they require fewer resources during execution.

In addition, even minimal changes in the code can have a big impact. For example, if you reduce the resolution of the images in an app, this has only a very small impact on the energy consumption of the devices. But if you assume hundreds of thousands of users open this app every day, it adds up to a real saving. Users are unlikely to notice the difference due to the small screens.

Another approach to speed can be demonstrated using content delivery network (CDN) providers. Normally, web applications of any kind must be hosted in data centers. These are locally bound and may be very distributed. When a user accesses a web app, he does so on the data center closest to him. For a German user, this may mean accessing a center in Spain – simply because there is none in Germany and the others are even further away. CDN providers use a geographically distributed network of proxy servers and their data centers to get the application to the user more efficiently and faster. And speed means less energy is consumed. Again, the individual’s savings may seem minimal; but considering Netflix, for example, uses a CDN with Open Connect, again the sum makes the real difference in the end.

In the marathon to sustainable software

Software developers often work with limited budgets. Typically, they then write some code, send it through Quality Assurance Testing (QA), and if it works, roll it out. This doesn’t necessarily yield the highest efficiency, but it does yield the highest return. Completing such a task as quickly as possible in a given time window is called a sprint in the industry.

The situation is different with optimised green code. Because before it reaches QA, it is rolled out several times in a test environment, tested, measured and changed. In the process, you have to play with the code until you have a version with the highest possible and at the same time most economical efficiency, which is then first the Q&A and then rolled out. For example, you test the performance of the databases when you change the code, which gives you an indication of its efficiency. Or one uses application performance monitoring tools to check how fast and efficiently the code is running. There are now applications that combine such functions for constant optimisation, for example SolarWinds Observability.

But then a sprint is no longer a sprint, but a cost- and time-intensive marathon – and these are usually less profitable for companies. In principle, the possibility of efficient code optimisation existed even before far-reaching monitoring and observability solutions, but no one has done it yet. In view of the enormous share of global CO2 emissions accounted for by data centers, however, green coding offers untapped potential for greater sustainability. It’s time to make use of it.

Leave A Reply

Your email address will not be published.

Join our mailing list
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.