Introducing PowerNap!

July 13, 2009

Ladies and gentlemen, I’m pleased to announce an exciting, new open source project from Canonical for the Ubuntu ServerPowerNap!

Mark’s Karmic Koala announcement alluded to this work when he wrote:

A savvy Koala knows that the best way to conserve energy is to go
to sleep, and these days even servers can suspend and resume, so imagine
if we could make it possible to build a cloud computing facility that
drops its energy use virtually to zero by napping in the midday heat,
and waking up when there's work to be done. No need to drink at the
energy fountain when there's nothing going on. If we get all of this
right, our Koala will help take the edge off the bear market.

I have just uploaded PowerNap to Karmic, and we are well on our way to integrating the technology into the 9.10’s Ubuntu Enterprise Cloud.

Actually, I spent last week in sunny Santa Barbara, California working with Dan Nurmi, of Eucalyptus Systems. We shot some amateur digital videos of Ubuntu Karmic Servers, PowerNap/PowerWake, Eucalyptus, and a Watt meter in action. I’ll get those posted soon!

I’ll go into much deeper technical detail on the design and implementation of PowerNap over the next few weeks in subsequent posts, but I’ll give an overview here…

How Does It Work?

PowerNap operates sort of like a screen saver for servers. Besides watching the console and terminals for keyboard activity, it also watches the system’s process table for activity.

An administrator defines a list of regular expressions describing some critical MONITORED_PROCESSES that should be running. When powernapd notices that all of the MONITORED_PROCESSES have been absent from the process table for some configurable ABSENT_SECONDS, powernapd emits a warning to all users of the system that it will run powernap, unless canceled within the next GRACE_SECONDS.

Sample Configuration

In the Ubuntu Enterprise Cloud case, the configuration file, /etc/powernap/config, might look something like:

MONITORED_PROCESSES = [ "^/usr/bin/kvm " ]

Thus, if no instance of kvm runs for 5 minutes, then the system will emit a warning, and powernap after a 1 minute grace period.

PowerNap Now!

Alternatively, a system administrator can force the system to powernap immediately by either running /usr/sbin/powernap directly, or sending powernapd the “now” signal with: service powernap now. In fact, this is what the Eucalyptus Node Controller does, such that it can maintain state, and directly control its managed nodes.

What constitutes a powernap?

So, powernap will first check if /etc/powernap/action is executable, and if so, it will run that file. This will allow you, as an administrator, to run any arbitrary script or program of your design when powernapd determines that your server has become idle. Your script could send an email, for example.

echo "Inefficient server, wasting energy" | mail

But in the default case, powernap will check if your server supports suspend-to-ram, and if so, it will pm-suspend your system. Otherwise, it will suspend-to-disk, or power the system off, depending on the sleep states supported by your hardware.

Slick, huh? 😀

Beyond the Cloud

While PowerNap is bespoke for the Ubuntu Enterprise Cloud, I have implemented it in manner that I hope is generically useful.

In fact, I’m currently using PowerNap on my Mythbuntu front ends! My configuration currently looks something like:

MONITORED_PROCESSES = [ "mplayer", "vlc", "xine", "mythfrontend.real", "xmms", "gthumb" ]

My hardware supports S3 suspend-to-ram, so this is great! If 4 minutes go by, where I’m not running any of my media players (mplayer, vlc, xine, mythfrontend.real, xmms), I’m given a 1 minute grace period, and then my system suspends. I have configured wake-on-usb and wake-on-lan in the BIOS, so I can resume the system in a couple of seconds either by tapping a key or sending a WoL magic packet.

But in the mean time, I’ve reduced the power consumption of 4 systems by 90%, for most of every day while I’m not directly using MythTV!

What about Waking Systems?

Which brings me to PowerNap‘s kid brother…PowerWake. /usr/bin/powerwake is another Python script. This script is designed to be a smarter, remote waking utility. Currently, it supports wake-on-lan, but it will eventually support other mechanisms, such as IPMI, and perhaps NUT.

With respect to wake-on-lan, it’s “smarter” than some other wake-on-lan utilities because it uses a hierarchy of cache files, configuration files, and the current arp table, such that you can wake a system by MAC address, or IP address, or hostname. I find this far more convenient than trying to remember or look up MAC addresses. powerwake respects static configuration in /etc/ethers and maintains a dynamically learning cache of known MAC addresses in /var/cache/powerwake/ethers.


I’m eager to hear what other uses you might have for PowerNap and/or PowerWake for your data centers, basements, and living rooms!

Saving a few Watts,

7 Responses to “Introducing PowerNap!”

  1. mattiasholmlund Says:

    Interesting. Could you please make sure that powerwake knows how to handle multiple Ethernet interfaces? If I run

    powerwake myserver

    It should do a dns-lookup for myserver and then look at the routing table to decide which outgoing interface it should send the etherwake message on.

  2. Kimble Says:

    Very interesting! I'll be montioring the progress for sure

  3. (``-_-´´) -- BUGabundo Says:

    how will network connections behave?

  4. Jef Spaleta Says:

    Can you explain the cloud scenario a bit more?

    Is powernap meant to run on virtualized clients or the host system?


  5. Dustin Kirkland Says:


    I'm sorry if that wasn't clear… PowerNap is meant to run on the system(s) hosting virtual machines.

    When one of those systems goes un-utilized (ie, no virtual machines running), PowerNap notices this and moves the physical machine to a lower power state (like S3 suspend).

    When the Cloud Controller receives some new requests that demand new virtual machines, it would first look for a running host that has sufficient capacity to service the request, thereby keeping the overall cloud in a "compressed" state.

    However, if demand requires, the Cloud Controller would PowerWake one of the sleeping hosts, bringing it online and increasing the current capacity of the cloud, such that it could service the new request.

    Is that more clear?


  6. Jef Spaleta Says:

    Yes much more clear.

    Your home usage example sort of confused me as its managing the power consumption of long lived but very idle services. The cloud scenario is more about managing the power consumption costs of potential capacity assuming services that are seldom idle or perhaps typically short-lived.

    I have to wonder, can you layer it to provide both types of power consumption management? What if you have a set of long lived virtual clients, each with critical work loads(in the powernap sense) like you described in your home server example? Could you powernap individual clients? And then powernap the host if all the virtualized clients are also power napping? And then powerwake the host and the clients as needed?

    Does the same sort of power savings you described for your home server setup applicable to long lived virtual clients and the host that run them? Any long lived virtual clients will keep your host awake and drawing power even if the virtual client is not doing critical work..just as in your home server example.


  7. Tim Says:

    I'm wondering how this would work in a compute cluster environment. Definitely interested in following this project. It's as a wise man once told me, "Data Centers aren't about computers, they are about power."

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: