Separate your website's frontend from its backend into independent servers.

2018-11-18

Proper architecture: separate your backend from the front end

Jonathan - Engineering

Let's say you are running a popular MySQL/Wordpress based website. We will also talk about MySQL.

Your front end is the website itself, managed by WordPress. And your backend is the MySQL database.

While most clients deploy both in one server, this is actually not a good idea, from both a performance and security standpoint.

Deploy two virtual machines: one runs MySQL, while the other runs WordPress.

Why?

First, both applications have different needs. WordPress can be CPU intensive (quite CPU intensive sometimes, especially due to plugins), while MySQL may be RAM intensive (but it is quite efficient). It makes more financial sense that, as your website grows, you can individually increase CPU resources to your frontend (WordPress), and RAM resources to your backend (MySQL) individually.

Also, you can fully protect your MySQL backend by completely firewalling the backend server, with MySQL allowing only connections from your front end server.

Separating WordPress from MySQL also gives you the ability to scale your WordPress application. Since WordPress will bear the brunt of your clients, you can handle more traffic just simply by setting up multiple virtual servers, with your WordPress website hosted in each of them, while they all communicate with the single server running MySQL.

So, you could have, say, 6 virtual servers running your WordPress website, and as your website grows, you can add more. This also gives you higher uptime, as those virtual servers will be running in different physical servers (ColossusCloud will spread your virtual servers over as many physical machines, also known as hypervisors, as possible). If a hypervisor fails for some reason, it will only affect one of your WordPress websites.

And how do you balance traffic to all those WordPress servers? We strongly recommend Cloudflare's load balancing features.

Can your MySQL backend also run from multiple virtual servers? Yes it can, with MySQL's built-in replication.

This is a set up we've done for many clients. Contact our engineers and under our support plans, they will be able to set this up for you.