Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Fajar A. Nugraha
On Tue, Jul 10, 2012 at 4:25 PM, Jordi Espasa Clofent
jespa...@minibofh.org wrote:
 Hi all,

 By default I'm using ZFS for all the zones:

 admjoresp@cyd-caszonesrv-15:~$ zfs list
 NAME USED  AVAIL  REFER  MOUNTPOINT
 opt 4.77G  45.9G   285M  /opt
 opt/zones   4.49G  45.9G29K  /opt/zones
 opt/zones/glad-gm02-ftcl01   367M  45.9G   367M  /opt/zones/glad-gm02-ftcl01
 opt/zones/glad-gp02-ftcl01   502M  45.9G   502M  /opt/zones/glad-gp02-ftcl01
 opt/zones/glad-gp02-ftcl02  1.21G  45.9G  1.21G  /opt/zones/glad-gp02-ftcl02
 opt/zones/mbd-tcasino-02 257M  45.9G   257M  /opt/zones/mbd-tcasino-02
 opt/zones/mbd-tcasino-04 281M  45.9G   281M  /opt/zones/mbd-tcasino-04
 opt/zones/mbfd-gp02-ftcl01   501M  45.9G   501M  /opt/zones/mbfd-gp02-ftcl01
 opt/zones/mbfd-gp02-ftcl02   475M  45.9G   475M  /opt/zones/mbfd-gp02-ftcl02
 opt/zones/mbhd-gp02-ftcl01   475M  45.9G   475M  /opt/zones/mbhd-gp02-ftcl01
 opt/zones/mbhd-gp02-ftcl02   507M  45.9G   507M  /opt/zones/mbhd-gp02-ftcl02

 However, I have the compression disabled in all of them.

 According to this Oracle whitepaper
 http://www.oracle.com/technetwork/server-storage/solaris10/solaris-zfs-in-containers-wp-167903.pdf:

 The next example demonstrates the compression property. If compression is
 enabled, Oracle Solaris ZFS will transparently compress all of the data
 before it is written to disk. The benefits of compression
 are both saved disk space and possible write speed improvements.

 What exactly means POSSIBLE write speed improvements?

compression = possibly less data  to write (depending on the data) =
possibly faster writes

Some data is not compressible (e.g. mpeg4 movies), so in that case you
won't see any improvements.

-- 
Fajar
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Jordi Espasa Clofent

On 2012-07-10 11:34, Fajar A. Nugraha wrote:


compression = possibly less data  to write (depending on the data) =
possibly faster writes

Some data is not compressible (e.g. mpeg4 movies), so in that case you
won't see any improvements.


Thanks for your answer Fajar.

As I said in my initial mail, those zones are mainly only writing some 
Glassfish logs. Since they all are text files, I guess I can save a lot 
of space using compression. Hopefully I can even improve the 
performance. Can I?


However. What's the difference using

zfs set compression=on opt/zones/whatever_zone

or

zfs set compression=gzip-6 opt/zones/whatever_zone

or

zfs set compression=gzip-9 opt/zones/whatever_zone


TIA.


--
I will face my fear. I will permit it to pass over me and through me.
And when it has gone past I will turn the inner eye to see its path.
Where the fear has gone there will be nothing. Only I will remain.
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Ian Collins

On 07/10/12 09:25 PM, Jordi Espasa Clofent wrote:

Hi all,

By default I'm using ZFS for all the zones:

admjoresp@cyd-caszonesrv-15:~$ zfs list
NAME USED  AVAIL  REFER  MOUNTPOINT
opt 4.77G  45.9G   285M  /opt
opt/zones   4.49G  45.9G29K  /opt/zones
opt/zones/glad-gm02-ftcl01   367M  45.9G   367M  /opt/zones/glad-gm02-ftcl01
opt/zones/glad-gp02-ftcl01   502M  45.9G   502M  /opt/zones/glad-gp02-ftcl01
opt/zones/glad-gp02-ftcl02  1.21G  45.9G  1.21G  /opt/zones/glad-gp02-ftcl02
opt/zones/mbd-tcasino-02 257M  45.9G   257M  /opt/zones/mbd-tcasino-02
opt/zones/mbd-tcasino-04 281M  45.9G   281M  /opt/zones/mbd-tcasino-04
opt/zones/mbfd-gp02-ftcl01   501M  45.9G   501M  /opt/zones/mbfd-gp02-ftcl01
opt/zones/mbfd-gp02-ftcl02   475M  45.9G   475M  /opt/zones/mbfd-gp02-ftcl02
opt/zones/mbhd-gp02-ftcl01   475M  45.9G   475M  /opt/zones/mbhd-gp02-ftcl01
opt/zones/mbhd-gp02-ftcl02   507M  45.9G   507M  /opt/zones/mbhd-gp02-ftcl02

However, I have the compression disabled in all of them.

According to this Oracle whitepaper
http://www.oracle.com/technetwork/server-storage/solaris10/solaris-zfs-in-containers-wp-167903.pdf:

The next example demonstrates the compression property. If compression
is enabled, Oracle Solaris ZFS will transparently compress all of the
data before it is written to disk. The benefits of compression
are both saved disk space and possible write speed improvements.

What exactly means POSSIBLE write speed improvements?


With compression enabled, less data has to be written to disk, so N 
bytes writes in N/compress ratio time.


On most systems, the performance cost of compressing and uncompressing 
data is relatively low.

As you can see above I don't use to have any room problems, so if I'm
going to enable the compression flag it has to be because of the write
speed improvements.


I always enable compression by default and only turn it off for 
filesystems I know hold un-compressible data such as media files.


--
Ian.

___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Fajar A. Nugraha
On Tue, Jul 10, 2012 at 4:40 PM, Jordi Espasa Clofent
jespa...@minibofh.org wrote:
 On 2012-07-10 11:34, Fajar A. Nugraha wrote:

 compression = possibly less data  to write (depending on the data) =
 possibly faster writes

 Some data is not compressible (e.g. mpeg4 movies), so in that case you
 won't see any improvements.


 Thanks for your answer Fajar.

 As I said in my initial mail, those zones are mainly only writing some
 Glassfish logs. Since they all are text files, I guess I can save a lot of
 space using compression. Hopefully I can even improve the performance. Can
 I?


correct.

Even normal OS files are usually compressible-enough. For example,
this is my root partition (Ubuntu, but uses zfs nontheles)

$ sudo zfs get compression,compressratio C/ROOT/precise
NAMEPROPERTY   VALUE SOURCE
C/ROOT/precise  compressiongzip  inherited from C
C/ROOT/precise  compressratio  2.48x -

so on that dataset I save over 50% I/O read/writes (in bytes)

 However. What's the difference using

 zfs set compression=on opt/zones/whatever_zone

on = standard LZJB compression (very fast, but doesn't compress much)


 or

 zfs set compression=gzip-6 opt/zones/whatever_zone

gzip-6 and gzip uses gzip compression. Fast enough, good compression.


 or

 zfs set compression=gzip-9 opt/zones/whatever_zone

gzip-9 = uses gzip's best, but also slowest, compression

-- 
Fajar
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Jordi Espasa Clofent

Thanks for you explanation Fajar. However, take a look on the next lines:

# available ZFS in the system

root@sct-caszonesrv-07:~# zfs list
NAME USED  AVAIL  REFER  MOUNTPOINT
opt  532M  34.7G   290M  /opt
opt/zones243M  34.7G32K  /opt/zones
opt/zones/sct-scw02-shared   243M  34.7G   243M  /opt/zones/sct-scw02-shared
static   104K  58.6G34K  /var/www/

# creating a file in /root (UFS)

root@sct-caszonesrv-07:~# dd if=/dev/zero of=file.bin count=1024 bs=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.0545957 s, 19.2 MB/s
root@sct-caszonesrv-07:~# pwd
/root

# enable compression in some ZFS zone

root@sct-caszonesrv-07:~# zfs set compression=on opt/zones/sct-scw02-shared

# copying the previos file to this zone

root@sct-caszonesrv-07:~# cp /root/file.bin 
/opt/zones/sct-scw02-shared/root/


# checking the file size in the origin dir (UFS) and the destination one 
(ZFS with compression enabled)


root@sct-caszonesrv-07:~# ls -lh /root/file.bin
-rw-r--r-- 1 root root 1.0M Jul 10 13:21 /root/file.bin

root@sct-caszonesrv-07:~# ls -lh /opt/zones/sct-scw02-shared/root/file.bin
-rw-r--r-- 1 root root 1.0M Jul 10 13:22 
/opt/zones/sct-scw02-shared/root/file.bin


# the both files has exactly the same cksum!

root@sct-caszonesrv-07:~# cksum /root/file.bin
3018728591 1048576 /root/file.bin

root@sct-caszonesrv-07:~# cksum /opt/zones/sct-scw02-shared/root/file.bin
3018728591 1048576 /opt/zones/sct-scw02-shared/root/file.bin

So... I don't see any size variation with this test.
Actually I tried the same with compression=gzip/gzip-6 or even gzip-9 
and is always the same. I understand it shouldn't be?


What am I missing or doing wrong?

More info about the system:

root@sct-caszonesrv-07:~# cat /etc/release
Oracle Solaris 10 8/11 s10x_u10wos_17b X86
  Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights 
reserved.

Assembled 23 August 2011


--
I will face my fear. I will permit it to pass over me and through me.
And when it has gone past I will turn the inner eye to see its path.
Where the fear has gone there will be nothing. Only I will remain.
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Ferenc-Levente Juhos
Of course you don't see any difference, this is how it should work.
'ls' will never report the compressed size, because it's not aware of it.
Nothing is aware of the compression and decompression that takes place
on-the-fly, except of course zfs.

That's the reason why you could gain in write and read speed if you use
compression, because the actual amount of compressed data that is being
written and read from the pool is smaller than the original data. And I
think with the checksum test you prooved that zfs checksums the
uncompressed data.

Regards,
Feci

On Tue, Jul 10, 2012 at 1:29 PM, Jordi Espasa Clofent jespa...@minibofh.org
 wrote:

 Thanks for you explanation Fajar. However, take a look on the next lines:

 # available ZFS in the system

 root@sct-caszonesrv-07:~# zfs list

 NAME USED  AVAIL  REFER  MOUNTPOINT
 opt  532M  34.7G   290M  /opt
 opt/zones243M  34.7G32K  /opt/zones
 opt/zones/sct-scw02-shared   243M  34.7G   243M
  /opt/zones/sct-scw02-shared
 static   104K  58.6G34K  /var/www/

 # creating a file in /root (UFS)

 root@sct-caszonesrv-07:~# dd if=/dev/zero of=file.bin count=1024 bs=1024
 1024+0 records in
 1024+0 records out
 1048576 bytes (1.0 MB) copied, 0.0545957 s, 19.2 MB/s
 root@sct-caszonesrv-07:~# pwd
 /root

 # enable compression in some ZFS zone

 root@sct-caszonesrv-07:~# zfs set compression=on
 opt/zones/sct-scw02-shared

 # copying the previos file to this zone

 root@sct-caszonesrv-07:~# cp /root/file.bin /opt/zones/sct-scw02-shared/**
 root/

 # checking the file size in the origin dir (UFS) and the destination one
 (ZFS with compression enabled)

 root@sct-caszonesrv-07:~# ls -lh /root/file.bin
 -rw-r--r-- 1 root root 1.0M Jul 10 13:21 /root/file.bin

 root@sct-caszonesrv-07:~# ls -lh /opt/zones/sct-scw02-shared/**
 root/file.bin
 -rw-r--r-- 1 root root 1.0M Jul 10 13:22 /opt/zones/sct-scw02-shared/**
 root/file.bin

 # the both files has exactly the same cksum!

 root@sct-caszonesrv-07:~# cksum /root/file.bin
 3018728591 1048576 /root/file.bin

 root@sct-caszonesrv-07:~# cksum /opt/zones/sct-scw02-shared/**
 root/file.bin
 3018728591 1048576 /opt/zones/sct-scw02-shared/**root/file.bin

 So... I don't see any size variation with this test.
 Actually I tried the same with compression=gzip/gzip-6 or even gzip-9 and
 is always the same. I understand it shouldn't be?

 What am I missing or doing wrong?

 More info about the system:

 root@sct-caszonesrv-07:~# cat /etc/release
 Oracle Solaris 10 8/11 s10x_u10wos_17b X86
   Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights
 reserved.
 Assembled 23 August 2011



 --
 I will face my fear. I will permit it to pass over me and through me.
 And when it has gone past I will turn the inner eye to see its path.
 Where the fear has gone there will be nothing. Only I will remain.
  __**_
 zfs-discuss mailing list
 zfs-discuss@opensolaris.org
 http://mail.opensolaris.org/**mailman/listinfo/zfs-discusshttp://mail.opensolaris.org/mailman/listinfo/zfs-discuss

___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Edward Ned Harvey
 From: zfs-discuss-boun...@opensolaris.org [mailto:zfs-discuss-
 boun...@opensolaris.org] On Behalf Of Jordi Espasa Clofent
 
 root@sct-caszonesrv-07:~# zfs set compression=on opt/zones/sct-scw02-
 shared

If you use compression=on, or lzjb, then you're using very fast compression.
Should not hurt performance, in fact, may gain performance for highly
compressible data.

If you use compression=gzip (or any gzip level 1 thru 9) then you're using a
fairly expensive compression algorithm.  It will almost certainly hurt
performance, but you may gain more disk space. (Probably not.)


 # copying the previos file to this zone
 
 ...
 # checking the file size in the origin dir (UFS) and the destination one
 (ZFS with compression enabled)
 
 ...
 
 # the both files has exactly the same cksum!

When you enable filesystem compression, it is all done behind the scenes.
It is intended to look and behave exactly the same at the file level, so you
should not see any difference in your files.  Your files should appear to be
exactly the same, and have exactly the same size and checksum as you
otherwise would have expected.  It would be bad if you had to explain to
your users, Hey you guys, I've enabled filesystem compression, so you
should expect all your files to have different sizes and different
checksums.  The compression  decompression happen at a low level - So all
your applications don't know about it.  

If you want to see the difference in disk usage, I believe df and du
will report different things...  Or perhaps ls -l versus du ... 

___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Darren J Moffat

On 07/10/12 12:45, Ferenc-Levente Juhos wrote:

Of course you don't see any difference, this is how it should work.
'ls' will never report the compressed size, because it's not aware of
it. Nothing is aware of the compression and decompression that takes
place on-the-fly, except of course zfs.
That's the reason why you could gain in write and read speed if you use
compression, because the actual amount of compressed data that is being
written and read from the pool is smaller than the original data. And I
think with the checksum test you prooved that zfs checksums the
uncompressed data.


No ZFS checksums are over the data as it is stored on disk so the 
compressed data.


--
Darren J Moffat
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Jordi Espasa Clofent

On 2012-07-10 13:45, Ferenc-Levente Juhos wrote:

Of course you don't see any difference, this is how it should work.
'ls' will never report the compressed size, because it's not aware of
it. Nothing is aware of the compression and decompression that takes
place on-the-fly, except of course zfs.


Yep, my fault. You are right:
root@sct-caszonesrv-07:/opt/test# du -hs u*
1.4Munix1
820Kunix2


Good article in here:
https://blogs.oracle.com/observatory/entry/zfs_compression_a_win_win


That's the reason why you could gain in write and read speed if you use
compression, because the actual amount of compressed data that is being
written and read from the pool is smaller than the original data. And I
think with the checksum test you prooved that zfs checksums the
uncompressed data.


Thanks for the explanation.
--
I will face my fear. I will permit it to pass over me and through me.
And when it has gone past I will turn the inner eye to see its path.
Where the fear has gone there will be nothing. Only I will remain.
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Mike Gerdts
On Tue, Jul 10, 2012 at 6:29 AM, Jordi Espasa Clofent
jespa...@minibofh.org wrote:
 Thanks for you explanation Fajar. However, take a look on the next lines:

 # available ZFS in the system

 root@sct-caszonesrv-07:~# zfs list

 NAME USED  AVAIL  REFER  MOUNTPOINT
 opt  532M  34.7G   290M  /opt
 opt/zones243M  34.7G32K  /opt/zones
 opt/zones/sct-scw02-shared   243M  34.7G   243M  /opt/zones/sct-scw02-shared
 static   104K  58.6G34K  /var/www/

 # creating a file in /root (UFS)

 root@sct-caszonesrv-07:~# dd if=/dev/zero of=file.bin count=1024 bs=1024
 1024+0 records in
 1024+0 records out
 1048576 bytes (1.0 MB) copied, 0.0545957 s, 19.2 MB/s
 root@sct-caszonesrv-07:~# pwd
 /root

 # enable compression in some ZFS zone

 root@sct-caszonesrv-07:~# zfs set compression=on opt/zones/sct-scw02-shared

 # copying the previos file to this zone

 root@sct-caszonesrv-07:~# cp /root/file.bin
 /opt/zones/sct-scw02-shared/root/

 # checking the file size in the origin dir (UFS) and the destination one
 (ZFS with compression enabled)

 root@sct-caszonesrv-07:~# ls -lh /root/file.bin
 -rw-r--r-- 1 root root 1.0M Jul 10 13:21 /root/file.bin

 root@sct-caszonesrv-07:~# ls -lh /opt/zones/sct-scw02-shared/root/file.bin
 -rw-r--r-- 1 root root 1.0M Jul 10 13:22
 /opt/zones/sct-scw02-shared/root/file.bin

 # the both files has exactly the same cksum!

 root@sct-caszonesrv-07:~# cksum /root/file.bin
 3018728591 1048576 /root/file.bin

 root@sct-caszonesrv-07:~# cksum /opt/zones/sct-scw02-shared/root/file.bin
 3018728591 1048576 /opt/zones/sct-scw02-shared/root/file.bin

 So... I don't see any size variation with this test.

ls(1) tells you how much data is in the file - that is, how many bytes
of data that an application will see if it reads the whole file.
du(1) tells you how many disk blocks are used.  If you look at the
stat structure in stat(2), ls reports st_size, du reports st_blocks.

Blocks full of zeros are special to zfs compression - it recognizes
them and stores no data.  Thus, a file that contains only zeros will
only require enough space to hold the file metadata.

$ zfs list -o compression ./
COMPRESS
  on

$ dd if=/dev/zero of=1gig count=1024 bs=1024k
1024+0 records in
1024+0 records out

$ ls -l 1gig
-rw-r--r--   1 mgerdts  staff1073741824 Jul 10 07:52 1gig

$ du -k 1gig
0   1gig

-- 
Mike Gerdts
http://mgerdts.blogspot.com/
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Jim Klimov

2012-07-10 15:49, Edward Ned Harvey wrote:

If you use compression=on, or lzjb, then you're using very fast compression.
Should not hurt performance, in fact, may gain performance for highly
compressible data.

If you use compression=gzip (or any gzip level 1 thru 9) then you're using a
fairly expensive compression algorithm.  It will almost certainly hurt
performance, but you may gain more disk space. (Probably not.)


Well, as far as the discussion relates to zones, the WORM
(write once - read many) type of data, such as the OS image
of the local zone, can suffer gzip-9 compression during
installation of the zone and applications. This may make
your files consume less disk sectors and further reads can
be faster. Then you can enable lzjb on the same dataset,
and further writes (of logs) would be compressed faster.

In fact, you might want to delegate a dataset to the
zone and create several filesystems in it, with different
compression options, for your logs, application data and
perhaps databases (which may be sensitive to IO block size
and dislike external compression in favor of speeds). For
these there is a zle compression which only compresses
blocks filled with zeroes - that allows to save some space
when your DB precreates a huge storage file but only uses
a few kilobytes in it.

I am not qualified to state whether gzip decompression might
be slower during reads than lzjb or not, but remember that
all this relies on general assumption that current CPUs are
overqualified for their jobs and have lots of spare cycles -
so (de)compression has little impact on real work anyway.
Also decompression tends to be faster than compression,
because there is little to no analysis to do - only matching
compressed tags to a dictionary of original data snippets.

HTH,
//Jim Klimov
___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss


Re: [zfs-discuss] Benefits of enabling compression in ZFS for the zones

2012-07-10 Thread Richard Elling
To amplify what Mike says...

On Jul 10, 2012, at 5:54 AM, Mike Gerdts wrote:
 ls(1) tells you how much data is in the file - that is, how many bytes
 of data that an application will see if it reads the whole file.
 du(1) tells you how many disk blocks are used.  If you look at the
 stat structure in stat(2), ls reports st_size, du reports st_blocks.
 
 Blocks full of zeros are special to zfs compression - it recognizes
 them and stores no data.  Thus, a file that contains only zeros will
 only require enough space to hold the file metadata.
 
 $ zfs list -o compression ./
 COMPRESS
  on
 
 $ dd if=/dev/zero of=1gig count=1024 bs=1024k
 1024+0 records in
 1024+0 records out
 
 $ ls -l 1gig
 -rw-r--r--   1 mgerdts  staff1073741824 Jul 10 07:52 1gig

ls -ls shows the length (as in -l) and size (as in -s, units=blocks)
So you can see that it takes only space for metadata.
   1 -rw-r--r--   1 root root 1073741824 Nov 26 06:52 1gig
size  length


 -- richard

--
ZFS Performance and Training
richard.ell...@richardelling.com
+1-760-896-4422







___
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss