Developer Bits on Sustainable Computing
The world is trying to “green up” our cars, light bulbs, clothing, and even our laptops. Apple is pushing the greenest laptops of all time. Google goes lead free and commits to 100% recycling practices. Massive data centres recycle water and implement radical new energy efficient cooling technologies. But, as consultants, we primarily write code – what role do we play in sustainable computing? Some will argue that our role here is best served by the principle of, “Every little bit.”.
A quick search of the Internet reveals thousands upon thousands of books, articles, and studies focused on becoming more efficient. Blogs on the agile methodology preach bringing speed to development and TDD strives to make the QA cycle a blip on the project timeline. Grails and Spring Roo bring projects and prototypes online in minutes rather than days. It cannot be argued that more efficient development reduces cost and makes good business sense – but are there other benefits as well?
Doing the same work in less time
As developers our days mandate carbon output – what we get in return for our expenditure is variable. As we develop we need to be conscious about making the most of our machines each minute that we are in front of them as well as time we spend away from them. An few moments of consideration can save thousands of watts of power each day. Do you stare at your console while compiling or do you execute other tasks during that time? Do you practice TDD to remove much of the overhead of manual testing? Do you hibernate or fully shut down your machine when leaving for meetings or lunch? These are all small things by themselves, but few million persons doing them everyday makes a very large difference.
Conserving bandwidth
Each bit we push and pull across the wire has a cost associated with it. As such, it is in everyone’s best interest to conserve bandwidth (unless you are in the business of selling bandwidth) at every turn. Servers will do less work, switches and firewalls breathe more easily, pages load faster, and all while using less energy and costing your client less. Here again, the work we do can have a large impact over time.
- Have we minimized and optimized CSS and JavaScript?
- Are we serving only compressed images?
- Have we done all we can to leverage client side caching?
- Is Ajax being used to reduce full page loads?
All of these things result in more speed for the user, less cost for the client, and less carbon out of the pipe.
Optimising code
Servers are like athletes – the harder they work the more energy they need to consume to keep going. World class athletes have figured out that at a certain level of performance even the smallest gains in efficiency determine victory or loss. Cyclists shave fractions of grams of weight off each component to save weight, then test in wind tunnels to reduce drag. Swimmers now wear full body suits of technologically advanced material modeled after shark skin to reduce friction in the water. They do this all to finish fractions of a second faster than they could before. Can we learn from the world’s elite athletes and reduce total clock cycles necessary to compete a task?
Here again we have a situation where everyone wins. When we fully optimize our code we will use fewer resources to complete the same set of tasks. Our code will be faster, the user experience better, client costs reduced, and less energy will be wasted. While techniques for code optimization is beyond the scope of this writing it is something that we as developers need to be conscious of and work to master.
Summary
While the methods and mechanisms that can be used to make software an integral part of sustainable computing are seemingly infinite, we can all work to implement a small, finite set of options every day and together make a huge difference. Whether we simply add break statements to for loops or implement reduced carbon data centres, we can all do something everyday to reduce the number of bits of carbon we produce.