伺服器好慢啊~ 總之來測試一下吧 – I/O 測試結果

接續上篇的 伺服器好慢啊~ 總之來測試一下吧 – I/O 測試

測試環境

  • 硬體:
  • Raspberry Pi 4B 4G
  • Armor Sheild + 5cm 風扇
  • Kingston DataTraveler Kyson 64G (DTKN/64GB) *2
  • 軟體:
  • Ubuntu 20.04.2 LTS
  • hdparm: 9.58+ds-4 / apt
  • sysbench: 1.0.18+ds-1 / apt
  • fio: 3.16-1 / apt
  • 分割區設定:
  • MBR / FAT32 / 512K / offset=60672 (原廠預設)
  • MBR / ZFS / ZRAID-1
  • MBR / BERFS / raid1

建立 ZFS 檔案系統:

sudo zpool create Kyson raidz \
 /dev/disk/by-id/usb-Kingston_DataTraveler_3.0_408D5CBFD9DDE460B9A4AE87-0:0 \
 /dev/disk/by-id/usb-Kingston_DataTraveler_3.0_B42E99B07A9FE460B954E385-0:0

ZFS 資訊:

$ sudo zpool status
  pool: Kyson
 state: ONLINE
  scan: none requested
config:

        NAME                                                            STATE     READ WRITE CKSUM
        Kyson                                                           ONLINE       0     0     0
          raidz1-0                                                      ONLINE       0     0     0
            usb-Kingston_DataTraveler_3.0_408D5CBFD9DDE460B9A4AE87-0:0  ONLINE       0     0     0
            usb-Kingston_DataTraveler_3.0_B42E99B07A9FE460B954E385-0:0  ONLINE       0     0     0

errors: No known data errors

建立 BTRFS 檔案系統:

sudo mkfs.btrfs -m raid1 -d raid1 --force --label Kyson \
 /dev/disk/by-id/usb-Kingston_DataTraveler_3.0_408D5CBFD9DDE460B9A4AE87-0:0 \
 /dev/disk/by-id/usb-Kingston_DataTraveler_3.0_B42E99B07A9FE460B954E385-0:0

BTRFS 資訊:

btrfs-progs v5.4.1
See http://btrfs.wiki.kernel.org for more information.

Label:              Kyson
UUID:               9b055d80-ae6b-4bfd-a213-99e468d4e3d5
Node size:          16384
Sector size:        4096
Filesystem size:    115.50GiB
Block group profiles:
  Data:             RAID1             1.00GiB
  Metadata:         RAID1             1.00GiB
  System:           RAID1             8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Checksum:           crc32c
Number of devices:  2
Devices:
   ID        SIZE  PATH
    1    57.75GiB  /dev/disk/by-id/usb-Kingston_DataTraveler_3.0_408D5CBFD9DDE460B9A4AE87-0:0
    2    57.75GiB  /dev/disk/by-id/usb-Kingston_DataTraveler_3.0_B42E99B07A9FE460B954E385-0:0

hdparm 測試結果

Round #1 輸出:

/dev/sda:
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 Timing buffered disk reads: 514 MB in  3.01 seconds = 171.00 MB/sec

Timing buffered disk reads:

Round-t-t –direct
#1171.00 MB/sec174.09 MB/sec
#2173.34 MB/sec175.35 MB/sec
#3173.45 MB/sec174.29 MB/sec

根據我自己的測試, Kingston DataTraveler Kyson 在 AMD X370 平台上,可以達到 200 MB/s 左右的循序讀取性能。這次在 Raspberry Pi 上跑出這樣的成績,也算是是可圈可點。

sysbench 測試結果

Round #1 輸出:

File operations:
    reads/s:                      2.36
    writes/s:                     1.57
    fsyncs/s:                     8.37

Throughput:
    read, MiB/s:                  0.04
    written, MiB/s:               0.02

General statistics:
    total time:                          25.4375s
    total number of events:              185

Latency (ms):
         min:                                    0.00
         avg:                                   58.30
         max:                                 1617.59
         95th percentile:                      733.00
         sum:                                10784.93

Threads fairness:
    events (avg/stddev):           185.0000/0.00
    execution time (avg/stddev):   10.7849/0.00

File operations / Throughput:

Roundreads/swrites/sfsyncs/sread, MiB/swritten, MiB/s
#12.361.578.370.040.02
#21.851.235.240.030.02
#31.761.175.460.030.02
ZFS#10.340.232.910.010.00
ZFS#20.410.272.630.010.00
ZFS#30.350.241.510.010.00
BTRFS#132.7021.8075.210.510.34
BTRFS#136.2624.1783.570.570.38
BTRFS#133.4222.2871.400.520.35

Latency (ms):

Roundminavgmax95th percentile
#10.0058.301617.59733.00
#20.0078.781627.7320.74
#30.0177.373247.5518.28
ZFS#10.21462.424794.344055.23
ZFS#20.17339.244802.751618.78
ZFS#30.18200.093234.3610004.62
BTRFS#10.008.251611.2310.65
BTRFS#10.007.361620.7012.75
BTRFS#10.008.211626.8312.75

zfs 之下,寫入能力低到令人絕望,連 zfs 附帶的工具都要量不出東西了 Orz

$ sudo zpool iostat -v
                                                                  capacity     operations     bandwidth
pool                                                            alloc   free   read  write   read  write
--------------------------------------------------------------  -----  -----  -----  -----  -----  -----
Kyson                                                           3.38G   112G      0     11     13  1.99M
  raidz1                                                        3.38G   112G      0     11     13  1.99M
    usb-Kingston_DataTraveler_3.0_408D5CBFD9DDE460B9A4AE87-0:0      -      -      0      5      6  1018K
    usb-Kingston_DataTraveler_3.0_B42E99B07A9FE460B954E385-0:0      -      -      0      5      6  1018K
--------------------------------------------------------------  -----  -----  -----  -----  -----  -----

而且 CPU Load 一度高達 11,狀況好的時候也一直在 8 左右徘徊… 於是決定跳過 fio 的部份(笑)

改用 BTRFS 之後,sysbench 測試過程中的 CPU Load 一直維持在 1.x 左右徘徊,速度更是一舉超過原廠的 FAT32!!

fio 測試結果(4K Q1T1)

Command:

fio \
 --filename=fio_test \
 --size=1G \
 --rw=randrw \
 --bs=4k \
 --name=fio_test \
 --output-format=csv

Summary:

RoundRead / IOPSRead / BWWrite / IOPSWrite / BW
#15412164 KiB/s5412166 KiB/s
#26812727 KiB/s6822728 KiB/s
#36692678 KiB/s6692679 KiB/s
BTRFS#112705080 KiB/s12705082 KiB/s
BTRFS#24271709 KiB/s4271710 KiB/s
BTRFS#33031212 KiB/s3031212 KiB/s

這邊可以觀察到一個有趣的現象,因為我的測試是使用一個 script 連續執行的,可見 BTRFS 在連續的大量寫入之下,效能會逐漸遞減

Complete Latency (usec):

fio 測試結果(4K Q32T16)

Command:

fio \
 --filename=fio_test \
 --size=1G \
 --rw=randrw \
 --bs=4k \
 --iodepth=32 \
 --numjobs=16 \
 --thread \
 --group_reporting \
 --name=fio_test \
 --output-format=csv

Summary:

RoundRead / IOPSRead / BWWrite / IOPSWrite / BW
#1297311894 KiB/s297811914 KiB/s
#2314712588 KiB/s315212610 KiB/s
#3294711789 KiB/s295211809 KiB/s

在預設格式(FAT32)下 Q32T16 的整體表現相較 Q1T1 提昇了 5 倍之多,證明 Linux 佇列的實做有確實發揮作用。

不過,BTRFS 幾經測試之後,還是沒能正常完賽,因此… 同樣沒有測試結果 Orz

Complete Latency (usec):

結論

首先,USB 裝置原理上就不適合大量隨機 I/O(R.I.P. ReadyBoost),而且似乎對軟體 RAID 相當不友善,確切原因不太確定… 不過在 BTRFS 的 4KQ32T16 測試的過程中確實發現 CPU Load 逐步升高到超過 20,這時的 I/O wait 已經逼近 70%,我想應該跟 Queue 的設計有關…吧

總之,乖乖靠一個裝置做 ext4 然後搭配 rsnapshot 做備份大概才是正解。

發表迴響