Bobcares

How to setup WordPress in multiple servers

by | Oct 29, 2018

Many web hosts now guarantee 99.9% uptime for their services, but that still allows up to 8.7 hours of downtime a year.

That is not a risk many companies can afford to take. For eg. Sports news websites that fail right in the middle of a superbowl may lose their loyal followers.

Here at Bobcares, we help WordPress site owners prevent such catastrophic failures by setting up a maintaining a high availability WordPress configuration.

Today we’ll cover how our Support Engineers setup WordPress multiple servers.

 

How to setup WordPress in multiple servers?

Moving WordPress to multiple servers often creates issues like incomplete data across servers, broken session files, slow loading of web pages etc.

Fortunately, these limitations can be corrected by planning and using special tools like HAProxy, Percona XtraDB etc.

And with the help of these software, our Support Engineers have successfully implemented WordPress in multiple servers with just 5 servers.

Let us see the 3 major steps in this implementation.

 

Step 1. High Availability of WordPress files

The first step to maintain website uptime is to ensure that WordPress files are always available.

For this, we use 3 servers and maintain a set of identical website files in each of these servers.

Any actions like WordPress post addition, deletion, media upload etc. done on one server should be updated in all servers instantly. Else visitors may find anomaly in the website.

Since there are too many changes in files, updating them on all servers in shortest span becomes a real challenge.

From our expertise in managing servers, we see that one of the solutions that works well for WordPress files is Unison.

Unison helps to update website content changes across all servers.

 

Step 2. High availability of Databases

We now have same website files in all 3 servers.

WordPress stores all its posts, comments etc. in Databases. Even a small page addition in WordPress involves several database operations.

So the next step is to ensure that the WordPress database works always.

For this, we use database server clusters. For proper working of any cluster, we need a server pool with minimum of 3 servers. The problem with only 2 servers is that, if there is a connection loss between the servers, the entire idea of high availability fails.

It is possible to run multiple services like web server, Database server etc. on the same server.

And so, we set up a database cluster using the same 3 servers which were used for file cluster.

The biggest challenge in database cluster is to replicate database changes in all servers instantly. That is when an entry is removed from database, it has to be removed from other servers too.

And it involves too many read and write operations.

We’ve seen that tools like Percona XtraDB really helps to ensure high availability for databases.

To make databases available always, our Dedicated Support Engineers make configuration changes in Percona XtraDB cluster that includes steps to:

  1. Avoid database update conflicts
  2. Disallow external access
  3. Enable logs for fault analysis

 

Step 3. Set up Load Balancer

Now that we have a WordPress File cluster and Database cluster set up, the next step is to set up a system to handle website requests evenly.

This is where Load Balancer helps. It distributes the visitors evenly among the servers and helps to avoid over-loading of a single server.

If your website has 1000 visitors at a time,  Load Balancer will distribute these visitors to 3 servers and each server need to handle only around 300 visitors.

Based on the specific requirement of customers, we deploy load balancers like HAProxy, which is seen efficient even for website with heavy traffic.

But what if the load balancer itself goes down ? The entire set up fails.

That is why we implement a keep-alive backup server for Load Balancer. This backup server works as a fail-over option for load balancer.

Thus with this setup, a visitor will never experience any website slowness or downtime.

WordPress multiple servers

Conclusion

With proper set up of  WordPress in multiple servers, it is possible to eliminate the risk of website going down due to heavy traffic. Today we saw how our Support Engineers help customers to achieve 100% uptime for WordPress websites.

4 Comments

  1. Andrey

    Where did you store WP sessions on multi-server setup?

    Reply
    • Sijin George

      Hello Andrey,
      On a multi-server setup, storing the sessions on the database helps in encryption and load balancing.

      Reply
      • Pak Kriss

        Hi Sijin, which tool or setup or modification or plugin you have in place to store the sessions in database?

        Reply
        • Sijin George

          Hi Pak,
          This depends a lot on the website type. Many users make use of the Redis session storage too.
          We can check your environment and recommend the one that fits for you. We’ll be happy to talk to you on chat (click on the icon at right-bottom).

          Reply

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.