I'm currently investigating migrating our infrastructure over to run on Amazon's EC2 and am trying to figure out the best way to set up a MySQL service. I'm leaning towards running our own MySQL instances, rather than going with Amazon's RDS, but am still considering the best approach for performance and cost on the instance itself.
In order to have persistent data, the MySQL data needs to be on an EBS volume (with some form of striped RAID, e.g. RAID0 or RAID10) to improve persistence. However, EBS IO is limited by the network interface (gigabit, so a theoretical maximum of 128 MB/s), while the ephemeral volumes have no such problem.
I did see a suggestion for running two MySQL servers on an instance, with a master running on the ephemeral disk (which we would also RAID) and a slave storing changes to an EBS volume, but this has some additional overhead and complexity (two servers).
What I was imagining is using some form of replicated file system such that I could have
- a filesystem on top of a RAID0 of ephemeral volumes to maximise performance
- all changes from the above immediately replicated to another RAID1 volume backed by multiple EBS volumes to ensure no data loss
The advantages of this would be
- best possible IO performance for the DB server; no network delay in IO
- decreased IO on EBS volumes (as all read IO will be done on the ephemeral volumes) so decreased cost
- good data security, as it's backed onto redundant EBS volumes
However, I haven't seen an appropriate system to replicate all changes from one volume to the other; is there a filesystem, or any other approach, which will do this? The distributed file systems, e.g. GlusterFS, DRBD etc seem to focus on replicating disks between servers, can they be set up to do what I'm interested in here?
I also haven't seen anything about other's taking this approach. Do I have a solution in need of a problem here (i.e. is performance good enough, so this whole idea is redundant)? Is there some flaw in the plan?
In the absence of any better answers, it looks like we can use RAID1 to pull this off by creating a RAID1 array on top of the RAID0 of ephemeral drives and the EBS drive; with reads mainly occurring on the ephemeral RAID0 performance should be good, while we still have writes going to persistent storage as well as ephemeral.