Extra boost for your raid on Linux

admin's picture

If you feel that your raid performance is a little bit short you can do something about it.
Here you may find some useful info or a starting point to start tweaking your disks to increase performance.

First find out about your disks:

cat /proc/mdstat

This should output something like this:

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 sda3[0] sdb3[1]
      730202368 blocks [2/2] [UU]

md1 : active raid1 sda2[0] sdb2[1]
      264960 blocks [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
      2102464 blocks [2/2] [UU]

unused devices: <none>

So you got 2 disks (sda, sdb) across the used raid partitions.

Lets add some preload cache to those two disks,first lets find out your current setting for every disk

blockdev --getra /dev/sda
256

Hmmm, it has the default value, lets increasy it to 16384:

blockdev --setra 16384 /dev/sda

You may now check out your speed improvement.
A nice tool to benchmark and check your raid speed is iozone (install it on debian with apt-get install iozone3). Simple command to test it is

iozone -s 128000

My results look like this

Iozone: Performance Test of File I/O
                Version $Revision: 3.308 $
                Compiled for 64 bit mode.
                Build: linux

        Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
                     Al Slater, Scott Rhine, Mike Wisner, Ken Goss
                     Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
                     Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
                     Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy,
                     Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root.

        Run began: Wed Feb  8 08:49:45 2012

        File size set to 128000 KB
        Command line used: iozone -s 128000
        Output is in Kbytes/sec
        Time Resolution = 0.000001 seconds.
        Processor cache size set to 1024 Kbytes.
        Processor cache line size set to 32 bytes.
        File stride size set to 17 * record size.
                                                            random  random    bkwd   record   stride
              KB  reclen   write rewrite    read    reread    read   write    read  rewrite     read   fwrite frewrite   fread  freread
          128000       4 2167504 4441655  9032482  8740152 6895088 3595298 7823961  6476141  7117490  2050097  4013033 8560649  8439932

To explain the results is a big chapter and wont be analyzed here, but generally check for 'stride read', higher the better. What this number exactly means will be analyzed in another blog.