This will be a short post describing how we configure a raid level 0 drive on an EC2 instance using the EBS drives. For a lot of our functionality we typically use the ephemeral drives and periodically backup content using the EBS drives and snapshots. We mainly use raided EBS drives to get the maximum performance out of an Amazon EC2 small instances. For example we have seen nearly double the performance out of our Cassandra cluster on small instances using raided EBS drives.
Some might say “EEEEKKKHH” raid 0 isn’t safe, but for us we get persisted backups using the amazon EBS snapshot feature (daily, weekly, etc) and our data is fault-tolerant when stored in Cassandra because data is automatically replicated to multiple nodes. Depending on your reliability needs this may not be something you want to do with say MySQL. For example in the MySQL case if you snapshot your EBS drive daily then you would loose at most 1 days worth of data. Utilizing a 2 node Cassandra cluster and assuming you have the replication factor set to 2, 1 of the 2 nodes can go down and you still have 100% of the data. If both nodes went down then you would lose at most 1 days worth of data.
First fire up the Amazon Management Console and create two volumes of 10 GB
each and attached them to an instance as
Install the raid driver and the xfs file system with the following command.
Now lets create the drive as
/dev/md0 using the two disks
/dev/sdn. There are some great articles floating around about the best
settings for an EBS drive so utilizing that knowledge we set the chunk size
Next we need to add the devices into the mdadm.conf file so the drive configuration is persisted.
Next lets construct the xfs file system on the
Next lets add the
/dev/md0 drive to the file systems table for auto-mounting
Now lets mount and format the drive.
Lets set the block device read ahead have to 64k which seems to really smooth out and improve the EBS drives.
Next lets verify the drive is operation
If you wish to remove the drive run the follow commands
Also, make sure to modify your
/etc/fstab file and remove the
line. Now, using the AWS management Console you can detach the volumes
from the instance.
Short, sweet and easy to configure. I hope now you can get the most out of your EC2 IO bound small instances. For some of our IO bound map reduce jobs against our Cassandra cluster we have seen nearly a 2x performance boost.
None for this post.