Problem solve Get help with specific problems with your technologies, process and projects.

Analyzing and optimizing Linux power consumption with PowerTop 2

The PowerTOP tool tracks power consumption in Linux servers. You can tweak servers and applications to consume less power if you understand PowerTOP.

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.

Linux PowerTOP Overview
Figure 1. The PowerTOP overview shows which processes and devices are responsible for the highest power consumption.

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.

Linux PowerTOP Frequency stats
Figure 2. A system that doesn't do much will spend most of its time in a low-frequency mode.

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

Linux PowerTOP Tunables
Figure 3. Optimization settings from the PowerTOP interface.

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 LineBeginning Ubuntu LTS Server Administration and Pro Ubuntu Server Administration.

This was last published in July 2013

Dig Deeper on Linux servers



Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.