Yes, WordPress is Horizontally Scalable

Calin Don
3 min readFeb 17, 2022

This post is an answer to the reddit help request by r/theusarticles:

IS WordPress Horizontally Scalable ? If yes then How ?

I get this question a lot now a days and I am not able to answer this even tho if I give an answer I am not pretty sure about how actually can we do that in terms of implementations etc . Does anyone knows how we can actually scale WordPress website horizontally ? and I am talking about wordpress.org

For me, horizontal scaling means in very brief the process of easily adding more resources to work in parallel to accomplish a certain task.

TLDR; yes, WordPress is definitely horizontally scalable, but you need to be open to compromise regarding plugins and themes installs and media files storage. I’ve developed an open-source solution on top of Kubernetes called Bitpoke Stack, so this is how you can do it, off-the-shelf.

Photo by Eric Ward on Unsplash

The main pain points for this horizontally scalable WordPress implementation were in my experience the following:

  1. Media files. You need a way to distribute the media files so they are accessible from multiple servers, but WordPress plugins and themes usually expect media files to be available in the wp-content/uploads folder. The solution to this is to store the media files in a cloud storage service like S3 or Google Cloud Storage using wp-stateless or bitpoke-mu-plugin (part of the Bitpoke Stack) or to mount them from a shared NFS volume using Amazon EFS or Google’s Filestore for example. Also, you need to serve these media files, which in the case of a cloud storage service mean proxying from WordPress or setting a CDN service in front of the storage service.
  2. Database. In general you can use a single database server and have multiple instances connect to that, but if you want to accomplish horizontal scalability you need a setup with database replication distribute queries across multiple read-replicas. To achieve that you can use HyperDB which does the splitting and routing from within WordPress or use a proxy like ProxySQL. As far as I know, the paid service WordPress.com uses the former while in Bitpoke App, our commercial solution for multi-tenant WordPress deployments, we use the latter as it proved more performant.
  3. Code. For code, you have two options, one is to store it on a shared NFS volume or store it in a version control system like git and have a build process that creates a docker image out of the code and deploys it. While the former keeps the WordPress experience untouched (eg. you can install and upgrade themes and plugins from wp-admin) it is also less performant with the potential of becoming the bottleneck of your horizontally scalable stack.

What are the possible implications to explain to a client aiming for horizontal scaling:

  1. Manual operations like core, themes and plugins updates and code related changes need to go through a build pipeline. The upside of this is that you will have a standardized process for changing the site code and you can easily add testing and other code quality improving features.
  2. You need a technical person with a cloud related skill-set to take care of the site but if you are asking yourself these questions, it’s very likely your client already has one :). The good news here is that today, in 2022, there are an increasing number of solutions — open or commercial — further and further lowering the entry barrier.

From an editorial perspective, the WordPress CMS is scalable and thus I consider this as the main adoption driver. It’s easy to use for a lot of editors, in the same time, with various skill-sets.

From a devops point of view, delegating the tech scaling tasks has lead to the advent of managed WordPress hosting companies, which I think are going to peak in the near future and reach their maximum potential and will be slowly replaced by cloud-native, scalable, security and privacy-oriented solutions.

--

--

Calin Don

CTO & co-founder Bitpoke. Democratizing WordPress Hosting Infrastructure. OpenSource maker and tinkerer for Kubernetes, MySQL and nginx. DevOps for life.