Monday, July 16, 2007

How I got a faster computer by reducing power usage

Nothing to do with biking or injuries, but I thought people might be interested.

For my birthday, I got a P3 Kill-a-watt, which monitors electricity usage (amongst other things) so one can calculate the amount of power a device requires. When I plugged my desktop into it it was running at 120W to 130W, which seemed a little high; it's an 1800-odd MHz Athlon with a couple of sticks of RAM and 4 drives. After some wandering around, I found Linux Powertop, which monitors a system to try to see where the power is going. This also requires the 2.6.22 kernel for some high resolution timing code, and as a bonus it has a tickless feature. Computers generally have a timer that fires at a fixed rate per second, which wakes up the computer out of any low power mode; tickless means the kernel schedules sleep until it's actually needed (ie, a program needs to run) or an interrupt is received from a piece of hardware (packets arrive on the network connection).

After recompiling the kernel a few times and rebooting, I managed to get the power usage down to around 100W. After running Powertop for a while, I noticed that there were some odd things firing off multiple times per second that really didn't seem to need to; wmweather+ was firing off trying to poll retrieval of non-existent METAR data, wmCalClock was firing off 20 times a second "in case the icon was moved and needed redrawing", and my network monitors were constantly firing off. In the end I patched wmCalClock to only fire off once a second to update the icon, and I removed all the other applets that were firing off. After all that I went from around 500 wakeups per second to 250, with power usage dropping down to around 95W.

The only other thing firing off that looked like an obvious target was rtorrent. It turned out that this was scheduling timeouts as I had an upload cap, so it was only sending packets every x milliseconds, which required the timeouts. After I disabled that (leaving bandwidth management to the kernel QoS) I was down to 180 to 200 wakeups per second, with the top 3 wakeups all being hardware interrupts and the next one being Firefox. Power usage was now running at around 93W.

The final thing I did was to turn off the CD burner with hdparm when not in use. This took me down to 90 to 91W.

The surprising thing after all this is how much faster my computer is. All those wakups were stealing CPU time away from me when I was trying to do stuff, resulting in (for example) Firefox crawling when browsing around heavy Flash sites. Now I've stripped out the junk on the software side, the next step is to look at the hardware side to see what I can pare down; floppy drive, I'm looking at you!

I just did a ballpark calculation on the savings as a result, and just from my own machine here it looks like this:

Approximate power reduction: 125W - 91W = 34W
Daily reduction: 816 watt-hours
Weekly reduction: 5712 watt-hours
Monthly reduction (30 days): 24480 watt-hours
Yearly reduction: 297840 watt-hours, or 297.84 kilowatt-hours

Current cost per kilowatt hour: 10.67ยข per kilowatt hour
Savings per year: 3177.95 cents, or about $30, or almost 3 packs of decent beer.

So, just by optimising one device I've managed to save myself (in theory, at least) around $30 a year, and got a faster computer out of the deal too.

One other thing I noticed is running the graphics card in 3D OpenGL mode ramped the power up to 140W to 150W. I guess OpenGL screensavers are probably a bad idea...


Blogger Hannah said...

Um, wow. This reminds me of being at Sympatico and talking to you about 56k modems.

You: lots and lots of letters, and numbers, and gobbledegook, and wild hand gestures.

Me: glazed expression, pretending to understand, perhaps one finger inserted in nose...

But I get it, your PC uses less juice so you're saving money. Less money = good. Well done.

Thursday, July 19, 2007 11:52:00 am  
Blogger steve said...

OK, the non-technical summary:

* Strip out all the hardware you don't need.
* If your operating system supports it, tell it to turn off all hardware that isn't needed during normal operation (cd burners, etc), or use low power mode.
* Disable any running software you don't really need (clocks, weather forecasters, desktop animations, etc).

If you do this, your computer will (a) use less power, and (b) run faster. With the savings you can buy more beer instead and put off upgrading. This is, of course, A Good Thing.

And to lapse back into technical geekery... I was toying with buying a new system. The thermal dissipation (how much heat it generates at full whack, fairly close on the actual power draw) on an AMD64 chip is around 90W - as much as my entire machine! Even pushing my whole system to pull as much power as possible I haven't been able to go over 160W...

Thursday, July 19, 2007 12:29:00 pm  
Blogger Michael said...

"In the end I patched wmCalClock to only fire off once a second to update the icon" -- was it s/20/1/ or something more elaborated?

I'm in the process of collecting some ---wakeups +++hours patches you see :-)

Saturday, January 17, 2009 2:01:00 pm  

Post a Comment

<< Home