# [SOLVED] Slow software RAID0 (MD)

## tallica

Hello, I guess writing data should be a bit faster on a software RAID0...

For now SATA drivers are configured as IDE in BIOS.. but I'm getting similar results with AHCI.

FS: ext3

Disks: 2x ST3500320AS 7200.11 500GB

MB: Asus P5B Deluxe

emerge --info: http://tallica.pl/linux/emerge_info

kernel config: http://tallica.pl/linux/.config

Here are some tests:

Copying files between 2 RAID0 arrays

~35-40MB/s copy /dev/md2 -> /dev/md1 6GB file

~60MB/s copy /dev/md2 -> /dev/md1 700MB file

Copying files between 2 disks

~100MB/s copy /dev/sdb5 -> /dev/sdc5 350MB file

~90MB/s copy /dev/sdb6 -> /dev/sdc6 700MB file

~80MB/s copy /dev/sdb6 -> /dev/sdc6 3GB file

Copying files between 2 partitions (same disk)

~100MB/s copy /dev/sdb5 -> /dev/sdb6 350MB file

~40MB/s copy /dev/sdb6 -> /dev/sdb5 700MB file

~40MB/s copy /dev/sdb5 -> /dev/sdb6 3GB file

Copying file between RAID0 and normal partition

~35MB/s copy /dev/md2 -> /dev/sdb5 6GB file

~60MB/s copy /dev/sdb6 -> /dev/md1 350MB file

```
# hdparm -tT /dev/sdb /dev/sdc /dev/md1 /dev/md2

/dev/sdb:

 Timing cached reads:   3308 MB in  2.00 seconds = 1654.51 MB/sec

 Timing buffered disk reads:  280 MB in  3.00 seconds =  93.28 MB/sec

/dev/sdc:

 Timing cached reads:   3418 MB in  2.00 seconds = 1709.58 MB/sec

 Timing buffered disk reads:  278 MB in  3.02 seconds =  92.08 MB/sec

/dev/md1:

 Timing cached reads:   3322 MB in  2.00 seconds = 1660.80 MB/sec

 Timing buffered disk reads:  630 MB in  3.01 seconds = 209.60 MB/sec

/dev/md2:

 Timing cached reads:   3388 MB in  2.00 seconds = 1694.64 MB/sec

 Timing buffered disk reads:  548 MB in  3.01 seconds = 182.13 MB/sec

 

# cat /proc/mdstat 

Personalities : [raid0] [raid1] 

md1 : active raid0 sdc1[0] sdb1[1]

      20016640 blocks 128k chunks

      

md2 : active raid0 sdc2[1] sdb2[0]

      20016768 blocks 64k chunks
```

Thanks for your help.

----------

## schachti

Which values is too low in your opinion?

----------

## tallica

 *schachti wrote:*   

> Which values is too low in your opinion?

 

Look here:

~60MB/s copy /dev/md2 -> /dev/md1 700MB file --> this one should be at least ~90MB/s

~90MB/s copy /dev/sdb6 -> /dev/sdc6 700MB file

Why copying large files are so slow? 35-40MB/s ...

----------

## schachti

 *Michal_86 wrote:*   

> ~60MB/s copy /dev/md2 -> /dev/md1 700MB file --> this one should be at least ~90MB/s

 

Why that? You read from two disks and write to the same two disks - this in general is slower than reading from one disk and writing to the other disk.

 *Michal_86 wrote:*   

> Why copying large files are so slow? 35-40MB/s ...

 

It is not slow - copying small files is "too fast" as buffers, caches etc. are used.

What I think you should test:

```
echo 3 > /proc/sys/vm/drop_caches && time `dd if=/dev/zero of=/dev/md1/testfile bs=4k count=262144 && sync`

echo 3 > /proc/sys/vm/drop_caches && time `dd if=/dev/md1/testfile of=/dev/null bs=4k count=262144 && sync`
```

----------

## tallica

```
# echo 3 > /proc/sys/vm/drop_caches && time `dd if=/dev/zero of=/mnt/test/md1/testfile bs=4k count=262144 && sync`

262144+0 przeczytanych recordów

262144+0 zapisanych recordów

skopiowane 1073741824 bajty (1,1 GB), 5,76559 s, 186 MB/s

real   0m6.619s

user   0m0.076s

sys   0m2.162s

# echo 3 > /proc/sys/vm/drop_caches && time `dd if=/mnt/test/md1/testfile of=/dev/null bs=4k count=262144 && sync`

262144+0 przeczytanych recordów

262144+0 zapisanych recordów

skopiowane 1073741824 bajty (1,1 GB), 5,18168 s, 207 MB/s

real   0m5.527s

user   0m0.063s

sys   0m0.554s
```

----------

## schachti

So if you look at these values, it seems that everything is fine with your RAID - more than 150 MB/s is a very good value.

You could try it with 10 GB instead of one to minimize the influence of the drives' caches - try something like

```
echo 3 > /proc/sys/vm/drop_caches && sync && time `dd if=/dev/zero of=/dev/md1/testfile bs=4k count=2621440 && sync`

echo 3 > /proc/sys/vm/drop_caches && sync && time `dd if=/dev/md1/testfile of=/dev/null bs=4k count=2621440 && sync`
```

----------

## tallica

Works great  :Smile:  Thanks!

```
# echo 3 > /proc/sys/vm/drop_caches && time `dd if=/dev/zero of=/mnt/test/md1/testfile bs=4k count=2621440 && sync`

2621440+0 przeczytanych recordów

2621440+0 zapisanych recordów

skopiowane 10737418240 bajtów (11 GB), 68,4588 s, 157 MB/s

real   1m9.478s

user   0m0.571s

sys   0m23.201s

# echo 3 > /proc/sys/vm/drop_caches && time `dd if=/mnt/test/md1/testfile of=/dev/null bs=4k count=2621440 && sync`

2621440+0 przeczytanych recordów

2621440+0 zapisanych recordów

skopiowane 10737418240 bajtów (11 GB), 52,5786 s, 204 MB/s

real   0m52.950s

user   0m0.495s

sys   0m6.782s
```

```
# echo 3 > /proc/sys/vm/drop_caches && time `dd if=/dev/zero of=/mnt/test/sdb5/testfile bs=4k count=262144 && sync`

262144+0 przeczytanych recordów

262144+0 zapisanych recordów

skopiowane 1073741824 bajty (1,1 GB), 11,7882 s, 91,1 MB/s

real   0m13.099s

user   0m0.057s

sys   0m2.153s

# echo 3 > /proc/sys/vm/drop_caches && time `dd if=/mnt/test/sdb5/testfile of=/dev/null bs=4k count=262144 && sync`

262144+0 przeczytanych recordów

262144+0 zapisanych recordów

skopiowane 1073741824 bajty (1,1 GB), 9,7833 s, 110 MB/s

real   0m10.094s

user   0m0.067s

sys   0m0.560s
```

```
# echo 3 > /proc/sys/vm/drop_caches && time `dd if=/dev/zero of=/mnt/test/sdc5/testfile bs=4k count=262144 && sync`

262144+0 przeczytanych recordów

262144+0 zapisanych recordów

skopiowane 1073741824 bajty (1,1 GB), 12,0158 s, 89,4 MB/s

real   0m13.390s

user   0m0.053s

sys   0m2.176s

# echo 3 > /proc/sys/vm/drop_caches && time `dd if=/mnt/test/sdc5/testfile of=/dev/null bs=4k count=262144 && sync`

262144+0 przeczytanych recordów

262144+0 zapisanych recordów

skopiowane 1073741824 bajty (1,1 GB), 9,84334 s, 109 MB/s

real   0m10.137s

user   0m0.056s

sys   0m0.563s
```

----------

