Increasing EBS Volume Performance
EBS (Elastic Blog Storage) is a virtual Hard drive which one can attach to an EC2 Instance. By default Amazon provides standard EBS with 100 IOPS (Input Output operation per second) which is equivalent to our normal hard-drive (7200 RPM), used at our homes. That works fine in a lot of cases but sometimes if we have a server with high I/O and accessed by multiple users, it may not be enough. For example, If we have database server which has high load then our volume I/O may face the bottleneck scenario. In order to have AWS EC2 get more I/O, we have different options but here we will discuss RAID 0 with multiple standard IOPS Volumes.
In RAID 0, data is striped evenly to multiple disks, so it offers faster read and write speed. Suppose in AWS EC2 if we use two standard EBS volume and setup the volume in RAID 0 we can get 200 IOPS disk, and the beauty of this is your cost will remain the same. You would be thinking, HOW?
Suppose you need a 50GB disk, then you can create two 25GB EBS volumes and setup the RAID 0, at the end of the day you will get total of 50GB storage at the same cost. But it also has a few risk factors involved because with the stripe set, if you loose any single volume you will loose the whole data. So backup is very critical in this case.
One more thing we should keep in mind that whatever array of EBS volumes we are creating, it should not exceed the available bandwidth of our EC2 instance.
For installing and configuring RAID 0 on an ubuntu instance one can follow the below mentioned steps :
Install Software for RAID and XFS File system (I am using XFS you can use any other file system which you use like ext4)
Now execute the below mentioned command to create RAID 0 array, and format the same with xfs file system.
Now we will create a directory to mount our RAID device.
#sudo mount -t xfs /dev/md0 /data[/shell]
We can check the same by running below commands :
[shell]#sudo mdadm –detail /dev/md0[/shell]
But it will be available only till system reboots. So we will have to make some changes in the config file as well.
#sudo mdadm –detail –scan >> /etc/mdadm/mdadm.conf
#sudo update-initramfs -u -v -k `uname -r’
#sudo sed -i ‘/exit/i \sudo mount \-t xfs \-o rw\,nobarrier\,noatime\,nodiratime \/dev\/md0 \/data’ /etc/rc.local[/shell]
That’s it. So by using RAID 0 we increase the performance and can also break the restricted 1TB barrier of EC2 EBS Volumes.