If you’re running a large enterprise-level website on WordPress, you may have experienced issues with scalability. As your traffic grows, you might find that your site slows down or even crashes, leading to frustrated users and lost revenue.

Fortunately, there are steps you can take to scale WordPress and ensure that your site can handle high levels of traffic without issue. In this blog post, we’ll explore some key strategies for scaling WordPress at the enterprise level. We’ll cover topics such as optimizing your servers, caching, content delivery networks, and more.

Caching

Caching is an essential strategy for improving the performance of a WordPress site. When a user visits your site, the server must generate a response and send it back to the user’s browser. This process can be time-consuming, especially if your site contains a lot of dynamic content that needs to be generated on the fly. Caching helps to speed up this process by storing a copy of your site’s content in a cache. By implementing caching on your WordPress site, you can reduce the load on your server, improve your site’s response time, and provide a better user experience for your visitors.

Typical WordPress Cache Stack

For a high traffic site, the standard / typical caching stack will look something like this:

  • Proxy / CDN: A proxy can perform higher-level functions like edge caching, CDN (content delivery network), and WAF (web application firewall). A service like Cloudflare has all of these features, and it is common to have a proxy in front of your site.
  • Page caching: This involves caching the HTML output for an entire page. The specifics of how page caching is configured depend on your server configuration. Typically, you will want to have Nginx or Apache managing it. You can also use a WordPress drop-in solution like Batcache, which leverages the next layer of the cache, object caching.
  • Object cache: This is a key cache that sits between the database and WordPress itself. The exact implementation of this drop in will depend on what infrastructure you are using. For example, if you are using a memcached backend, you should use the memcached object cache.

Logged out Traffic

Logged out traffic is typically easier to cache than logged in traffic. When a user is logged out, they are viewing the same content as any other anonymous visitor. This means that the server can generate a cached version of the content and serve it to all logged out users, rather than generating unique versions for each individual user. Caching for logged out traffic, you can ensure that your site remains fast and responsive, even during periods of high traffic.

Logged in Traffic

Logged in traffic can be more challenging to cache than logged out traffic. However, you can still use caching to speed up the performance of your site for logged in users. One strategy is to leverage fragment caching. With fragment caching, you can cache specific parts of a page or post that are common across multiple users. This can include things like the header, footer, or sidebar.

Scaling Infrastructure

One crucial aspect of scaling a WordPress site is scaling the infrastructure. As traffic to your site increases, your servers may struggle to handle the increased demand, leading to slow load times, crashes, and other issues. To prevent these problems, it’s essential to scale your infrastructure appropriately.

You have a couple options with hosting / infrastructure:

  • Managed hosting: This is the simplest option, as you can let someone else deal with the complexities of hosting and caching your site, at the expense of higher running costs. At the enterprise/high-scale level, there are only a few trustworthy players.
    • WordPress VIP: VIP is owned by Automattic, the company behind WordPress.
    • Pantheon: Pantheon offer enterprise level WordPress and Drupal hosting.
    • WP Engine: A solid player in the enterprise WordPress hosting space
  • Self-managed infrastructure: Provides you with absolute control over your environment. This control allows you to fine-tune your environment, optimize performance and reduce costs. However, self-managed infrastructure can be complicated and requires technical expertise to set up and maintain.

Scaling self-managed infrastructure is easy enough today, in the time of IaaS (Infrastructure as a Service) platforms such as AWS and Azure. Adding more servers, implementing load balancing and auto-scaling can all be configured via software or via the web. By increasing the capacity of your infrastructure, you can ensure that your site can handle high levels of traffic without issue.

The following is an example of a well-designed, highly available, horizontally scaling infrastructure for WordPress in the AWS ecosystem.

  • ELB – Elastic Load Balancer. The load balancer distributes the traffic load across each of the webservers in the pool.
  • EC2 – Elastic Compute. These are the compute nodes which will run the web server, such as Nginx or Apache HTTPD. In an auto scaling environment new EC2s will be automatically created as needed to deal with the traffic requirements.
  • ElastiCache. Memcached or Redis backend for the WordPress object cache. Again these will auto scale as traffic dictates.
  • RDSRelational Database Service. The MySQL database for WordPress. Again these will auto scale as traffic dictates.

Offloading

Offloading functionality to third-party services can be a highly effective strategy for scaling WordPress. By using external services for tasks like caching, content delivery, and security, you can reduce the load on your servers and improve the overall performance and reliability of your site.

For example, a content delivery network (CDN) can help to distribute your site’s content across multiple servers located in different regions, reducing latency and improving the user experience for visitors located far from your primary server. Similarly, a web application firewall (WAF) can help to protect your site from malicious attacks and reduce the load on your servers.

Another common thing to outsource is search. The search functionality built into WordPress is terrible. It is slow and gives bad results. It is normally best to offload this to a search specific service, such as using ElasticPress (there are many other options out there).

Conclusion

Overall, scaling a WordPress site is essential for ensuring that your business can continue to grow and thrive. By implementing caching, scaling infrastructure, and offloading functionality to third-party services, you can improve the performance and reliability of your site, even as your traffic grows.


Read next – Have a look at this article where I explore how to leverage Cloudflare edge caching to speed up WordPress.