How to setup WordPress high availability using open source software
Every webmaster in this world wants their sites to load fast, and never go down. But, many get dissuaded by seeing the high costs for enterprise grade high availability solutions or cloud hosting costs.
Well, what if you don’t have to spend a fortune to achieve high availability?
Bobcares helps several small to large online businesses achieve high availability through our Server Management Services. We help companies setup, monitor, optimize and maintain highly available server infrastructure, so as to achieve up to 99.999% uptime.
Based on these tried and tested solutions, today we’ll cover how you can setup a WordPress high availability system using free and open source software.
Step 1 – Decide how fast the site should come back online (Cost vs Downtime)
When a website is down, what scares a webmaster the most is – uncertainty. There usually is no immediate explanation as to why the site is down, or how long it will remain down. It can remain down anywhere from a few minutes to a few days.
That’s where an HA system is useful. You can decide exactly how long you’re willing to let your site be down. This idea is commonly represented as uptime percentage. For eg: by using an HA system with 99% uptime, you can expect your site to be restored in 1.68 hours or less.
|Expected uptime||Maximum downtime per week|
As you can imagine, the higher the uptime percentage, the greater will be the cost to set it up and maintain.
In HA systems that ensure 99.9% uptime, restoration of backup website can be done via manual intervention. These systems can be implemented using 2 servers (or VPSs), and therefore costs will be low. For anything above 99.9%, automated switching is needed, and the number of servers needed can go up to 6 servers or more.
At Bobcares, our experts monitor our customer websites 24/7, and we’ve been able to bring a website back online within 5 minutes. So, for WordPress site owners who can afford a 5 mins downtime, we recommend a 2-server solution with 99.95% uptime.
[ Stop worrying about business downtime. Hire our server specialists to setup high availability solutions for your servers. ]
Step 2 – Design an HA system
There are several ways an HA system can be designed, based on what level of failure tolerance it needs. An HA system with automatic failure detection and switching needs 6 or more servers, and the design can get quite complex.
We’ve seen that most WordPress sites with an average traffic of less than 1 million hits per month can safely use a 2-server architecture that can get the backup site online within 5 minutes.
So, as an example we’ll review a 2-server WordPress high availability system.
In such a system, the whole website’s traffic will be handled by a single server, called the “primary” server. We recommend this server to have high configuration. Some of our customers use a powerful physical server as the primary server.
All website data and database tables are synched to a secondary server that will be brought online in case the primary server fails. This server need not be high config, and can be a VPS.
If the primary server fails, the website’s IP can be changed at the DNS server, and visitors can be routed to the secondary server.
The success of this HA system depends on two important factors – 1) how frequently the files are synched, which determines how much data is lost in case of a switch over, and 2) how fast the DNS can be changed to route visitors to the secondary server, which determines the downtime.
At Bobcares, we use advanced synching methods and fast switching to minimize downtime and prevent data loss. For eg. we setup the DNS server such that the website can be switched to the secondary server in less than a minute.
Combined with the fact that our experts monitor the servers 24×7, and react to a server downtime by instantly switching the DNS, we’re able to bring the secondary server online in as little as 5 minutes.