MySQL in the cloud at Airbnb
nerds.airbnb.com
nerds.airbnb.com
In initial testing of RDS after their recent updated release (we were excited about it!), we've found that RDS performance is significantly lower than running your own MySQL implementation with your storage being a 4 disk RAID-0 implementation on EBS. I suspect RDS uses a single EBS disk which is probably the root of the performance issues.
We didn't run actual benchmarks, but we quickly determined that RDS wasn't going to cut it from a performance perspective. In some cases, queries that take 3 seconds on our own MySQL implementation took well over 20 secs on RDS.
I see the value of RDS for many use cases, but in our case the performance of RDS is so significantly lower for a high-traffic use case that it wasn't going to work out for us.
Now, we still see performance problems when running MySQL on RAID-0 EBS - so we're considering going to an ephemeral disk implementation on EC2 and letting a single slave run on EBS and then snapshot from there often. If we lose an instance, we could restore from a snapshot quite quickly (within minutes).
In any case, regardless of our approach, RDS isn't going to be a part of it for now.
I'm not sure if instance-local storage will give you better performance compared to EBS. From the EBS page: "The latency and throughput of Amazon EBS volumes is designed to be significantly better than the Amazon EC2 instance stores in nearly all cases."
There is a problem with the recovery approach you described: as far as I know you can't use an EBS snapshot to populate local storage on a new instance, so you would be forced to use EBS for the new master. Promoting the slave to be the new master would be the better approach, with less downtime and data loss, provided that MySQL replication didn't break unnoticed.
- Tobi
Then I switched to RDS. I instantly fell in love with snapshots. I love that you can backup your database while it is hot. Sometimes, before doing a scary migration or query I'll take a snapshot just in case. I love that.
Even more amazing is the ability to scale up/down while the database is live. When I was with Softlayer and I needed to migrate to new machines there was always downtime and I always had to pay for both the new machine and the old machine for a small duration of time. Thus migrating would cost a couple grand in lost revenue and servers expenses, not to mention my Friday and Saturday night.
Documentation:
http://www.mysqlperformanceblog.com/2009/02/05/disaster-lvm-...
http://www.mysqlperformanceblog.com/2009/02/24/xtrabackup-op...
LVM snapshots on read slaves or during times when you have sufficient write capacity work as advertised.
Changing the database parameters is pretty painful, and the ec2 tool documentation is a bit misleading. Here are instructions, including how to verify your setup: http://matthew.mceachen.us/blog/howto-configure-an-amazon-rd...
Good post!