奇怪的ZFS性能与4K池块大小?

我开始看ZFS,在旧的惠普微服务器(N40L)上使用FreeNAS进行testing。 没有获得额外的内存,所以它只能运行2 GB,所以几乎没有caching。

我在单个1TB SATA磁盘上创build了一个池,创build了一个zvol,并将其导出为iSCSI。 我只是在Windows 10上使用CrystalDiskMark进行了一些testing,在更改池的块大小时,我得到了奇怪的结果。

ZFS 16K和NTFS 4K

----------------------------------------------------------------------- CrystalDiskMark 5.1.0 x64 (C) 2007-2015 hiyohiyo Crystal Dew World : http://crystalmark.info/ ----------------------------------------------------------------------- * MB/s = 1,000,000 bytes/s [SATA/600 = 600,000,000 bytes/s] * KB = 1000 bytes, KiB = 1024 bytes Sequential Read (Q= 32,T= 1) : 105.938 MB/s Sequential Write (Q= 32,T= 1) : 98.709 MB/s Random Read 4KiB (Q= 32,T= 1) : 8.330 MB/s [ 2033.7 IOPS] Random Write 4KiB (Q= 32,T= 1) : 6.243 MB/s [ 1524.2 IOPS] Sequential Read (T= 1) : 93.946 MB/s Sequential Write (T= 1) : 72.780 MB/s Random Read 4KiB (Q= 1,T= 1) : 8.948 MB/s [ 2184.6 IOPS] Random Write 4KiB (Q= 1,T= 1) : 6.898 MB/s [ 1684.1 IOPS] Test : 1024 MiB [X: 0.0% (0.2/849.9 GiB)] (x1) [Interval=5 sec] Date : 2016/01/12 18:54:05 OS : Windows 10 Professional [10.0 Build 10586] (x64) 

与客户端PC中用作SATA磁盘的同一磁盘相比,我所期望的一切都是如此。
– 由于iSCSI开销,有点顺序的性能会丢失。
– 随机读取更好,有些caching在那里。
– 随机写入更好,因为COW使得写入不是实际上随机的。

ZFS 4K和NTFS 4K

 ----------------------------------------------------------------------- CrystalDiskMark 5.1.0 x64 (C) 2007-2015 hiyohiyo Crystal Dew World : http://crystalmark.info/ ----------------------------------------------------------------------- * MB/s = 1,000,000 bytes/s [SATA/600 = 600,000,000 bytes/s] * KB = 1000 bytes, KiB = 1024 bytes Sequential Read (Q= 32,T= 1) : 24.405 MB/s Sequential Write (Q= 32,T= 1) : 81.038 MB/s Random Read 4KiB (Q= 32,T= 1) : 3.048 MB/s [ 744.1 IOPS] Random Write 4KiB (Q= 32,T= 1) : 55.971 MB/s [ 13664.8 IOPS] Sequential Read (T= 1) : 42.362 MB/s Sequential Write (T= 1) : 45.292 MB/s Random Read 4KiB (Q= 1,T= 1) : 0.961 MB/s [ 234.6 IOPS] Random Write 4KiB (Q= 1,T= 1) : 9.576 MB/s [ 2337.9 IOPS] Test : 1024 MiB [X: 0.0% (0.2/799.9 GiB)] (x1) [Interval=5 sec] Date : 2016/01/12 19:10:22 OS : Windows 10 Professional [10.0 Build 10586] (x64) 

一些注意事项:
– networking使用率不超过600 Mb(Windows 10上的任务pipe理器),因此比第一次testing中的使用率低。
– CPU使用率大约是第一次testing的两倍,但仍至less有20%的空闲(在FreeNAS服务器上最高)

在这里我没有想到!
– 顺序性能较低。 也许更小的数据包传输,所以networking不完全使用?
– 较低的随机读取。 这实际上只是caching,而不是磁盘性能。 但为什么lesscaching?
随机写入更好Q = 32。 在前面的testing中写入4K时,我会说ZFS写入16K(12K空)。 这是真的吗?

回复你的笔记:

  1. networking利用率不应该是罪魁祸首,因为标准的以太网帧最多不超过1500字节(不包括巨型帧)。 降低的读取性能似乎与FS和设备alignment有关。 你可以仔细检查一下吗? 无论如何,这也可能是由于更多的碎片化
  2. 较小的块不容易caching。 但是,这可能是WindowscachingiSCSI磁盘的副作用
  3. 随着更高的队列深度,Windows和FreeNAS IO调度程序都有机会重新sorting和合并多个写入。 但是这个优化似乎只适用于小的(4KB)IO请求。 也许更大(> = 16KB)IO请求以不同的方式处理。

如果您在ZFS中使用zvols,非Solaris发行版的最佳做法是使用较大的块大小。 在Linux下,我们创build了128K块大小的zvols。

你可以尝试做同样的事情吗?

我知道我没有足够的内存,所以没有数据被caching,但是看起来像2 GB甚至不足以将元数据存储在4K块大小的RAM中 – 更多地阻塞了更多的元数据。 如果元数据不在RAM中,则必须从磁盘读取元数据以查找可用空间并杀死性能。

我有8 GB的ECC内存,做了更多的testing,仍然是单一的磁盘。 当ZFS和NTFS块大小匹配且顺序写入性能相同时,结果现在是有意义的,随机写入性能会更好。

块的大小可能会影响连续的速度,但它受到networking的限制。 我会做更多的testing,如果我得到额外的网卡做多path。

ZFS 4K和NTFS 4K

  Sequential Read (Q= 32,T= 1) : 118.472 MB/s Sequential Write (Q= 32,T= 1) : 101.721 MB/s Random Read 4KiB (Q= 32,T= 1) : 115.943 MB/s [ 28306.4 IOPS] Random Write 4KiB (Q= 32,T= 1) : 88.872 MB/s [ 21697.3 IOPS] Sequential Read (T= 1) : 102.555 MB/s Sequential Write (T= 1) : 80.744 MB/s Random Read 4KiB (Q= 1,T= 1) : 9.668 MB/s [ 2360.4 IOPS] Random Write 4KiB (Q= 1,T= 1) : 9.410 MB/s [ 2297.4 IOPS] 

ZFS 8K和NTFS 4K

  Sequential Read (Q= 32,T= 1) : 118.154 MB/s Sequential Write (Q= 32,T= 1) : 102.506 MB/s Random Read 4KiB (Q= 32,T= 1) : 113.806 MB/s [ 27784.7 IOPS] Random Write 4KiB (Q= 32,T= 1) : 73.798 MB/s [ 18017.1 IOPS] Sequential Read (T= 1) : 106.324 MB/s Sequential Write (T= 1) : 91.004 MB/s Random Read 4KiB (Q= 1,T= 1) : 10.161 MB/s [ 2480.7 IOPS] Random Write 4KiB (Q= 1,T= 1) : 9.628 MB/s [ 2350.6 IOPS] 

ZFS 8K和NTFS 8K

  Sequential Read (Q= 32,T= 1) : 118.051 MB/s Sequential Write (Q= 32,T= 1) : 99.229 MB/s Random Read 4KiB (Q= 32,T= 1) : 113.327 MB/s [ 27667.7 IOPS] Random Write 4KiB (Q= 32,T= 1) : 75.365 MB/s [ 18399.7 IOPS] Sequential Read (T= 1) : 106.110 MB/s Sequential Write (T= 1) : 87.242 MB/s Random Read 4KiB (Q= 1,T= 1) : 9.880 MB/s [ 2412.1 IOPS] Random Write 4KiB (Q= 1,T= 1) : 9.878 MB/s [ 2411.6 IOPS] 

ZFS 16K和NTFS 4K

  Sequential Read (Q= 32,T= 1) : 118.040 MB/s Sequential Write (Q= 32,T= 1) : 100.274 MB/s Random Read 4KiB (Q= 32,T= 1) : 114.780 MB/s [ 28022.5 IOPS] Random Write 4KiB (Q= 32,T= 1) : 6.014 MB/s [ 1468.3 IOPS] Sequential Read (T= 1) : 108.443 MB/s Sequential Write (T= 1) : 90.182 MB/s Random Read 4KiB (Q= 1,T= 1) : 11.281 MB/s [ 2754.2 IOPS] Random Write 4KiB (Q= 1,T= 1) : 8.229 MB/s [ 2009.0 IOPS] 

ZFS 16K和NTFS 8K

  Sequential Read (Q= 32,T= 1) : 118.046 MB/s Sequential Write (Q= 32,T= 1) : 99.386 MB/s Random Read 4KiB (Q= 32,T= 1) : 115.745 MB/s [ 28258.1 IOPS] Random Write 4KiB (Q= 32,T= 1) : 51.101 MB/s [ 12475.8 IOPS] Sequential Read (T= 1) : 105.913 MB/s Sequential Write (T= 1) : 91.225 MB/s Random Read 4KiB (Q= 1,T= 1) : 10.244 MB/s [ 2501.0 IOPS] Random Write 4KiB (Q= 1,T= 1) : 9.373 MB/s [ 2288.3 IOPS] 

ZFS 16K和NTFS 16K

  Sequential Read (Q= 32,T= 1) : 118.046 MB/s Sequential Write (Q= 32,T= 1) : 101.422 MB/s Random Read 4KiB (Q= 32,T= 1) : 113.856 MB/s [ 27796.9 IOPS] Random Write 4KiB (Q= 32,T= 1) : 40.821 MB/s [ 9966.1 IOPS] Sequential Read (T= 1) : 107.572 MB/s Sequential Write (T= 1) : 89.345 MB/s Random Read 4KiB (Q= 1,T= 1) : 11.112 MB/s [ 2712.9 IOPS] Random Write 4KiB (Q= 1,T= 1) : 9.691 MB/s [ 2366.0 IOPS] 

有关信息,本地连接的同一个磁盘 – NTFS 4K

  Sequential Read (Q= 32,T= 1) : 130.080 MB/s Sequential Write (Q= 32,T= 1) : 121.335 MB/s Random Read 4KiB (Q= 32,T= 1) : 1.005 MB/s [ 245.4 IOPS] Random Write 4KiB (Q= 32,T= 1) : 1.290 MB/s [ 314.9 IOPS] Sequential Read (T= 1) : 129.997 MB/s Sequential Write (T= 1) : 128.324 MB/s Random Read 4KiB (Q= 1,T= 1) : 0.406 MB/s [ 99.1 IOPS] Random Write 4KiB (Q= 1,T= 1) : 1.307 MB/s [ 319.1 IOPS]