Performance verification when setting up raid0 on Amazon EBS
I want to verify whether EBS is formed as soon as possible.
It seems that there is a theory that this is quite the case if it is multi or large in the test.
We will also consider how to migrate to the existing one (starting from separating directories such as binary logs. )
Official User Guide (EBSPerformance)
EBS itself has a redundant configuration, so it seems that raid0 is good.
Using instance disks (local disks, ephemeral disks) to build RAID0 with RAID0 EBS has significantly improved disk I/O performance with two disks than one for large instances or higher, which is equivalent to RAID10 (mirror stripes)
Example of boot command when you want to raid0 on an ephemeral disk (the disk that disappears when stopped)
[shell] ec2-run-instances ami-e965ba80 --region us-east-1 --key id_rsa --group sg-a4866fcc --placement-group test --instance-type cc2.8xlarge -b "/dev/sdb=ephemeral0" - b "/dev/sdc= ephemeral1" -b "/dev/sdd=ephemeral2" "/dev/sdf=ephemeral3" [/shell] - Add two EBS disks in Large, boot and log in
[shell] # df -h Filesystem Size Used Avail Use% Mounted on /dev/xvde1 9.9G 867M 8.5G 10% / none 3.7G 0 3.7G 0% /dev/shm # ls -l /dev/xv* brw-rw---- 1 root disk 202, 65 Mar 21 02:15 /dev/xvde1 brw-rw---- 1 root disk 202, 80 Mar 21 02:15 /dev/xvdf brw-rw---- 1 root disk 202, 96 Mar 21 02:15 /dev/xvdg find /dev -type b -print [/shell] I tried to do so, but the above is the only one with a name that sounds like that.
・Forming a RAID with MDADM
How to use MDADM
[shell] # yum install mdadm Installed: mdadm.x86_64 0:3.2.5-4.el6 # /sbin/mdadm --create /dev/md0 --level=0 -c256 --raid-devices=2 /dev/xvdf /dev/xvdg mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md0 started. # echo 'DEVICE /dev/xvdf /dev/xvdg' > /etc/mdadm.conf # mdadm --detail --scan >> /etc/mdadm.conf # cat /etc/mdadm.conf DEVICE /dev/xvdf /dev/xvdg ARRAY /dev/md0 metadata=1.2 name= aws-cent63-template:0 UUID=f1d24aee:f788f00e:66d66f4d:ac63fa92 # ls -l /dev/md0 brw-rw---- 1 root disk 9, 0 Mar 21 02:39 /dev/md0 [/shell]
I saw that XFS seems to be fast, but looking at the results of this bench, it may not actually change that much.
There was also information that XFS is actually slow when using ACL.
(I heard that SSD and iodrive are formatted quickly at 4kb with xfs.)
I decided to try it normally/with the same file system.
[shell] # mount /dev/xvde1 on / type ext4 (rw) none on /proc type proc (rw) none on /sys type sysfs (rw) none on /dev/pts type devpts (rw,gid=5,mode=620) none on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) # mkfs.ext4 /dev/md0 # mkdir /data # mount /dev/md0 /data # df -h Filesystem Size Used Avail Use% Mounted on /dev/xvde1 9.9G 859M 8.6G 9% / none 3.7G 0 3.7G 0% /dev/shm /dev/md0 20G 172M 19G 1% /data # mount /dev/xvde1 on / type ext4 (rw) none on /proc type proc (rw) none on /sys type sysfs (rw) none on /dev/pts type devpts (rw,gid=5,mode=620) none on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) /dev/md0 on /data type ext4 (rw) [/shell] ・Benchmark
fio bench reference
fio download
[shell] # wget http://pkgs.repoforge.org/fio/fio-2.0.9-1.el6.rf.x86\_64.rpm # yum install libaio # rpm -ivh fio-2.0.9-1.el6.rf.x86_64.rpm [/shell] 4k random reads are measured 5 times with 16 multiplexes.
[shell] # vi randread4k16.fio # cat randread4k16.fio [randread4k] readwrite=randread blocksize=4k size=100m directory=/data direct=1 loops=5 numjobs=16 # fio -group_reporting randread4k16.fio omitted read : io=512000KB, bw=3200.6KB/s, iops=800 , runt=159974msec omitted
Run status group 0 (all jobs): READ: io=8000.0MB, aggrb=51001KB/s, minb=3187KB/s, maxb=3209KB/s, mint=159540msec, maxt=160623msec Disk stats (read/write): md0: ios=2047724/11, merge= 0/0, ticks=0/0, in_queue=0, util=0.00%, aggrios=1024000/4, aggrmerge=0/1, aggrticks=1203285/363, aggrin_queue=1202916, aggrutil=87.91% xvdf: ios=1024000/9, merge=0/2, ticks= 1177359/726, in_queue=1177346, util=82.95% xvdg: ios=1024000/0, merge=0/0, ticks=1229211/0, in_queue=1228486, util=87.91% [/shell] 5 times of 4K random light with 16 multiplexes.
[shell] # vi randwrite4k16.fio [randwrite4k] readwrite=randwrite blocksize=4k size=100m directory=/data direct=1 loops=5 numjobs=16 # fio -group_reporting randwrite4k16.fio omitted write: io=512000KB, bw=1997.4KB/s, iops=499 , runt=256336msec omitted
Run status group 0 (all jobs): WRITE: io=8000.0MB, aggrb=31902KB/s, minb=1993KB/s, maxb=1998KB/s, mint=256247msec, maxt=256786msec Disk stats (read/write): md0: ios=0/2061004, merge= 0/0, ticks=0/0, in_queue=0, util=0.00%, aggrios=0/1024965, aggrmerge=0/5568, aggrticks=0/2042634, aggrin_queue=2042035, aggrutil=99.58% xvdf: ios=0/1025035, merge=0/5770, ticks= 0/1733675, in_queue=1733059, util=97.23% xvdg: ios=0/1024895, merge=0/5366, ticks=0/2351593, in_queue=2351011, util=99.58% [/shell] Try to measure the sequential
[shell] # vi seqread4k16.fio [seqread4k] readwrite=read blocksize=4k size=100m directory=/data direct=1 loops=5 numjobs=16 # fio -group_reporting seqread4k16.fio omitted read: io= 512000KB, bw=3215.9KB/s, iops=803 , runt=159213msec omitted
Run status group 0 (all jobs): READ: io=8000.0MB, aggrb=51306KB/s, minb=3206KB/s, maxb=3216KB/s, mint=159165msec, maxt=159669msec Disk stats (read/write): md0: ios=2046486/24, merge= 0/0, ticks=0/0, in_queue=0, util=0.00%, aggrios=1024000/5, aggrmerge=0/6, aggrticks=1202445/327, aggrin_queue=1202016, aggrutil=87.41% xvdf: ios=1024000/11, merge=0/13, ticks= 1183413/655, in_queue=1183332, util=84.11% xvdg: ios=1024000/0, merge=0/0, ticks=1221478/0, in_queue=1220701, util=87.41% # vi seqwrite4k16.fio [seqwrite4k] readwrite=write blocksize=4k size=100m directory=/data direct=1 loops=5 numjobs=16 # fio -group_reporting seqwrite4k16.fio omitted write: io=512000KB, bw=1795.7KB/s, iops=448 , runt=285131msec omitted Run status group 0 (all jobs): WRITE: io=8000.0MB, aggrb=28708KB/s, minb=1794KB/s, maxb=1797KB/s, mint=284902msec, maxt=285354msec Disk stats (read/write): md0: ios=0/2048172, merge=0/0, ticks=0/0, in_queue=0, util=0.00%, aggrios=0/1024126, aggrmerge=0/5, aggrticks=0/2263010, aggrin_queue=2262748, aggrutil=96.45% xvdf: ios=0/1024125, merge=0/11, ticks= 0/2035946, in_queue=2035696, util=91.73% xvdg: ios=0/1024128, merge=0/0, ticks=0/2490074, in_queue=2489800, util=96.45% [/shell] Measure the difference even if it's not raid0
[shell] # vi randread4k16_noraid.fio [randread4k] readwrite=randread blocksize=4k size=100m directory=/ direct=1 loops=5 numjobs=16 # fio -group_reporting randread4k16_ noraid.fio omitted read : io=512000KB, bw=3194.4KB/s, iops=798 , runt=160281msec omitted Run status group 0 (all jobs): READ: io=8000.0MB, aggrb=50913KB/s, minb=3182KB/s, maxb=3200KB/s, mint= 159959msec, maxt=160899msec Disk stats (read/write): xvde1: ios=2047511/20, merge=0/5, ticks=2427396/202, in_queue=2426053, util=100.00% # vi randwrite4k16_noraid.fio [ randwrite4k] readwrite=randwrite blocksize=4k size=100m directory=/ direct=1 loops=5 numjobs=16 # fio -group_reporting randwrite4k16_noraid.fio omitted write: io=512000KB, bw= 1374.4KB/s, iops=343 , runt=372625msec omitted Run status group 0 (all jobs): WRITE: io=8000.0MB, aggrb=21969KB/s, minb=1373KB/s, maxb=1375KB/s, mint=372306msec, maxt=372874msec Disk stats ( read/write): xvde1: ios=1/2049664, merge=0/14975, ticks=7/5995555, in_queue=5995341, util=100.00% # vi seqread4k16_noraid.fio [seqread4k] readwrite=read blocksize=4k size=100m directory=/ direct=1 loops=5 numjobs=16 # fio -group_reporting seqread4k16_noraid.fio omitted read : io=512000KB, bw=3124.3KB/s, iops=781 , runt=163882msec omitted Run status group 0 (all jobs): READ: io=8000.0MB, aggrb=49945KB/s, minb=3121KB/s, maxb=3129KB/s, mint=163601msec, maxt=164020msec Disk stats (read/write): xvde1: ios=2046743/23, merge=0/3, ticks=2503841/252, in_ queue=2502405, util=100.00% # vi seqwrite4k16_noraid.fio [seqwrite4k] readwrite=write blocksize=4k size=100m directory=/ direct=1 loops=5 numjobs=16 # fio -group_reporting seqwrite4k16_noraid.fio omitted write: io=512000KB, bw=1438.6KB/s, iops=359 , runt=355910msec omitted Run status group 0 (all jobs): WRITE: io=8000.0MB, aggrb=23015KB/s, minb=1438KB/s, maxb= 1439KB/s, mint=355585msec, maxt=355936msec Disk stats (read/write): xvde1: ios=15/2047985, merge=0/21, ticks=65/5674427, in_queue=5674447, util=100.00% [/shell] ★ Comparison Results
| read/write type, | singledisk(iops), | raid0disk(iops), | singledisk(bandwidth), | raid0disk (bandwidth) |
| Random Leads | 798 | 800 | 3194.4KB/s | 3200.6KB/s |
| Random Light | 343 | 499 | 1374.4KB/s | 1997.4KB/s |
| Sequential Leads | 781 | 803 | 3124.3KB/s | 3215.9KB/s |
| Sequential Light | 359 | 448 | 1438.6KB/s | 1795.7KB/s |
*This is the result in this environment, so we recommend that you try it in the environment you are actually using.
・Proposed migration method
The DB on port 3307 on the server that is synchronized for backup, not the production DB, is the migration target for the time being.
Since the test environment is also mixed, it seems that if the IO is distributed, it will be quite effective against latency.
- Add a disk to the target server, set it in raid0, and format it.
- Stop slave (skip to my.cnf if needed_slave
- Stop mysql2 (3307)
- Data directory copy
- Symbolic Links
- Launch mysql2
- Start slave (if necessary)
- Wait for it to sync
- Check the degree of delay
I think the way to dump and restore with images was special, so I think it would be nice to have no need to cold.