How to Make Software That's Green
CEO Brian Jamison explains that the cloud's energy problem isn't just inefficient hardware.
Microsoft Bing Maps datacenter/Robert Scoble
The internet is an energy sucker. Billions of watts of electricity are consumed every year as we increasingly move onto the cloud. Only a small percentage energy actually goes towards basic information processing. The rest is spent on keeping servers cool and prepared for a sudden surge in use.
Much of the advancement in energy reduction has centered on hardware. Facebook, Google, Apple, and a select few others are looking at everything from stripping down server components to using outside air to cool server towers. It’s a step in the right direction, but for many retrofitting existing data centers with energy efficient hardware and cooling systems is too costly an endeavor to take on.
Enter CEO of Open Sourcery, Brian Jamison. The self-described Captain Green thinks that advancing hardware isn’t the only way to cut energy use. For him, it’s all about writing more efficient code. Inspired by a speech at a convention some years ago, Jamison realized that bad coding is causing computers to work harder than they have to.
To test his theory, he tasked his company with developing super-efficient software for open-source monster Drupal. Now he’s developing a metric for understanding how much energy a given website uses and he’s setting up a forum for discussion called the Sustainable Open Source Software Alliance. I sat down with Brian to discuss his energy-efficient coding dreams and how sustainability is a part of his personal ethos.
What does efficient code look like?
We want people to be writing code that’s faster and less resource intensive. What does that look like? Better use of existing resources; being smarter about the way you query a database; writing things that don’t have to look nine times when they can look once. There’s millions of things you can do.
When people think, ‘let’s make the web more power friendly’ the things that I’ve seen and read all focus on ‘let’s make the pages smaller, let’s use smaller images, let’s not stream the video.’ I don’t want to do that and I don’t think we need to do that. I’m not talking about sacrificing. I’m not talking about making the web any less rich than it is. What I’m talking about is focusing where the problems are. Where are the things that are using up the most power? We call those bottlenecks or inefficiencies and we’re looking to optimize those.
The process of optimizing is looking where the power is being used the most, where the most queries are coming from, thinking about it, and doing it better. It’s just common sense innovation, but you have to be focused on it. You have to be thinking about it and realizing it’s a problem.
It was easier, honestly, when we had worse computers. But now, computers are so cheap that we can just kind of throw hardware at the problem. That’s something that I hear a lot, ‘let’s just throw hardware at the problem’ instead of thinking about it and making it work better. Well, throwing hardware at the problem is fine if you don’t care about power. But the problem is, we really need to care about power, because it has all these multiple effects. So, what I’m trying to get at with this movement is that I’m not asking people to make their images half the size. I’m asking people, like our company, who are building the software, to think about how much power every line of their code uses. That way, we’ll be able to reduce massively the amount of power it takes to drive these web-pages
How do open source platforms, specifically Drupal, fit in?
If I were to go to Microsoft or anyone who has their own closed system and say ‘Hey guys I’ve done some analysis and here are some ways you can speed up your software and make it more power efficient,’ come on, they’ll laugh me out of the room. They won’t even take my call! But, open source communities, and in particular Drupal, are very open to adopting new ideas. It’s a matter of literally just making the change and knowing the right people and getting it into place. And knowing the right people is so simple and so easy, the community is so open to those sorts of things, and that’s why they’re so much more successful than closed-source software.
I could go on for days about why they’re better, but you can see it in the adoption curves. I don’t want to limit [this movement] to open source software, but I happen to believe it’s going to be a lot easier with open source because we can just do it instead of having to convince a board or a bunch of marketing directors or whoever happens to be controlling the software. We can simply make the changes and then they will get accepted because they make sense.
Ultimately [efficient coding] has to go beyond open source for this to be real. Open source could keep moving in the way it does and everybody ends up adopting it, in which case we don’t have to worry about it. But, I think we need to have it part of the broader community. [Efficient coding] needs to be considered in all realms, not just websites, but also web services.
I have a tremendous amount of respect for Netflix as a company, so I’m not calling them out as bad citizens, but if you spin up a movie on Netflix none of that happens on your computer or you smart phone or your tablet. That all happens in the cloud, on these servers, and that creates heat and power. They already may be thinking about this because of the energy costs, but [efficient code] needs to be much more of a clear focus. And we need to know so we can compare. So, is Amazon Prime’s streaming using less power than Netflix? It would certainly inform my decision on who to spend my money on.
What would the measurement look like?
There are these little devices called Kill-a-watt. You plug them into a socket and then you plug whatever device is being powered into the other end of it and it has a little display on it and it will measure how much power is used on something. This is a very simple way of doing it, I know there’s more sophisticated ways of doing it, but this is the fast and easy way of doing it. So basically you’re plugging a server into that thing and you’re measuring how much power its using when no one’s hitting a webpage and then you hit the web-page and measure how much power it takes by looking at the screen. Oh look at that! it just spiked up to 5 watts! So now we have a measurement and then we’re going to make some changes and hopefully get that down to 4 watts and 3 watts. Because if we’re making that big of a change, if we can make that big of shift, then propagating that out to all the tens of thousands of sites that are using it— we’re talking about 20 to 30,000 watts for every webpage it services. That’s massive right?
So we’re putting together basic measurements so that we can identify how much power is being used every time you serve up a page. And then we’re going to begin attacking and getting that number down.
I’ve just spent most of yesterday putting together a plan for how we’re going to do this in our company. So what I believe we’re going to do is make an investment and say x number of hours on every project we’re going to dedicate to making drupal more green. And it starts with these measurements, but its never going to stop. We’re just going to keep pushing everywhere we can and drive down the power usage.
I hope that this practice will be emulated and adopted and picked up everywhere and it becomes something that people do. And I hope that we’ll be able to create a standard that says this is a platinum website, because it makes the most use of the best software and uses the least amount of power to serve you up a webpage without sacrificing.
And then on the flip side we can use that to shame people who are building really bloated awful software.
Cooling plant at the National Energy Research Scientific Computing Center/Derrick Coetzee
If you were to build a standard for rating websites, what would it look like?
Platinum, Gold, Silver, and Shameful. There needs to be a ‘Shameful, bloated pig of a website.’ There’s no excuse, we need to do that.
How did you start thinking about sustainability in software development?
Well sustainability has always been at the heart of Open Sourcery. It’s one of the reasons I founded the company. It goes across the board: we’re in LEED Gold offices, we buy refillable dry erase markers. So like all the way down to the tiniest things and way up to, using low powered servers— like super low-powered servers. People have laptops. We hardly print a thing and when we do, we use this really earth friendly ink. So it’s apart of everything that we do and we’re always looking for ways to push the envelope. We try and get certifications because they push us and they identify things that we weren’t doing that we should do.
We just won a Sustainability At Work Gold certification from the city of Portland. I actually wish they had a Platinum certification, because we sailed through the Gold, but it gave us some new ideas.
So much of energy consumption effort have been placed on hardware. Why bother with software?
The focus should also remain partly on the hardware, but the reality is software runs the hardware. If you have inefficient software you’re going to attack the hardware and therefore draw more power and create more heat and it’s just wasteful. So by focusing on the software we think we can really make a large difference in power usage, in particular software that’s used by many many people, namely Drupal, which is what we use.
How much energy are we talking?
If you look at the amount of power that’s being used by datacenters, my assumption is that the vast majority of that is web oriented. If not web oriented, at least internet oriented, where people are pushing vast amounts of information back and forth. The percentage of power being used on at least a national scale to power these data center is massive.
If we can even make a single percentage point difference we’re making a huge impact, because this software runs all over. Like Drupal is one of the most powerful and well-used content management systems on the face of the earth. It’s used by over three percent of all of the websites. If you take any 100 websites at least three of them are Drupal and they tend to be the bigger ones. The bigger ones get more traffic therefore they use more resources and they also require more servers.
The real answer is I don’t know, but I know that it’s large.
Air filters at a Facebook data center/Robert Scoble
One of the reasons hardware has been at the center of the energy-use debate is because so much is spent cooling hardware. How will efficient software reduce energy-sucking air conditioning?
Why do computers get hot? Why do we have to cool them? The computer is actually thinking really hard and that makes it hot. We have to cool them, because if they get too hot they flip out and they crash. They don’t do well in heat, also heat reduces the life of the components. They like to be cool, it makes them last longer and they don’t make mistakes.
If you remember when you got your first laptop and you tried to run video on it, the thing got so hot you couldn’t keep it on your lap. It was just burning, burning, burning because the processor was struggling so hard to play the video that it was overheating. Every time that you ask a computer to do something it takes a certain amount of power and that power literally translates to heat in the system.
So, there’s two things that are going on that we need to be aware of. One, the more that we task a computer the hotter it’s going to get and the more we’re going to have to spend cooling it. Two, the more we task a computer the more power it uses just to do those calculations. A computer sitting there takes 5 watts, a computer doing something takes 50 watts not including cooling.
Now you take your iPhone or your iPad and you play video all day long and the thing doesn’t get hot. Two things have happened. One, the processors have gotten more powerful, more efficient. Two, the software has gotten more efficient. The second is the part we want to focus on.