Much has been written about the need to reduce greenhouse gas emissions from data centers. Current estimates place data centers at consuming nearly 3% of the world’s total electricity – on par with the aviation industry – with as much as 45% of the energy used in data centers related to cooling.
As data and the processing of it grows exponentially, companies like Microsoft, AWS, and Google are designing green data centers using 100 percent renewable energy so that the data is more off-grid, the electricity grid that is. These data centers are being created according to standards for design, building, and operations similar to LEED (Leadership in Energy and Environmental Design) certifications for green buildings.
It’s great that attention is being paid to the actual buildings that house our data to try to control emissions. But another less talked about problem is that the majority of what runs in these data centers is not designed to be efficient. For example, did you ever think about how much the code behind your favorite mobile apps and websites contributes to your carbon footprint? Cryptocurrency alone is a good example of software that consumes an alarming amount of energy.
Software development is not often associated with environmental impact. Yet, inefficient coding and processes are consuming more energy than necessary, contributing to carbon emissions and depleting physical resources. Inadequate optimization of software processes necessitates larger data centers, which indirectly leads to more resource consumption and greater environmental impact.
The Path Towards Green Coding
By focusing on writing efficient, optimized code, we can reduce the energy and resource footprint of our software through:
1. Efficient algorithms and data structures: Algorithms and data structures are the building blocks of any software. By selecting the most efficient algorithm for a given task, developers can drastically reduce the computational resources required. This practice, while a fundamental part of computer science education, is sometimes overlooked in the rush to ship products quickly.
2. Reducing redundancy: Redundant code or repeated computations add unnecessary load on processors and impact other resources. By reducing such redundancies, we can make our code leaner and more efficient.
3. Code profiling and optimization: Tools exist that can analyze code to identify bottlenecks and areas of high resource usage. By regularly profiling and optimizing our code, we can continuously improve the efficiency of code and processes.
4. Cloud optimization: With much of the world’s software now hosted on cloud platforms, it’s crucial to optimize our use of these resources. This could mean using auto-scaling to match server usage to demand or taking advantage of serverless technologies that eliminate idle resources.
5. Green coding practices: Embracing a mindset of “green coding” means always considering the environmental impact of our coding decisions. This might involve everything from recycling code and using energy-efficient hardware, to advocating for renewable energy sources for data centers.
A Ratings System for Green Coding
In order to truly encourage green coding practices, we should have a rating system for green-certified applications that enables companies to see and measure their green footprint for existing applications. It should also help them identify what they can optimize within the application to reduce their carbon footprint.
Think of the options we have for green cars. Manufacturers take a stand on fuel efficiency and design protocols comply with that stand, even if it costs more because they know consumers are willing to pay more if they can save money down the road with a more efficient car. Plus, they’re doing their part for the environment. How can we get technology providers to take a stand on the environment just as the auto industry has, and make them stick to it?
Or take the hotel industry, as another example. When you check into a hotel, you can choose the “green option,” i.e., they won’t clean your room or give you fresh towels every day to save water and electricity. What if we had the option within green data centers to choose the level of “green” we want for our applications to ensure that they’re right sized? How can we make the applications that go into the data centers more efficient to create more bang for the buck with green data centers?
The goal of most non-production servers is for testing functionality, not performance. Therefore, we should be running non-production code and processes on slower, smaller servers that use less energy. This would save a significant amount of resources and costs considering most environments are two-thirds non-production.
The Case for Green Coding
Green data centers and servers are fine, but if the application uses 20 million CPU cycles to process a simple question against a large amount of data, and that application process is called 10,000,000 times a day, how can we claim these operations are truly green? It promotes a false sense of comfort to say the data centers are green and therefore saving energy if the applications themselves are inefficient and wasteful. To be truly green, we need to certify the applications as well as the data centers that host the applications.
“Green coding,” aka “green software development,” describes the practice of creating and writing code (aka software) in a way that minimizes its environmental impact. This should involve using efficient code that consumes less energy, optimizes data usage, and reduces electronic waste.
Optimizing our software does more than just reduce its direct carbon emissions. It has cascading effects throughout the technology ecosystem. Better-performing software enhances user experience and reduces hosting and licensing costs while running on smaller servers with fewer resources. Most importantly, it can decrease the overall demand for data centers, thereby reducing their emissions.