我打算使用ZFS进行备份。 5-10台服务器将通过DRBD将更新“stream”到ZFS文件系统上的超大文件(每个500 GB)。
服务器将产生大约每秒20兆字节的随机写入,总计大约100MB。 我不读这些文件,所以模式应该几乎100%写入。
对我来说抄写是非常重要的function。
据我了解,COW应该将随机写入转换为顺序写入。 但是这没有发生。
我使用12个SAS驱动器E5520 XEON(4核)和24 GB RAM在服务器上进行了testing,随机写入非常低。
我决定先在同一台服务器上的1个SAS硬盘上进行debugging。
我创build了EXT4文件系统并做了一些testing:
root @ zfs:/ mnt / hdd / test#dd if = / dev / zero = tempfile bs = 1M count = 4096 conv = fdatasync,notrunc 4096 + 0logging在 4096 + 0logging 4294967296字节(4.3 GB)复制,30.2524 s,142 MB / s
所以我可以看到写入速度约为140 MBps。
随机写入〜500 KBps〜100-150个iops。 这是正常的。
fio --randrepeat = 1 --ioengine = libaio --direct = 1 --gtod_reduce = 1 --name = test --filename = test --bs = 4k --iodepth = 1 --size = 4G --readwrite = randwrite testing:(g = 0):rw = randwrite,bs = 4K-4K / 4K-4K / 4K-4K,ioengine = libaio,iodepth = 1 FIO-2.1.11 启动1个进程 bs:1(f = 1):[w(1)] [0.6%完成] [0KB / 548KB / 0KB / s] [0/137/0 iops] [eta 02h:02m:57s]
然后在同一个驱动器上创buildZFS:
zpool create -f -m / mnt / data bigdata scsi-35000cca01b370274
我设置logging大小为4K,因为我将有4K随机写入。 logging尺寸4K在我testing的时候比128k好得多。
zfs设置recordsize = 4k bigdata
testing随机写入4G文件。
fio --randrepeat = 1 --ioengine = libaio --gtod_reduce = 1 --name =。/ test --filename = test --bs = 4k --iodepth = 1 --size = 4G --readwrite = randwrite ./test:(g = 0):rw = randwrite,bs = 4K-4K / 4K-4K / 4K-4K,ioengine = libaio,iodepth = 1 FIO-2.1.11 启动1个进程 ./test:放置IO文件(1个文件/ 4096MB) 工作:1(f = 1):[w(1)] [100.0%完成] [0KB / 115.9MB / 0KB / s] [0 / 29.7K / 0 iops] [ [eta 00m:00s]
看起来COW在这里的performance每秒115.9MB。
testing随机写入16G文件。
fio --randrepeat = 1 --ioengine = libaio --gtod_reduce = 1 --name = test --filename =。/ test16G --bs = 4k --iodepth = 1 --size = 16G --readwrite = randwrite testing:(g = 0):rw = randwrite,bs = 4K-4K / 4K-4K / 4K-4K,ioengine = libaio,iodepth = 1 FIO-2.1.11 启动1个进程 bs:1(f = 1):[w(1)] [0.1%完成] [0KB / 404KB / 0KB / s] [0/101/0 iops] [eta 02h:08m:55s]
非常差的结果每秒400千字节。
尝试与8G文件相同:
fio --randrepeat = 1 --ioengine = libaio --gtod_reduce = 1 --name = test --filename =。/ test8G --bs = 4k --iodepth = 1 --size = 8G --readwrite = randwrite testing:(g = 0):rw = randwrite,bs = 4K-4K / 4K-4K / 4K-4K,ioengine = libaio,iodepth = 1 FIO-2.1.11 启动1个进程 testing:布置IO文件(1个文件/ 8192MB) bs:1(f = 1):[w(1)] [14.5%完成] [0KB / 158.3MB / 0KB / s] [0 / 40.6K / 0 iops] [eta 00m:53s]
刚开始的时候,COW的速度是每秒136兆字节。
设备:rrqm / s wrqm / sr / sw / s rMB / s wmb / s avgrq-sz avgqu -sz await r_await w_await svctm%util sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdg 0.00 0.00 0.00 1120.00 0.00 136.65 249.88 9.53 8.51 0.00 8.51 0.89 99.24
但最终当testing达到90%时,写入速度降到了每秒5兆字节。
设备:rrqm / s wrqm / sr / sw / s rMB / s wmb / s avgrq-sz avgqu -sz await r_await w_await svctm%util sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sdg 0.00 0.00 0.00 805.90 0.00 5.33 13.54 9.95 12.34 0.00 12.34 1.24 100.00
所以4G文件是好的,8G几乎好,但16G文件没有得到任何COW。
不明白这里发生了什么。 也许内存caching在这里扮演着angular色。
操作系统:Debian 8 ZFS ver 500.没有压缩或重复数据删除。
zpool列表
名称大小ALLOC免费EXPANDSZ碎片帽DEDUP健康ALTROOT
bigdata 1.81T 64.4G 1.75T - 2%3%1.00x在线 -
root @ zfs:/ mnt / data / test#zdb
大数据:
版本:5000
名字:'bigdata'
状态:0
txg:4
pool_guid:16909063556944448541
勘误表:0
hostid:8323329
主机名:'zfs'
vdev_children:1
vdev_tree:
键入:'root'
ID:0
guid:16909063556944448541
create_txg:4
儿童[0]:
键入:'disk'
ID:0
guid:8547466691663463210
path:'/ dev / disk / by-id / scsi-35000cca01b370274-part1'
whole_disk:1
metaslab_array:34
metaslab_shift:34
ashift:9
asize:2000384688128
is_log:0
create_txg:4
features_for_read:
com.delphix:hole_birth
com.delphix:embedded_data
zpool状态bigdata
游泳池:bigdata
状态:在线
扫描:没有要求
configuration:
名称状态读写CKSUM
bigdata在线0 0 0
scsi-35000cca01b370274 ONLINE 0 0 0
错误:没有已知的数据错误
fio不能在ZFS上使用O_DIRECT,我不得不在没有它的情况下运行。 据我所知,应该会产生更好的结果。 但是这并没有发生。
fio --randrepeat = 1 --ioengine = libaio --direct = 1 --gtod_reduce = 1 --name =。/ test --filename = test16G --bs = 4k --iodepth = 1 --size = 16G - 读写= randwrite ./test:(g = 0):rw = randwrite,bs = 4K-4K / 4K-4K / 4K-4K,ioengine = libaio,iodepth = 1 FIO-2.1.11 启动1个进程 fio:看起来像你的文件系统不支持direct = 1 / buffered = 0 fio:目标不支持O_DIRECT