wesupport

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

How to setup WordPress high availability using open source software

by | Feb 15, 2016

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?

See how we help you setup WordPress HA!

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
99.5% 50.4 mins
99.9% 10.1 mins
99.95% 5.04 mins
99.99% 1.01 mins
99.999% 6.05 secs

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.

WordPress high availability primary-alternate design

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.

Step 3 – Build HA for WordPress files

Much of the data in a WordPress site is stored in its database. Even so, some webmasters allow users to upload avatar images, documents, etc. that are stored in the “wp-contents” folder.

So, when setting up an HA system, it is important to sync all website files immediately to the backup server. It’s best to configure the server such that a file copy will be triggered when there’s a new file upload.

There are several open source tools to do this, such as RSync, LSync, SCP, etc. Now, it is important to choose a file synching method based on how frequently the site is updated.

Bobcares manages several small to large online business websites in which the visitors can upload files into the server. This includes avatar images, official documents, etc. So, new website files could be uploaded every minute.

Traditional file syncing is not adequate in these cases. To ensure zero loss of data, we use advanced systems like “distributed file-systems” that instantly copies a new file into the secondary server.

[ Get the best infrastructure for your WordPress servers! Our server experts will setup your WordPress HA cluster at affordable pricing. ]

Step 4 – Setting up HA for WordPress database

The whole website content is stored in the WordPress database. So, the most critical part of the HA system is database replication.

For a 2 server system, we recommend a MySQL (or MariaDB) master-slave configuration. The MySQL service in the “primary” server should be configured as the master and the one in “secondary” as slave. Whatever data that is written to “primary” will be copied to “secondary”.

This is a pretty good system to keep an up-to-date backup database. However there are several quirks of MySQL that can cause replication to fail. Some of these are database sync delays, table corruptions, lost data in temporary tables, and more.

So, unless you are very confident about MySQL replication, we’d recommend you to get a professional system administration company to set this for you.

When we setup MySQL Master-Slave replication, we include failure proof systems to prevent data corruption. For eg. we configure the slave MySQL to shutdown in case it detects a data corruption. That way, bad data is not sent to the backup.

Step 5 – Monitoring for HA anomalies

HA systems are delicate. Something as simple as a memory overage can send file or database synching to disarray, and cause the system to fail.

So, it is important to closely monitor and immediately react to HA system anomalies. We recommend a full monitoring of hardware status, resource usage, database health, connection between the servers, HTTP & MySQL errors, and system errors to keep tabs on the HA system.

Here at Bobcares, our server experts react to HA system anomalies within 5 minutes, and fix critical issues in as little as 10 minutes. It is one of the things that we strictly follow to make sure the data in our customer website remain reliable.

Step 6 – Upgrading, securing and tuning the HA servers

All servers need to be periodically upgraded, performance tuned and secured. It is doubly important and complex in case of a two-server system that is connected with each other.

We recommend that you review the log files for errors at least once a week, look for trends in the HA monitoring system, and review the website performance to make sure the replication is not causing the site to slow down.

Periodic security and performance audits are an important part of our Server Management Services. During these audits we double check if all system softwares are patched, run performance benchmark tests to detect bottlenecks, and re-harden the website to close any possible vulnerabilities.

Getting it done the right way

If you are worried about website downtime, setting up an HA is the way to go. However a cloud solution or an enterprise HA solution can cost more than 5 times of what you’re paying for your server.

Setting up a 2-server HA system as described here is perhaps the most cost-effective way to minimize your site downtime. The downside is that you need a bit of systems knowledge to set it up without error.

We’ve helped several small to large websites setup and maintain rock solid WordPress high availability systems for a lower cost than those fancy enterprise HA solution.

The system that we described above can be setup and maintained by our experts 24/7. Here’s what the package includes:

HA system installation by experts
24×7 expert monitoring
24×7 emergency system rescue
Periodic performance tuning
Server hardening
Seamless software upgrades

If you would like us to set this system up for you, click here to order:

CLICK HERE TO SETUP WORDPRESS HA

*Quote assumes standard server settings. Subject to revision based on a server review.

Conclusion

High availability is now a core requirement for any serious business website. Today we’ve covered how high availability can be achieved for your website using open source tools.

Bobcares helps business websites of all sizes achieve world-class performance and uptime using tried and tested website architectures. If you’d like to know how to make your website more reliable, we’d be happy to talk to you.

 

Get your custom HA solution!

Do you face frequent server performance or uptime issues?

Let us help you.

We setup custom HA solutions and keep your servers optimized, secured and updated at all times.

Talk to our application infrastructure specialist today to know how we can help achieve high uptime and performance.

GET A CUSTOM QUOTE!

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

1 Comment

  1. Chi

    What is the difference between NginX and HAProxy that makes you choose NginX for the web proxy and HAProxy for the DB proxy?

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags