Yeah. The time has come to start designing a clustered WordPress environment.
In the enterprise world we’re used to building redundant solutions. We almost never rely on a single server, or even stack of servers (using the traditional 3-tiered approach), to get the job done. A typical web architecture will consist of a hardware load balancer like F5’s Local Traffic Manager (LTM), then a pair of web servers load-balancing another pair of application servers that in turn connect to a clustered pair of databases. For the last there are a number of models to choose from, including Oracle’s RAC (Real Application Clusters).
WordPress is not set up for clustering, or even simple load-balancing, out of the box. Its sole backend database solution, Oracle’s MySQL server, can be set up in a master-slave relationship with additional MySQL server nodes but does not have a real multi-master replication option (and given MySQL’s new management it isn’t likely to ever have one). Additionally, because WordPress also writes to the filesystem any load-balancing configuration needs to include some kind of common storage, like a NAS (Network Attached Storage).
Most of the discussion out there on clustering WordPress addresses Internet-facing hosted environements, typically employing cloud elements from vendors like the Amazon cloud. That’s not really what I’m after. My specific application would be clustering in my own data center for internal sites that cannot depend on cloud resources.
After looking long and hard I finally found this 2012 article by Alfred that gave me what I needed:
The key ingredient I had not seen mentioned by others was the use of the HyperDB plugin for WordPress. This software allows you to separately route database read and write connections. As a result all write operations can be directed to a MySQL master and reads to one or more slaves.
While doing background research for this project I found this very interesting advertisement that shows typical hardware resources and network configurations for a cloud based cluster: