Deduplication (dedup) VS CompressionOS: Fedora18_x86_64
ZFS 파일시스템에 compress과 dedup 비교
- zpool 설정
# zpool create compress_test sdb
# zpool create dedup_test sdc
1. 디스크 효율성 기능 비교
- 옵션적용
# zfs set compression=on compress_test
# zfs get dedup,compression compress_test
NAME PROPERTY VALUE SOURCE
compress_test dedup off default
compress_test compression on local
# zfs set dedup=on dedup_test
# zfs get dedup,compression dedup_test
NAME PROPERTY VALUE SOURCE
dedup_test dedup on local
dedup_test compression off default
1) CentOS 가 설치되어있는 qcow2 이미지 1개 다운로드후 비교
이미지 용량 : 약 11G
# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
compress_test 2.72T 5.47G 2.71T 0% 1.00x ONLINE -
dedup_test 2.72T 10.3G 2.71T 0% 1.01x ONLINE -
# zdb -S compress_test
Simulated DDT histogram:
bucket allocated(할당데이타) referenced(참조데이타)
=>물리적인 디스크싸이즈 => Pool에서 참조되는 논리디스크
______ ______________________________ ______________________________
refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
------ ------ ----- ----- ----- ------ ----- ----- -----
1 80.6K 10.1G 5.28G 5.40G 80.6K 10.1G 5.28G 5.40G
2 488 61M 26.6M 27.4M 977 122M 53.1M 54.8M
4 1 128K 4.50K 8K 4 512K 18K 32K
64 1 128K 4.50K 8K 123 15.4M 554K 984K
256 1 128K 4.50K 8K 264 33M 1.16M 2.06M
Total 81.1K 10.1G 5.30G 5.43G 81.9K 10.2G 5.33G 5.46G
dedup = 1.01, compress = 1.92, copies = 1.02, dedup * compress / copies = 1.89
(중복제거율)
# zdb -S dedup_test
Simulated DDT histogram:
bucket allocated referenced
______ ______________________________ ______________________________
refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
------ ------ ----- ----- ----- ------ ----- ----- -----
1 80.6K 10.1G 10.1G 10.1G 80.6K 10.1G 10.1G 10.1G
2 488 61M 61M 61M 977 122M 122M 122M
4 1 128K 128K 128K 4 512K 512K 512K
64 1 128K 128K 128K 123 15.4M 15.4M 15.4M
256 1 128K 128K 128K 264 33M 33M 33M
Total 81.1K 10.1G 10.1G 10.1G 81.9K 10.2G 10.2G 10.2G
dedup = 1.01, compress = 1.00, copies = 1.00, dedup * compress / copies = 1.01
(중복제거율)
※ 파일에 따라서 차이는 있겠지만 현재 OS이미지만을 가지고 비교했을때는 compress 옵션적용된 디스크에 활용도 배이상 높다. 또한 기본 OS 이미지에는 dedup(중복제거) 데이타가 거의 존재하지 않는듯...
2) 기본 OS qcow2 이미지 16개 다운로드후 비교 (운영체제는 Ubuntu 버전별 CentOS 버전별로...)
# zpool list
# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
backup 2.72T 124G 2.60T 4% 1.00x ONLINE -
compress_test 2.72T 31.3G 2.69T 1% 1.00x ONLINE -
dedup_test 2.72T 33.2G 2.69T 1% 2.18x ONLINE -
# zdb -S compress_test
Simulated DDT histogram:
bucket allocated referenced
______ ______________________________ ______________________________
refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
------ ------ ----- ----- ----- ------ ----- ----- -----
1 159K 19.9G 10.1G 10.4G 159K 19.9G 10.1G 10.4G
2 78.4K 9.80G 5.17G 5.29G 215K 26.9G 14.2G 14.5G
4 23.6K 2.96G 1.51G 1.54G 96.5K 12.1G 6.13G 6.29G
8 117 14.6M 4.65M 4.86M 1.11K 142M 38.7M 40.7M
16 2 256K 9K 16K 44 5.50M 198K 352K
64 1 128K 4.50K 8K 70 8.75M 315K 560K
128 1 128K 4.50K 8K 253 31.6M 1.11M 1.98M
256 3 384K 13.5K 24K 1.13K 145M 5.08M 9.04M
1K 2 256K 9K 16K 2.86K 367M 12.9M 22.9M
2K 1 128K 4.50K 8K 2.40K 307M 10.8M 19.2M
Total 261K 32.7G 16.8G 17.2G 479K 59.8G 30.5G 31.3G
dedup = 1.82, compress = 1.96, copies = 1.02, dedup * compress / copies = 3.48
==> 59.8 / 32.7 = 약 1.82
압축이 적용된 상태에서 dedup 옵션을 사용하게된다면 중복제거율 1.82 , compress(압축율) 1.96
토탈 3.48 정도의 디스크 효율성
# du -sh *
636M 1.qcow2
5.5G 2.qcow2
5.5G 3.qcow2
5.5G 4.qcow2
6.6G 5.qcow2
902M 6.qcow2
736M 7.qcow2
698M 8.qcow2
823M 9.qcow2
761M 10.qcow2
818M 11.qcow2
775M 12.qcow2
805M 13.qcow2
670M 14.qcow2
987M 15.qcow2
==> 실제 파일싸이즈도 실제 파일크기보다 압축률/중복제거율에 따라 상당히 감소
# zdb -S dedup_test
Simulated DDT histogram:
bucket allocated referenced
______ ______________________________ ______________________________
refcnt blocks LSIZE PSIZE DSIZE blocks LSIZE PSIZE DSIZE
------ ------ ----- ----- ----- ------ ----- ----- -----
1 159K 19.9G 19.9G 19.9G 159K 19.9G 19.9G 19.9G
2 78.4K 9.80G 9.80G 9.80G 215K 26.9G 26.9G 26.9G
4 23.6K 2.96G 2.96G 2.96G 96.5K 12.1G 12.1G 12.1G
8 117 14.6M 14.6M 14.6M 1.11K 142M 142M 142M
16 2 256K 256K 256K 44 5.50M 5.50M 5.50M
64 1 128K 128K 128K 70 8.75M 8.75M 8.75M
128 1 128K 128K 128K 253 31.6M 31.6M 31.6M
256 3 384K 384K 384K 1.13K 145M 145M 145M
1K 2 256K 256K 256K 2.86K 367M 367M 367M
2K 1 128K 128K 128K 2.40K 307M 307M 307M
64K 1 128K 128K 128K 92.5K 11.6G 11.6G 11.6G
Total 261K 32.7G 32.7G 32.7G 571K 71.4G 71.4G 71.4G
dedup = 2.19, compress = 1.00, copies = 1.00, dedup * compress / copies = 2.19
==> 71.4 / 32.7 = 약 2.19
압축옵션을 활성화시킨 파티션과 동일한 데이타지만 압축이 되어있지 않았기에 중복제거율이 높아짐을 볼수있다.
# du -sh *
1.3G 1.qcow2
11G 2.qcow2
11G 3.qcow2
11G 4.qcow2
13G 5.qcow2
1.7G 6.qcow2
2.9G 7.qcow2
2.8G 8.qcow2
3.1G 9.qcow2
3.0G 10.qcow2
3.1G 11.qcow2
3.0G 12.qcow2
3.2G 13.qcow2
2.9G 14.qcow2
2.1G 15.qcow2
결론) 대부분의 케이스에서는 compression(압축)이 디스크 용량을 효율적으로 사용하기에 유리하며 dedup(중복제거) 은 백업, 소스버전관리와 같은 중복되는 데이타가 많을경우에 사용하는게 효율적이다.
2. 디스크 I/O 성능비교
# compressing
읽기(Read)
dd if=Ubuntu_12.04_64_100G.qcow2 of=aa.img bs=1024k count=10000
3.90671 s, 837 MB/s
3.84815 s, 849 MB/s
3.84842 s, 849 MB/s
쓰기(Write)
dd of=Ubuntu_12.04_64_100G.qcow2 if=aa.img bs=1024k count=10000
3.85243 s, 848 MB/s
3.85717 s, 847 MB/s
3.8246 s, 855 MB/s
# dedup
읽기(Read)
dd if=Ubuntu_12.04_64_100G.qcow2 of=aa.img bs=1024k count=10000
30.3455 s, 108 MB/s
18.505 s, 177 MB/s
17.3722 s, 188 MB/s
쓰기(Write)
dd of=Ubuntu_12.04_64_100G.qcow2 if=aa.img bs=1024k count=10000
17.6155 s, 186 MB/s
17.7228 s, 184 MB/s
17.8607 s, 183 MB/s