4

i have a new storage server with 6 x 8TB WD Red HDDs. They build a RAID 6 with mdadm and a chunk size of 256k. On top of that mdraid i have LVM which then holds the different filesystems.

Initially i wanted to use XFS as filesystem, but the performance tests showed a really bad write performance with XFS compared to the LV directly or to an EXT4 filesystem.

OS is CentOS 7.4 with kernel 3.10.0-693.17.1.el7.x86_64 and system is up to date.

The disks are all partitioned like /dev/sda:

[root@storage01 srv]# gdisk -l /dev/sda            
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 15628053168 sectors, 7.3 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): A3B2B5F3-A8B5-43D2-AC55-5626C2720BB8
Partition table holds up to 128 entries
First usable sector is 2048, last usable sector is 15628053134
Partitions will be aligned on 2048-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048     15628053134   7.3 TiB     FD00  

Raid setup:

[root@storage01 srv]# mdadm -D /dev/md125 
/dev/md125:
           Version : 1.2
     Creation Time : Thu Feb  8 16:00:59 2018
        Raid Level : raid6
        Array Size : 31255577600 (29807.64 GiB 32005.71 GB)
     Used Dev Size : 7813894400 (7451.91 GiB 8001.43 GB)
      Raid Devices : 6
     Total Devices : 6
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Fri Feb  9 11:17:35 2018
             State : clean 
    Active Devices : 6
   Working Devices : 6
    Failed Devices : 0
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 256K

Consistency Policy : bitmap

              Name : storage01:data01
              UUID : 6b35b4d5:2162fd15:416d044f:111423ce
            Events : 10675

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       2       8       65        2      active sync   /dev/sde1
       3       8       81        3      active sync   /dev/sdf1
       4       8       97        4      active sync   /dev/sdg1
       5       8      113        5      active sync   /dev/sdh1

The LVM PV is aligned.

[root@storage01 srv]# pvs -o +pe_start
  PV         VG       Fmt  Attr PSize   PFree   1st PE 
  /dev/md125 vgdata01 lvm2 a--  <29,11t <17,11t   1,00m

Write performance to the LV:

[root@storage01 srv]# for seq in 1 2 3; do dd if=/dev/zero of=/dev/vgdata01/test bs=1M status=progress count=4000 oflag=direct; done
4022337536 bytes (4.0 GB) copied, 11.025562 s, 365 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 11.4962 s, 365 MB/s
4000317440 bytes (4.0 GB) copied, 11.020342 s, 363 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 11.5861 s, 362 MB/s
4069523456 bytes (4.1 GB) copied, 12.157936 s, 335 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 12.5316 s, 335 MB/s

Write performance to the EXT4 formatted LV:

[root@storage01 srv]# mkfs.ext4 /dev/vgdata01/test
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=64 blocks, Stripe width=256 blocks
67108864 inodes, 268435456 blocks
13421772 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2415919104
8192 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
        102400000, 214990848

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done     

[root@storage01 srv]# mount /dev/vgdata01/test test/
[root@storage01 srv]# for seq in 1 2 3; do dd if=/dev/zero of=/srv/test/testfile bs=1M status=progress count=4000 oflag=direct; done
3921674240 bytes (3.9 GB) copied, 12.090828 s, 324 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 12.9574 s, 324 MB/s
4031774720 bytes (4.0 GB) copied, 13.084728 s, 308 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 13.5805 s, 309 MB/s
4060086272 bytes (4.1 GB) copied, 12.015387 s, 338 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 12.4678 s, 336 MB/s

Write performance to the XFS formatted LV:

[root@storage01 srv]# mkfs.xfs -f /dev/vgdata01/test
meta-data=/dev/vgdata01/test     isize=512    agcount=32, agsize=8388544 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=268433408, imaxpct=25
         =                       sunit=64     swidth=256 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=131071, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@storage01 srv]# mount /dev/vgdata01/test test/
[root@storage01 srv]# for seq in 1 2 3; do dd if=/dev/zero of=/srv/test/testfile bs=1M status=progress count=4000 oflag=direct; done
4168089600 bytes (4.2 GB) copied, 69.997794 s, 59.5 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 70.4337 s, 59.5 MB/s
4190109696 bytes (4.2 GB) copied, 70.142401 s, 59.7 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 70.2062 s, 59.7 MB/s
4179623936 bytes (4.2 GB) copied, 69.903270 s, 59.8 MB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 70.1522 s, 59.8 MB/s

According the output of mkfs.xfs, xfs successfully detected the raid geometry and adjusted sunit = 64 = 64 x 4k block size = 256k and swidth = 256 x 4k block size = 1024k.

Does anybody have a clue why XFS is so slow in this setup?

Kind regards

Output of dstat --disk-util -D sda,sdb,sde,sdf,sdg,sdh while running the above dd command against the XFS formatted LV:

[root@storage01 ~]# dstat --disk-util -D sda,sdb,sde,sdf,sdg,sdh
sda--sdb--sde--sdf--sdg--sdh-
util:util:util:util:util:util
4.09:4.07:4.16:4.14:4.19:4.16
   0:   0:   0:   0:   0:   0
   0:   0:   0:   0:   0:   0
4.60:4.60:4.60:4.60:4.60:4.60
91.7:80.8:94.2:92.0:91.9:91.2
24.2:23.0:24.4:26.3:27.6:24.2
29.1:27.8:28.6:26.8:28.3:27.7
27.3:23.3:28.3:29.0:29.2:20.3
29.3:28.3:28.6:27.7:27.2:26.0
24.8:21.4:24.6:24.5:22.9:26.1
23.0:28.2:27.0:29.6:30.0:26.0
23.5:25.9:26.8:22.2:22.7:23.6
22.6:23.2:22.5:24.6:23.2:22.0
23.1:22.2:24.7:22.9:24.9:23.9
21.4:22.6:23.7:24.1:20.7:27.7
32.3:28.2:31.3:27.2:30.2:27.0
25.4:22.8:23.6:23.9:20.2:24.3
23.0:21.3:23.0:24.1:27.2:22.8
23.4:27.2:23.8:25.2:25.5:26.5
27.7:26.5:33.5:29.5:34.5:28.8
20.6:25.2:23.6:25.4:24.5:24.9
23.3:24.5:25.6:22.8:22.9:21.8
23.7:21.0:27.9:25.7:27.6:23.4
27.1:24.8:21.7:27.1:23.4:27.0
31.1:24.1:29.3:27.7:32.0:27.3
23.6:24.3:23.9:26.5:22.2:24.4
29.0:26.1:26.7:27.5:28.5:27.5
24.9:23.8:23.4:19.8:24.5:21.5
26.9:25.5:28.3:25.1:24.7:24.7
21.4:21.5:21.2:24.2:24.1:23.8
26.4:23.8:24.8:24.0:22.0:22.4
23.6:24.1:25.8:23.2:24.2:20.6
29.8:30.7:32.8:29.1:33.0:28.3
24.5:21.2:26.7:21.3:25.0:23.5
21.3:22.5:24.8:24.9:23.3:22.4
23.2:27.7:24.0:23.6:25.3:25.5
22.3:24.4:23.0:25.5:24.1:23.4
30.8:27.9:32.6:30.1:29.0:29.5
22.7:23.6:21.9:24.8:24.2:24.2
23.6:23.6:26.7:24.0:24.7:22.6
23.2:24.3:23.8:25.3:25.6:25.2
28.5:28.9:32.6:23.9:30.4:27.3
22.1:24.8:24.7:20.2:24.0:22.8
23.8:26.4:23.3:19.0:25.6:24.1
20.7:27.3:22.8:22.6:20.9:26.2
30.9:29.7:33.2:30.2:32.4:33.1
sda--sdb--sde--sdf--sdg--sdh-
util:util:util:util:util:util
25.2:20.8:25.8:21.6:26.0:24.8
24.3:21.6:24.7:19.7:24.3:24.5
25.6:24.4:23.9:24.1:21.8:27.0
25.7:22.9:23.9:26.7:25.0:26.7
28.8:26.4:31.9:22.8:33.4:28.0
23.1:25.2:23.3:20.8:24.0:24.1
22.6:23.4:25.3:20.5:23.4:26.4
25.2:25.2:23.8:22.2:27.6:25.1
33.0:29.2:32.1:24.4:32.3:28.6
22.5:24.4:27.3:22.0:23.2:25.0
27.1:27.5:25.9:27.3:31.3:31.0
24.3:21.7:22.5:24.4:25.1:22.8
25.3:25.8:26.2:25.4:29.1:25.9
24.1:23.4:26.6:20.0:22.6:22.8
23.9:23.8:22.1:22.2:24.3:29.2
22.2:22.8:23.6:25.6:24.2:23.1
24.4:22.1:24.3:24.2:26.7:23.8
28.9:27.4:32.3:26.5:30.4:29.6
25.2:24.7:24.7:21.3:25.6:21.4
22.2:24.9:26.4:25.3:22.5:24.0
25.0:25.8:26.4:22.8:23.1:21.1
31.3:31.3:31.6:28.9:31.7:28.3
25.7:21.1:24.9:24.2:27.4:19.5
22.7:23.8:24.4:23.1:25.9:21.9
25.2:27.0:27.2:23.7:24.6:25.3
30.5:28.3:30.8:30.3:28.6:29.3
26.3:25.9:22.4:21.4:21.9:22.7
27.3:22.5:24.8:27.3:27.2:24.7
23.0:24.7:22.9:23.4:26.2:20.1
22.6:21.9:27.5:21.7:30.6:23.0
22.2:26.2:24.6:24.2:23.5:25.8
32.3:29.6:28.6:28.1:28.4:27.3
24.1:23.9:21.2:25.0:22.3:26.1
5.20:6.20:6.80:5.80:8.70:5.70
   0:   0:   0:   0:   0:   0
   0:   0:   0:   0:   0:   0
   0:   0:   0:   0:   0:   0
   0:   0:   0:   0:   0:   0

Partial output of iostat -x -k -1 while running the above dd command against the XFS formatted LV:

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,34    0,00    2,85   16,08    0,00   80,74

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda            1386,00  5481,00   22,00   86,00  5632,00 22016,00   512,00     0,24    2,24    5,41    1,43   2,16  23,30
sdb            1386,00  5418,00   22,00   86,00  5632,00 22016,00   512,00     0,26    2,44    6,59    1,37   2,33  25,20
sdc               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
sdd               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
sde            1386,00  5418,00   22,00   87,00  5632,00 22272,00   512,00     0,28    2,66    6,82    1,61   2,49  27,10
sdf            1386,00  5481,00   22,00   87,00  5632,00 22272,00   512,00     0,27    2,51    6,18    1,59   2,27  24,70
sdg            1323,00  5481,00   22,00   87,00  5632,00 22272,00   512,00     0,27    2,56    6,23    1,63   2,31  25,20
sdh            1323,00  5481,00   20,00   87,00  5120,00 22272,00   512,00     0,27    2,46    6,95    1,43   2,36  25,20
md127             0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
md126             0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-0              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-1              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
md125             0,00     0,00    0,00  260,00     0,00 66560,00   512,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-2              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-3              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-4              0,00     0,00    0,00  260,00     0,00 66560,00   512,00     2,53    9,84    0,00    9,84   3,76  97,70

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,33    0,00    2,34   16,22    0,00   81,10

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda            1134,00  4662,00   18,00   76,00  4608,00 19204,00   506,64     0,36    3,86    6,06    3,34   3,16  29,70
sdb            1134,00  4725,00   18,00   75,00  4608,00 19204,00   512,09     0,32    2,41    7,44    1,20   3,29  30,60
sdc               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
sdd               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
sde            1134,00  4725,00   18,00   76,00  4608,00 19204,00   506,64     0,29    3,13    6,22    2,39   3,02  28,40
sdf            1134,00  4662,00   18,00   75,00  4608,00 18948,00   506,58     0,29    3,12    5,72    2,49   3,02  28,10
sdg            1197,00  4599,00   19,00   74,00  4864,00 18692,00   506,58     0,28    3,04    6,79    2,08   2,96  27,50
sdh            1197,00  4599,00   20,00   74,00  5120,00 18692,00   506,64     0,29    3,12    6,60    2,18   3,00  28,20
md127             0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
md126             0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-0              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-1              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
md125             0,00     0,00    0,00  224,00     0,00 57344,00   512,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-2              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-3              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-4              0,00     0,00    0,00  224,00     0,00 57344,00   512,00     2,66   10,25    0,00   10,25   4,40  98,50

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,50    0,00    3,01   16,03    0,00   80,47

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda            1386,00  5418,00   22,00   86,00  5632,00 22016,00   512,00     0,28    2,56    6,86    1,45   2,46  26,60
sdb            1386,00  5355,00   22,00   86,00  5632,00 21760,00   507,26     0,25    3,17    6,55    2,30   2,24  24,20
sdc               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
sdd               0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
sde            1386,00  5355,00   22,00   85,00  5632,00 21760,00   512,00     0,24    2,22    5,55    1,36   2,11  22,60
sdf            1386,00  5418,00   22,00   86,00  5632,00 22016,00   512,00     0,24    2,21    6,09    1,22   2,09  22,60
sdg            1323,00  5481,00   21,00   87,00  5376,00 22272,00   512,00     0,27    2,51    6,00    1,67   2,35  25,40
sdh            1323,00  5481,00   21,00   87,00  5376,00 22272,00   512,00     0,27    2,51    7,86    1,22   2,42  26,10
md127             0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
md126             0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-0              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-1              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
md125             0,00     0,00    0,00  256,00     0,00 65536,00   512,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-2              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-3              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-4              0,00     0,00    0,00  256,00     0,00 65536,00   512,00     2,41   10,74    0,00   10,74   3,84  98,20

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,34    0,00    1,84   11,39    0,00   86,43

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda             882,00  3654,00   14,00   60,00  3584,00 14852,50   498,28     0,19    2,55    6,93    1,53   2,47  18,30
sdb             882,00  3717,00   14,00   61,00  3584,00 15108,50   498,47     0,21    2,81    7,71    1,69   2,72  20,40
sdc               0,00     0,00    0,00    5,00     0,00     2,50     1,00     0,00    0,40    0,00    0,40   0,40   0,20
sdd               0,00     0,00    0,00    5,00     0,00     2,50     1,00     0,00    0,40    0,00    0,40   0,40   0,20
sde             882,00  3717,00   14,00   61,00  3584,00 15108,50   498,47     0,20    2,67    6,21    1,85   2,57  19,30
sdf             882,00  3654,00   14,00   60,00  3584,00 14852,50   498,28     0,22    2,99    8,50    1,70   2,91  21,50
sdg             945,00  3591,00   15,00   59,00  3840,00 14596,50   498,28     0,22    2,97    6,60    2,05   2,88  21,30
sdh             945,00  3591,00   15,00   59,00  3840,00 14596,50   498,28     0,21    2,78    7,00    1,71   2,68  19,80
md127             0,00     0,00    0,00    3,00     0,00     1,50     1,00     0,00    0,00    0,00    0,00   0,00   0,00
md126             0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-0              0,00     0,00    0,00    2,00     0,00     1,50     1,50     0,00    1,00    0,00    1,00   1,00   0,20
dm-1              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
md125             0,00     0,00    0,00  172,00     0,00 44032,00   512,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-2              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-3              0,00     0,00    0,00    0,00     0,00     0,00     0,00     0,00    0,00    0,00    0,00   0,00   0,00
dm-4              0,00     0,00    0,00  172,00     0,00 44032,00   512,00     1,61    9,55    0,00    9,55   4,05  69,70
Thomas
  • 4,155
  • 5
  • 21
  • 28
teissler
  • 738
  • 7
  • 11
  • 1
    Not sure, but I think the `O_DIRECT` stuff might be broken(?). Can you retest with `conv=fsync` instead of `oflag=direct`. See also [here](https://ext4.wiki.kernel.org/index.php/Clarifying_Direct_IO%27s_Semantics) – Thomas Feb 10 '18 at 19:35
  • @Thomas please provide that as answer! `O_DIRECT` was the problem. Testing with bonnie++, fio and dd with `conv=fsync,notrunc` confirmed that. Thank you very much! – teissler Feb 12 '18 at 07:48

1 Answers1

1

First i want to say that XFS doesn't have a problem with an LVMed RAID6, the problem was just the used dd command to test performance.

As stated by Thomas the problem was the broken O_DIRECT flag.

teissler
  • 738
  • 7
  • 11