I did a quick check about what ZFS compression brings in terms of IO performance and I also measured the impact on power consumption - a good opportunity to familiarize with the OpenSolaris Power Management. This article describes my experiment and provides the results.

Performance gain is realistically predictable: I have a single hard-disk on my laptop, so disk IOs should be the major bottleneck when accessing data. Compressing data on disk reduces the number of IO operations, hence the traffic through the bottleneck. Even if CPU gets more load with data compression/decompression, I am not expecting it to be really stressed, and I am looking for the overall impact to be positive.

Numbers showed that I was right. For those on a rush, numbers are at the bottom of this article, including disk-space saving.

Where it gets more interesting is when the power consumption gets into the picture. On the one hand, if compression creates an extra CPU load I should see more power consumption from the CPU, especially if the CPU clock speed depends on the load. In turn, this could generate enough heat to wake up or speed up the fan, hence another increase in power consumption. On the other hand, since the number of IOs is reduced, I should expect a decrease in the disk power consumption. Finally, with the experiment running faster, the power consumption duration should be reduced, hence a decrease.

A long story short, before running the experiment, I had no idea what the bottom line would be in terms of power consumption.

Now, let's get to the facts.

My computer is a Toshiba laptop running OpenSolaris 2009.06 on a dual-core Intel CPU. OpenSolaris actually reports 2 CPUs running, as expected:
$ psrinfo
0 on-line since 10/14/2009 21:58:54
1 on-line since 10/14/2009 21:58:59

I activated the CPU clock throttling by adding the following lines in the /etc/power.conf file:
cpupm enable poll-mode
cpu-threshold 5s

After modifying the file I need to run pmconfig manually:

root@pelvoux:~# pmconfig
With these values, the power manager polls the idleness of the CPU and manages its power if it's idle for 5 seconds or more.

To check whether the clock throttling is activate, I use powertop (to be run as root):

By running powertop on an idle system, I can see for how long the CPU is running at different power - or idle - states. Ideally, an idle system spends 100% of its time running at the lowest power state, but because of background activities it can consume more power than it could.

Here, I check that my CPU can run at 4 different clock speeds - from 1 to 2GHz. Also it has 2 levels of idleness, namely C0 and C1. An idle level is where the CPU shuts down some of its components and ceases to execute, reducing the energy consumption. The deeper the state, the greater the portion of the processor that is shut down. C-states are numbered C0 through CN, 0 being an active level and N the deepest possible idle level. When my system is idle it spends 89% of its time in an energy-saving mode. The other 11%, it runs at the lowest clock speed available. Not bad, though I wished the active time could go under 5%.

As per the battery (I am using a laptop), powertop reports that it is fully charged and that the system is running on AC power. As a result of running on AC power, the power usage estimate is not available (the tool actually reports a value of 0.000W). On this specific point, when running the experiment, I removed the battery to make sure that the system does not consume energy for recharging it.

To gain an extra power-saving, I also reduced the brightness of my screen to the minimum. To do so start the Power Manager from the System/Preferences menu:

As per the storage, my laptop has a single hard-disk, and I didn't do anything specific to reduce its power consumption so I am expecting it to be always spinning, which is not a problem for the experiment because the disk needs to spin anyway when reading or writing data to it.

In this configuration and running on power AC, my power meter reports my laptop to be just bellow 22 Watts when idle. If running on the battery, powertop reports it to be at 19 Watts, while I am not expecting any gain in power saving when moving to the battery.

I guess the extra 3 Watts are consumed by the power supply itself, not to mention that my power meter has to deal with an alternating current and may or may not take into account the power factor - cos(phy) - that is specific to AC, when the voltage and the intensity are not in sync.

Anyway, what is really important is to measure the difference in power consumption when experimenting with or without the ZFS compression, and has already mentioned, I did that after removing the battery - hence running on the power AC, all the measurements being done with the power meter.

So, let's get down to the experiment itself, and to some results.

Take a large file - mine is a 4.8 GByte - that already exists on a ZFS file-system that has compression off (this is the default), and copy it using cp on the same file system:
$ ls -l
-rw------- 1 tmanfe staff 4820369920 2009-10-20 16:53 OpenSolaris2009.06.vdi
$ time cp OpenSolaris2009.06.vdi foo.vdi

real 7m19.340s
user 0m0.091s
sys 0m7.135s
Then create a new ZFS file-system and turn compression on:
# zfs create rpool/compressFS
# zfs set compression=on rpool/compressFS
# zfs get compression rpool/compressFS
rpool/compressFS compression on local

Once compression is active, copy the large file to the new file system and run the cp experiment again:
$ time cp OpenSolaris2009.06.vdi foo.vdi
real 5m26.479s
user 0m0.126s
sys 0m6.878s
$ zfs get compressratio rpool/compressFS
rpool/compressFS compressratio 1.77x -

5m26sec with compression versus 7m19sec without, or a 1.35x gain with compression. And for the space saving, a 1.77x gain.

I will be posting more soon on this experiment and especially about the power consumption results. So stay connected!