How the cloud makes my life easier
We all know in theory the advantages of load-balanced high availability clusters, but we often forget that they are also fun to build and operate.
Yes, I'm at fault of calling it a cloud when it's rather a cluster, but who can resist the siren call of buzzwords? :) Cloud usually implies virtualization besides using multiple servers, which our solution does not do, and for a reason: our goal is high availability (HA), and that's practically impossible to achieve when you can not be sure which of your virtual servers run on which hardware. What if your SQL server's replication happened to be on the same iron as the master, and it has just blown a motherboard?
But back to the fun.
We all know that cramp in our stomach when one is software-upgradeing a live server, even if it is - naturally - done outside working hours?
Not on this setup! We can now "decouple" servers from the cluster (yes, even during work hours!), do whatever we want with it (reconfigure, software update, security patches, development, etc), and even test the cluster's applications on the reconfigured server without affecting the users of the "live" servers. Then, if all is well, we can "reattach" the server to the cluster. And decouple the next one that needs to be updated.
Another advantage is better backup of the MySQL servers.
By using mysql replication, we can now safely decouple (I love this word) a real-time replica from the master database, and dump the database, however long it takes. No need to schedule a downtime for the applications (old solution #1), or to make file-level backups and pray for consistency (old solution #2).
Another advantage is that we can add servers anytime to increase performance. (Actually, we are already working on an even more badass cluster, so most likely we will not actually extend this one, but the possibility is there.)
Closing this article, I'd like to thank for the powers that be for the stateless nature of PHP. A cluster like this would be much harder to do if we were using -- for example -- Java or C#.