ZFS compression as of OpenSolaris 2008.11 has a few types to choose from.
lzjb (default) | gzip | gzip-[1-9]
They are used via the zfs set compression=gzip poolname command.
The following test was quickly done out of personal interest – and is in no way scientific!
I have a AMD cpu with 3 cores (2.4Ghz). The data i copied to each of the shares consisted of video / documents / pictures and music. The first test i have done is based on compression only (i have not measured throughput)
Original Data Size : 412MB
lzjb : 312MB Compression ratio : 1.32
gzip : 293MB Compression ratio : 1.41
gzip9 : 292MB Compression ratio : 1.41
gzip is the winner on compression. With this small sample of data it is unclear if the extra CPU overhead on a gzip-9 zfs files system is worth it – from these results i would say it isn’t.
Again – gzip may be the winner on compression, but this does not reflect an improvement on throughput (untested).
Update: i’ve done a quick test on cpu load and throughput and i wouldnt recommend using gzip unless you are really limited on disk space – or have plenty of CPU to spare. lzjb is much faster (less load on cpu) and does a pretty good job for compression on the fly.
08/06/2011 Update
If you want to check the compression on a particular file you can use a combination of ls (true files size) and du (size after compression) like so…
actual size
ls -lh file*
Compressed size
du -hs file*