NVME SSD 性能不佳(仅在 Linux 上)

NVME SSD 性能不佳(仅在 Linux 上)

我使用的是 Windows 和 Ubuntu 操作系统的双启动。我有 Adata s40g NVME SSD 3500/1200 NVME m2 SSD。SSD 在我的 Windows 操作系统上执行 2200/1200,在我的 Linux 操作系统上执行 1000/400。我尝试了 wiki.debian.org 推荐的 SSD 优化。

我用 fio 工具测试的结果非常棒。但是我用 Gnome Disks 和 hdparm 工具测试的结果非常糟糕。当打开 phpStorm 等软件时,我感觉不到我用 fio 测试的速度。

我该怎么办?我需要做哪些优化?

uname -a

Linux empat 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

hdparm -tT --direct /dev/nvme0n1

/dev/nvme0n1:
 Timing O_DIRECT cached reads:   830 MB in  2.00 seconds = 414.69 MB/sec
 Timing O_DIRECT disk reads: 2940 MB in  3.00 seconds = 979.84 MB/sec

cat /sys/block/nvme0n1/queue/scheduler

[none] mq-deadline 

hdparm -v /dev/nvme0n1

 HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 244198/64/32, sectors = 500118192, start = 0

文件系统

# / was on /dev/nvme0n1p1 during installation
UUID=148d65bf-3ce9-4e33-a482-e5c9759069b0 /               ext4   discard,noatime,commit=600,errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p5 during installation
UUID=8CCF-2BC6  /boot/efi       vfat    discard,noatime,commit=600,umask=0077      0       1
# swap was on /dev/nvme0n1p3 during installation
UUID=fcda5d21-154a-4fae-84af-8e4843e757ab none            swap    sw,discard              0       0

fdisk -l

Disk /dev/nvme0n1: 238,5 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 54084620-4425-1420-1048-06C60C5CEFDE

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048 150390783 150388736  71,7G Linux filesystem
/dev/nvme0n1p3 218634240 226635775   8001536   3,8G Linux swap
/dev/nvme0n1p4 226635776 227719167   1083392   529M Windows recovery environment
/dev/nvme0n1p5 227719168 227923967    204800   100M EFI System
/dev/nvme0n1p6 227923968 227956735     32768    16M Microsoft reserved
/dev/nvme0n1p7 227956736 500117503 272160768 129,8G Microsoft basic data

Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 874FF78E-6655-4F9E-B903-C40B95318A77

Device      Start        End    Sectors   Size Type
/dev/sda1      34     262177     262144   128M Microsoft reserved
/dev/sda2  264192 1953523711 1953259520 931,4G Microsoft basic data

Partition 1 does not start on physical sector boundary.

印西-d

Drives:    HDD Total Size: 1256.3GB (14.1% used)
           ID-1: /dev/nvme0n1 model: XPG_SPECTRIX_S40G size: 256.1GB
           ID-2: /dev/sda model: WDC_WD10EZEX size: 1000.2GB
           Optical-1: /dev/sr0 model: N/A dev-links: cdrom,cdrw,dvd,dvdrw
           Features: speed: 48x multisession: yes audio: yes dvd: yes rw: cd-r,cd-rw,dvd-r,dvd-ram

串行通信

00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Root Complex
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) I/O Memory Management Unit
00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge
00:01.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe GPP Bridge
00:01.3 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe GPP Bridge
00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge
00:03.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge
00:03.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe GPP Bridge
00:04.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge
00:07.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge
00:07.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Internal PCIe GPP Bridge 0 to Bus B
00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Internal PCIe GPP Bridge 0 to Bus B
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 59)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 5
00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 6
00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 7
01:00.0 Non-Volatile memory controller: Realtek Semiconductor Co., Ltd. Device 5762 (rev 01)
02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] Device 43d5 (rev 01)
02:00.1 SATA controller: Advanced Micro Devices, Inc. [AMD] Device 43c8 (rev 01)
02:00.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43c6 (rev 01)
03:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43c7 (rev 01)
03:01.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43c7 (rev 01)
03:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43c7 (rev 01)
03:05.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43c7 (rev 01)
03:06.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43c7 (rev 01)
03:07.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43c7 (rev 01)
07:00.0 Network controller: Ralink corp. RT2790 Wireless 802.11n 1T/2R PCIe
09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 16)
0a:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X] (rev ef)
0a:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 580]
0b:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Device 145a
0b:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Platform Security Processor
0b:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] USB 3.0 Host controller
0c:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Device 1455
0c:00.2 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 51)
0c:00.3 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) HD Audio Controller

fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=write --size=500m --io_size=10g --blocksize=1024k --ioengine=libaio --fsync=10000 --iodepth=32 --direct=1 --numjobs=1 --runtime=60 --group_reporting

TEST: (g=0): rw=write, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=libaio, iodepth=32
fio-3.1
Starting 1 process
TEST: Laying out IO file (1 file / 500MiB)
Jobs: 1 (f=1): [W(1)][63.6%][r=0KiB/s,w=1196MiB/s][r=0,w=1196 IOPS][eta 00m:04s]
Jobs: 1 (f=1): [W(1)][100.0%][r=0KiB/s,w=1170MiB/s][r=0,w=1170 IOPS][eta 00m:00s]
TEST: (groupid=0, jobs=1): err= 0: pid=3364: Sat Dec 21 02:57:52 2019
  write: IOPS=984, BW=984MiB/s (1032MB/s)(10.0GiB/10406msec)
    slat (usec): min=42, max=26125, avg=119.63, stdev=564.49
    clat (msec): min=3, max=307, avg=32.21, stdev=23.62
     lat (msec): min=3, max=307, avg=32.33, stdev=23.62
    clat percentiles (msec):
     |  1.00th=[    4],  5.00th=[   17], 10.00th=[   26], 20.00th=[   27],
     | 30.00th=[   27], 40.00th=[   27], 50.00th=[   27], 60.00th=[   27],
     | 70.00th=[   28], 80.00th=[   32], 90.00th=[   41], 95.00th=[   82],
     | 99.00th=[  121], 99.50th=[  186], 99.90th=[  284], 99.95th=[  292],
     | 99.99th=[  300]
   bw (  KiB/s): min=208896, max=1222656, per=99.40%, avg=1001574.40, stdev=323115.31, samples=20
   iops        : min=  204, max= 1194, avg=978.10, stdev=315.54, samples=20
  lat (msec)   : 4=1.02%, 10=2.00%, 20=3.05%, 50=86.82%, 100=5.16%
  lat (msec)   : 250=1.68%, 500=0.28%
  cpu          : usr=4.05%, sys=7.54%, ctx=10038, majf=0, minf=12
  IO depths    : 1=0.2%, 2=0.4%, 4=0.8%, 8=1.6%, 16=3.3%, 32=93.6%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=99.8%, 8=0.0%, 16=0.0%, 32=0.2%, 64=0.0%, >=64=0.0%
     issued rwt: total=0,10240,0, short=0,0,0, dropped=0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=32

Run status group 0 (all jobs):
  WRITE: bw=984MiB/s (1032MB/s), 984MiB/s-984MiB/s (1032MB/s-1032MB/s), io=10.0GiB (10.7GB), run=10406-10406msec

Disk stats (read/write):
  nvme0n1: ios=0/41134, merge=0/97, ticks=0/1274531, in_queue=1186048, util=97.23%

fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=read --size=500m --io_size=10g --blocksize=1024k --ioengine=libaio --fsync=10000 --iodepth=32 --direct=1 --numjobs=1 --runtime=60 --group_reporting

 fio-3.1
    Starting 1 process
    Jobs: 1 (f=1): [R(1)][100.0%][r=3087MiB/s,w=0KiB/s][r=3087,w=0 IOPS][eta 00m:00s]
    TEST: (groupid=0, jobs=1): err= 0: pid=3461: Sat Dec 21 02:59:05 2019
       read: IOPS=3077, BW=3078MiB/s (3227MB/s)(10.0GiB/3327msec)
        slat (usec): min=29, max=459, avg=71.77, stdev=26.48
        clat (usec): min=2423, max=27253, avg=10198.97, stdev=2090.10
         lat (usec): min=2501, max=27330, avg=10271.30, stdev=2087.83
        clat percentiles (usec):
         |  1.00th=[ 2573],  5.00th=[ 6652], 10.00th=[10159], 20.00th=[10159],
         | 30.00th=[10159], 40.00th=[10290], 50.00th=[10290], 60.00th=[10290],
         | 70.00th=[10290], 80.00th=[10290], 90.00th=[10421], 95.00th=[12125],
         | 99.00th=[18482], 99.50th=[19268], 99.90th=[23987], 99.95th=[25560],
         | 99.99th=[26870]
       bw (  MiB/s): min= 3044, max= 3088, per=99.98%, avg=3077.33, stdev=16.72, samples=6
       iops        : min= 3044, max= 3088, avg=3077.33, stdev=16.72, samples=6
      lat (msec)   : 4=2.64%, 10=5.57%, 20=91.67%, 50=0.13%
      cpu          : usr=0.96%, sys=23.60%, ctx=10096, majf=0, minf=8204
      IO depths    : 1=0.2%, 2=0.4%, 4=0.8%, 8=1.6%, 16=3.3%, 32=93.6%, >=64=0.0%
         submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
         complete  : 0=0.0%, 4=99.8%, 8=0.0%, 16=0.0%, 32=0.2%, 64=0.0%, >=64=0.0%
         issued rwt: total=10240,0,0, short=0,0,0, dropped=0,0,0
         latency   : target=0, window=0, percentile=100.00%, depth=32

    Run status group 0 (all jobs):
       READ: bw=3078MiB/s (3227MB/s), 3078MiB/s-3078MiB/s (3227MB/s-3227MB/s), io=10.0GiB (10.7GB), run=3327-3327msec

相关内容