Linux 硬碟讀、寫速度測試

2024-03-31

測試方式,直接用 dd 讀寫硬碟

1G 檔案寫入測試
w@devp213 ~ $ time dd if=/dev/zero of=testfile bs=10M count=100
100+0 records in
100+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 1.99501 s, 526 MB/s

real    0m1.997s
user    0m0.000s
sys     0m1.019s

2G 檔案寫入測試
w@devp213 ~ $ time dd if=/dev/zero of=testfile bs=10M count=200
200+0 records in
200+0 records out
2097152000 bytes (2.1 GB, 2.0 GiB) copied, 7.30609 s, 287 MB/s

real    0m7.441s
user    0m0.003s
sys     0m2.109s


1G 檔案讀取測試 
w@devp213 ~ $ time dd if=testfile of=/dev/null bs=10M count=100
100+0 records in
100+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 0.831506 s, 1.3 GB/s

real    0m0.833s
user    0m0.000s
sys     0m0.602s

2G 檔案讀取測試 
w@devp213 ~ $ time dd if=testfile of=/dev/null bs=10M count=200
200+0 records in
200+0 records out
2097152000 bytes (2.1 GB, 2.0 GiB) copied, 0.85449 s, 2.5 GB/s

real    0m0.856s
user    0m0.002s
sys     0m0.759s

寫入速度測試 比較

硬碟規格 寫入 1G 寫入 2G 寫入 3G 寫入 4G 寫入 5G
PVE VM 傳統硬碟 526 MB/s 287 MB/s 325 MB/s 176 MB/s 119 MB/s
AWS 150GB gp2 8core 450 IOPS 1.9 GB/s 1.8 GB/s 667 MB/s 362 MB/s 270 MB/s
AWS 20GB gp2 2core 100 IOPS 157 MB/s 86.8 MB/s 77.4 MB/s
AWS 20GB gp3 2core 3000 IOPS 154 MB/s 78.4 MB/s 74.1 MB/s
GCP 200GB SSD 653 MB/s 819 MB/s 1.0 GB/s 983 MB/s 779 MB/s
GCP 2T HDD 70.2 MB/s 39.7 MB/s
Linode 50GB HDD 276 MB/s 760 MB/s 593 MB/s 884 MB/s 791 MB/s

讀取速度測試 比較

硬碟規格 讀取 1G
PVE VM 傳統硬碟 1.3 GB/s
AWS 150GB gp2 8core 450 IOPS 4.1 GB/s
AWS 20GB gp2 2core 100 IOPS 3.7 GB/s
AWS 20GB gp3 2core 3000 IOPS 4.6 GB/s
GCP 200GB SSD 2.8 GB/s
GCP 2T HDD 3.0 GB/s
Linode 50GB HDD 1.9 G/s

fio 測試

AWS ec2 4core 8GB (td82)
150GB gp2 450 IOPS

寫入速度測試
$ fio --directory=/tmp --ioengine=psync --name fio_test_file --direct=1 --rw=randwrite --bs=16k --size=1G --numjobs=10 --time_based --runtime=180 --group_reporting --norandommap

fio_test_file: (g=0): rw=randwrite, bs=16K-16K/16K-16K/16K-16K, ioengine=psync, iodepth=1
...
fio-2.14
Starting 10 processes
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
fio_test_file: Laying out IO file(s) (1 file(s) / 1024MB)
Jobs: 10 (f=10): [w(10)] [100.0% done] [0KB/44624KB/0KB /s] [0/2789/0 iops] [eta 00m:00s]
fio_test_file: (groupid=0, jobs=10): err= 0: pid=22629: Thu Apr 18 04:45:55 2024
  write: io=7745.2MB, bw=44060KB/s, iops=2753, runt=180004msec
    clat (usec): min=494, max=57454, avg=3628.56, stdev=1780.42
     lat (usec): min=495, max=57455, avg=3629.26, stdev=1780.41
    clat percentiles (usec):
     |  1.00th=[  996],  5.00th=[ 2224], 10.00th=[ 2544], 20.00th=[ 2992],
     | 30.00th=[ 3152], 40.00th=[ 3248], 50.00th=[ 3312], 60.00th=[ 3408],
     | 70.00th=[ 3568], 80.00th=[ 3824], 90.00th=[ 4320], 95.00th=[ 5664],
     | 99.00th=[12864], 99.50th=[13888], 99.90th=[16192], 99.95th=[16768],
     | 99.99th=[21888]
    lat (usec) : 500=0.01%, 750=0.18%, 1000=0.85%
    lat (msec) : 2=2.69%, 4=81.30%, 10=12.63%, 20=2.34%, 50=0.01%
    lat (msec) : 100=0.01%
  cpu          : usr=0.19%, sys=0.67%, ctx=499468, majf=0, minf=94
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=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=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued    : total=r=0/w=495687/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  WRITE: io=7745.2MB, aggrb=44060KB/s, minb=44060KB/s, maxb=44060KB/s, mint=180004msec, maxt=180004msec

Disk stats (read/write):
  nvme0n1: ios=3/568179, merge=0/5711, ticks=4/2177780, in_queue=2042892, util=100.00%


讀取速度測試
$ fio --directory=/tmp                  --name fio_test_file --direct=1 --rw=randread --bs=16k --size=1G --numjobs=10 --time_based --runtime=180 --group_reporting --norandommap

fio_test_file: (g=0): rw=randread, bs=16K-16K/16K-16K/16K-16K, ioengine=psync, iodepth=1
...
fio-2.14
Starting 10 processes
Jobs: 10 (f=10): [r(10)] [100.0% done] [90912KB/0KB/0KB /s] [5682/0/0 iops] [eta 00m:00s]
fio_test_file: (groupid=0, jobs=10): err= 0: pid=22812: Thu Apr 18 04:49:20 2024
  read : io=9118.5MB, bw=51873KB/s, iops=3242, runt=180003msec
    clat (usec): min=1, max=33818, avg=3082.51, stdev=1091.14
     lat (usec): min=1, max=33818, avg=3082.68, stdev=1091.14
    clat percentiles (usec):
     |  1.00th=[    3],  5.00th=[    6], 10.00th=[ 1928], 20.00th=[ 2800],
     | 30.00th=[ 3088], 40.00th=[ 3216], 50.00th=[ 3312], 60.00th=[ 3376],
     | 70.00th=[ 3472], 80.00th=[ 3632], 90.00th=[ 3984], 95.00th=[ 4320],
     | 99.00th=[ 5152], 99.50th=[ 5728], 99.90th=[ 7840], 99.95th=[ 8768],
     | 99.99th=[11200]
    lat (usec) : 2=0.01%, 4=2.60%, 10=4.31%, 20=0.07%, 50=0.05%
    lat (usec) : 100=0.02%, 250=0.01%, 500=0.48%, 750=0.38%, 1000=0.15%
    lat (msec) : 2=2.54%, 4=79.50%, 10=9.86%, 20=0.02%, 50=0.01%
  cpu          : usr=0.18%, sys=0.40%, ctx=542662, majf=0, minf=134
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=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=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued    : total=r=583580/w=0/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: io=9118.5MB, aggrb=51872KB/s, minb=51872KB/s, maxb=51872KB/s, mint=180003msec, maxt=180003msec

Disk stats (read/write):
  nvme0n1: ios=542187/496, merge=0/147, ticks=1783688/2304, in_queue=1634744, util=100.00%



GCP 1core 8G
ssd 200G

寫入速度測試
$ fio --directory=/tmp --ioengine=psync --name fio_test_file --direct=1 --rw=randwrite --bs=16k --size=1G --numjobs=10 --time_based --runtime=180 --group_reporting --norandommap
fio_test_file: (g=0): rw=randwrite, bs=(R) 16.0KiB-16.0KiB, (W) 16.0KiB-16.0KiB, (T) 16.0KiB-16.0KiB, ioengine=psync, iodepth=1
...
fio-3.7
Starting 10 processes
Jobs: 10 (f=10): [w(10)][100.0%][r=0KiB/s,w=8632KiB/s][r=0,w=539 IOPS][eta 00m:00s]
fio_test_file: (groupid=0, jobs=10): err= 0: pid=31824: Thu Apr 18 13:01:59 2024
  write: IOPS=556, BW=8908KiB/s (9122kB/s)(1566MiB/180019msec)
    clat (usec): min=492, max=208128, avg=17956.38, stdev=3609.84
     lat (usec): min=493, max=208129, avg=17957.49, stdev=3609.85
    clat percentiles (msec):
     |  1.00th=[   16],  5.00th=[   17], 10.00th=[   17], 20.00th=[   18],
     | 30.00th=[   18], 40.00th=[   18], 50.00th=[   18], 60.00th=[   18],
     | 70.00th=[   18], 80.00th=[   18], 90.00th=[   19], 95.00th=[   20],
     | 99.00th=[   22], 99.50th=[   33], 99.90th=[   61], 99.95th=[   74],
     | 99.99th=[  174]
   bw (  KiB/s): min=  384, max= 1696, per=10.00%, avg=890.69, stdev=60.41, samples=3600
   iops        : min=   24, max=  106, avg=55.62, stdev= 3.78, samples=3600
  lat (usec)   : 500=0.01%, 750=0.18%, 1000=0.04%
  lat (msec)   : 2=0.01%, 4=0.02%, 10=0.03%, 20=97.25%, 50=2.27%
  lat (msec)   : 100=0.16%, 250=0.03%
  cpu          : usr=0.04%, sys=0.27%, ctx=101091, majf=0, minf=305
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=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=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=0,100231,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  WRITE: bw=8908KiB/s (9122kB/s), 8908KiB/s-8908KiB/s (9122kB/s-9122kB/s), io=1566MiB (1642MB), run=180019-180019msec

Disk stats (read/write):
  sda: ios=221/108483, merge=9/303, ticks=9112/2162240, in_queue=2171377, util=100.00%




讀取速度測試
$ fio --directory=/tmp                  --name fio_test_file --direct=1 --rw=randread --bs=16k --size=1G --numjobs=10 --time_based --runtime=180 --group_reporting --norandommap

fio_test_file: (g=0): rw=randread, bs=(R) 16.0KiB-16.0KiB, (W) 16.0KiB-16.0KiB, (T) 16.0KiB-16.0KiB, ioengine=psync, iodepth=1
...
fio-3.7
Starting 10 processes
Jobs: 10 (f=10): [r(10)][100.0%][r=4708KiB/s,w=0KiB/s][r=294,w=0 IOPS][eta 00m:00s]
fio_test_file: (groupid=0, jobs=10): err= 0: pid=31961: Thu Apr 18 13:05:35 2024
   read: IOPS=292, BW=4674KiB/s (4786kB/s)(822MiB/180034msec)
    clat (usec): min=288, max=124773, avg=34227.49, stdev=5843.76
     lat (usec): min=288, max=124773, avg=34227.82, stdev=5843.76
    clat percentiles (msec):
     |  1.00th=[   25],  5.00th=[   28], 10.00th=[   31], 20.00th=[   31],
     | 30.00th=[   32], 40.00th=[   35], 50.00th=[   35], 60.00th=[   35],
     | 70.00th=[   35], 80.00th=[   35], 90.00th=[   39], 95.00th=[   46],
     | 99.00th=[   57], 99.50th=[   64], 99.90th=[   81], 99.95th=[   92],
     | 99.99th=[  106]
   bw (  KiB/s): min=  320, max= 1056, per=10.00%, avg=467.23, stdev=31.98, samples=3600
   iops        : min=   20, max=   66, avg=29.14, stdev= 2.02, samples=3600
  lat (usec)   : 500=0.14%, 750=0.02%, 1000=0.01%
  lat (msec)   : 2=0.01%, 10=0.03%, 20=0.09%, 50=97.28%, 100=2.41%
  lat (msec)   : 250=0.02%
  cpu          : usr=0.03%, sys=0.09%, ctx=52608, majf=0, minf=375
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=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=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=52590,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: bw=4674KiB/s (4786kB/s), 4674KiB/s-4674KiB/s (4786kB/s-4786kB/s), io=822MiB (862MB), run=180034-180034msec

Disk stats (read/write):
  sda: ios=52733/324, merge=7/2084, ticks=1805411/16190, in_queue=1821736, util=100.00%


分類:網站設計      59
Tag dd ,
留言

留言
top