本文介绍了英特尔NVMe驱动器,扇区大小非4096的xfs文件系统的性能下降的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Linux(Ubuntu 14.04)上使用NVMe卡.使用xfs文件系统(默认扇区大小为512)格式化时,我发现Intel NVMe卡的性能下降.或任何其他小于4096的扇区.

I am working with NVMe card on linux(Ubuntu 14.04).I am finding some performance degradation for Intel NVMe card when formatted with xfs file system with its default sector size(512). or any other sector size less than 4096.

在实验中,我使用默认选项的xfs文件系统对卡进行了格式化.我尝试在64k页面大小的arm64平台上以64k块大小运行fio.这是使用的命令 fio --rw=randread --bs=64k --ioengine=libaio --iodepth=8 --direct=1 --group_reporting --name=Write_64k_1 --numjobs=1 --runtime=120 --filename=new --size=20G

In the experiment I formatted the card with xfs filesystem with default options. I tried running fio with 64k block size on an arm64 platform with 64k page size.This is the command used fio --rw=randread --bs=64k --ioengine=libaio --iodepth=8 --direct=1 --group_reporting --name=Write_64k_1 --numjobs=1 --runtime=120 --filename=new --size=20G

我只能得到以下值

运行状态组0(所有作业): 读取:io = 20480MB, aggrb = 281670KB/s ,minb = 281670KB/s,maxb = 281670KB/s,mint = 744454msec,maxt = 74454msec磁盘统计信息(读/写): nvme0n1:ios = 326821/8,merge = 0/0,ticks = 582640/0,in_queue = 582370,util = 99.93%

Run status group 0 (all jobs): READ: io=20480MB, aggrb=281670KB/s, minb=281670KB/s, maxb=281670KB/s, mint=744454msec, maxt=74454msecDisk stats (read/write): nvme0n1: ios=326821/8, merge=0/0, ticks=582640/0, in_queue=582370, util=99.93%

我尝试了如下格式化:

mkfs.xfs -f -s size=4096 /dev/nvme0n1

那么这些值是:

运行状态组0(所有作业): 读取:io = 20480MB, aggrb = 781149KB/s ,minb = 781149KB/s,maxb = 781149KB/s,mint = 266847msec,最大= 26847msec磁盘统计信息(读/写): nvme0n1:ios = 326748/7,merge = 0/0,ticks = 200270/0,in_queue = 200350,util = 99.51%

Run status group 0 (all jobs): READ: io=20480MB, aggrb=781149KB/s, minb=781149KB/s, maxb=781149KB/s, mint=266847msec, maxt=26847msecDisk stats (read/write): nvme0n1: ios=326748/7, merge=0/0, ticks=200270/0, in_queue=200350, util=99.51%

  • 4k页面大小
  • 任何小于64k的块大小
  • 使用带有默认配置的ext4 fs

可能是什么问题?这是对齐问题吗?我在这里想念什么?任何帮助表示赞赏

What could be the issue? Is this any alignment issue? What Am I missing here? Any help appreciated

推荐答案

问题是您的SSD的本机扇区大小为4K.因此,应将文件系统的块大小设置为匹配,以使读取和写入在扇区边界上对齐.否则,您将拥有跨越2个扇区的块,因此需要2个扇区读取才能返回1个块(而不是1个读取).

The issue is your SSD's native sector size is 4K. So your file system's block size should be set to match so that reads and writes are aligned on sector boundaries. Otherwise you'll have blocks that span 2 sectors, and therefore require 2 sector reads to return 1 block (instead of 1 read).

如果您具有Intel SSD,则较新的驱动器具有可变的扇区大小,您可以使用其Intel固态硬盘数据中心工具进行设置.但是说实话,无论如何,4096仍可能是驱动器的真实扇区大小,使用它并设置文件系统以使其匹配,您将获得最一致的性能.

If you have an Intel SSD, the newer ones have a variable sector size you can set using their Intel Solid State Drive DataCenter Tool. But honestly 4096 is still probably the drive's true sector size anyway and you'll get the most consistent performance using it and setting your file system to match.

在Linux上的ZFS上,对于4K块,设置为ashift = 12.

On ZFS on Linux the setting is ashift=12 for 4K blocks.

这篇关于英特尔NVMe驱动器,扇区大小非4096的xfs文件系统的性能下降的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 07:26