E
E
Evgeny Plotnikov2015-03-04 12:10:48
MySQL
Evgeny Plotnikov, 2015-03-04 12:10:48

Why does raid1 slow down?

There is a server (core-i7 4 core + ht, 16GB ram) on which 2 Toshiba hdds (DT01ACA300; SATA 3.0, 6.0 Gb/s; 3TB) are combined into software raid1.
The server has ubuntu 14.10 x64 and mysql 5.5 installed.
I do:

mysql> load data infile '/home/evgeny/file1.csv' into table testtable fields terminated by ';'

CSV weighs about a gigabyte, there are about 20 million lines.
As a result, the disk is loaded at 80-95%, and the write speed is only 4000-5000 kB / s:
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               1.00     7.50    3.50   39.00   576.00  4988.00   261.84     1.22   28.80   78.86   24.31  21.22  90.20

Time to add a file to the table = 20-30 minutes.
When adding the second same file to the same table, the time of adding is already about an hour.
Question: is it possible to somehow optimize the time of adding a file to the table and why does the raid slow down so much? SMART shows that everything is fine with the disks.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2015-03-04
@evgenx

What does the Mirror write
synchronously?

H
Hatifnatt, 2015-03-05
@Hatifnatt

Eugene Evgenx :

10737418240 bytes (11 GB) copied, 306.82 s, 35.0 MB/s

Very low linear write / read speed for a modern disk, unless of course it is loaded with other operations. In addition, this test does not always reflect the speed of the disks themselves, if you have enough RAM, then all or part of the data will simply "sink" into the cache.
More accurate data can be obtained using dd like this
or
dd if=/dev/zero of=tempfile bs=1M count=10240 oflag=dsync
more details https://romanrm.net/dd-benchmark
My results for WDC drives WD2000FYYZ-01UL1B1 in soft-raid
cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sda3[0] sdb3[1]
      1936077760 blocks super 1.2 [2/2] [UU]

dd if=/dev/zero of=tempfile bs=1M count=10240
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB) copied, 38.7747 s, 277 MB/s

dd if=/dev/zero of=tempfile bs=1M count=10240 conv=fdatasync
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB) copied, 88.2362 s, 122 MB/s

dd if=/dev/zero of=tempfile bs=1M count=10240 oflag=dsync
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB) copied, 105.152 s, 102 MB/s

Try disabling barriers if you have a fairly reliable system and power failures are not expected.
this can significantly increase the speed of disk I / O, for example, in my case, disabling barriers allowed me to reduce IOwait on a hypervisor with SSD disks from 5-20% to 0-1%, here is another example teleogistic.net/2014/08/disable-ext4- barriers-for-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question