Power efficiency is a growing concern for data centers running multiple Linux servers. The more you know about...
the PowerTOP 2 utility, the more insight you can glean into Linux power consumption, helping to optimize servers.
CPUs, C-States and power usage
To understand the PowerTOP power monitoring application, let's first look at how a server uses power. In the Advanced Configuration and Power Interface standard, power usage is measured in C-states, sometimes called C-modes. A CPU can switch between different power frequencies, each of which is designated in the C-state. A busier processor will be in a lower C-state, indicating that it consumes more power. CPUs in a higher C-state, where power consumption is reduced, take longer to become active. For example, a CPU in C-state 6 consumes almost no power; it will take 250 milliseconds or more before the CPU can become completely active.
You cannot do much to influence the way in which a program uses power, although the Linux kernel does try to optimize power usage. What you can do is move system components around the data center's servers to optimize power usage based on the information PowerTOP provides.
Using PowerTOP 2 to view power consumption
The PowerTOP 2 utility lists active programs and drivers, as well as their power usage. This list can show, for example, that a module or program you don't even need on your server is responsible for the highest power consumption. With this information, you can blacklist the kernel module or completely remove the program from your system to significantly cut power usage.
The Summary line across the top of the PowerTOP Overview window shows the Linux power consumption broken down by average wakeups per second, number of actions the graphical processing unit and virtual file system can perform, as well as the percentage of CPU usage. Based on this information, you can decide immediately where to target power reduction efforts. In the example in Figure 1, the monitored system has many wakeups per second that can be tracked down to the libvirtd, virt-manager and kvm processes.
Power consumption statistics in PowerTOP 2
PowerTOP 2's statistics information shows what the CPU cores are doing and in which C-state. It is nice to see the summaries per CPU core, but in most cases this won't help you improve power performance for a server.
The Frequency stats tab lets you relate specific C-states to the clock frequency that a CPU is using. Discover how efficient the CPU frequency is in low-usage cases. You can expect modern CPUs to step down to a lower frequency when the workload is light (see Figure 2). If the amount of work suddenly increases, the CPU's C-state will change. On my test system, this was revealed by launching the command dd if=/dev/zero of=/dev/null, a CPU-intense command that puts one CPU core in turbo mode to perform the task as fast as possible.
Linux power optimization and tuning
To optimize Linux power consumption, you first need to find out which system components are using the most power. For some devices, the driver provides power-tuning options. You can find an overview of these options on the Tunables tab, find the right parameter and switch it on or off. To change the current value for a setting, select it and hit Enter. The change will be applied and you'll be able to see instantly whether it has the effect you want.
Apart from the parameters that you can change directly from the PowerTOP interface, there are many other options to consider. Imagine that on a particular server file system drivers cause a lot of activity. Your best option might be to switch file systems. On a specific workload, an advanced Linux file system such as btrfs may need many more routines to do its work compared with a simpler file system such as ext3. In such situations, create a test environment and play with the different parameters.
About the author:
Sander van Vugt is an independent trainer and consultant based in the Netherlands. He is an expert in Linux high availability, virtualization and performance. He has authored many books on Linux topics, including Beginning the Linux Command Line, Beginning Ubuntu LTS Server Administration and Pro Ubuntu Server Administration.