WordPress availability and performance have a direct business impact and are major factors when choosing a hosting service. Obviously, no one wants to lose money because of occasional downtime, but at the same time – no one can be completely safe from it. To minimize the risk of such occurrence and to ensure an extra level of redundancy, the clustering approach can be used. Today, we will take a closer look at auto-scaling and clusterization of WordPress CMS.
A WordPress cluster helps to handle permanent high load and huge load spikes, ensures zero downtime, improves performance, cuts maintenance costs, and, as a result, offers an excellent experience for end-users.
This article covers how to:
- Install a WordPress cluster powered by LightSpeed and a highly available MariaDB Galera cluster;
- Enable a lightning-fast Premium CDN with support of HTTP/3 (aka QUIC);
- Get a free Let’s Encrypt SSL certificate with automatic renewal;
- Bind a custom domain and update the certificate;
- Scale dynamically based on the load.
WordPress Cluster Components
A pre-packaged WordPress cluster is available at the Jelastic Marketplace with a set of installation options. Let’s walk through all components to get a complete understanding of how this solution works and what results can be expected.
CDN Add-On is integrated into the WordPress cluster to provide a superb experience for site visitors and achieve higher Google ranks. It leverages a highly interconnected global network, featuring massive bandwidth capacity, advanced caching, and acceleration strategies along with HTTP/3 support to provide lightning-fast WordPress static assets loading from the nearest PoP (point of presence). This CDN network spans the globe with 130+ PoPs located on six continents. Jelastic PaaS customers get premium traffic for the same price across all continents and countries with no surprising bills based on geographic locations.
Let’s Encrypt SSL
Let’s Encrypt SSL Add-On automates the issuing of trusted SSL certificates, custom domain validation, and certificate renewal to ensure a highly secure connection.
LiteSpeed Web ADC
LiteSpeed Web ADC (Application Delivery Controller) is a new generation load balancer that supports the modern HTTP/3 protocol. It provides a flexible algorithm of traffic distribution for optimal performance, as well as ESI dynamic cache that helps to serve dynamic content directly and reduce requests to web servers.
Web Application Firewall
The Web Application Firewall (WAF) secure feature is enabled by default in LiteSpeed Web Server. WAF comes with Layer-7 Anti-DDoS Filtering, WordPress brute force protection, as well as IP level bandwidth and request rate throttling. LiteSpeed WAF manages rules for dynamic requests, which allows significantly optimized computing power.
LiteSpeed Web Server
MariaDB Galera Cluster
As storage for dynamic content, the MariaDB Galera Cluster is employed. Due to true multi-master topology with automatic new node provisioning, Galera ensures no data loss upon nodes crash, no slave lag, and no lost transactions.
Redis is a high-performance RAM-allocated data structure store running in the LiteSpeed Web Server container and used as a high-speed caching solution. Object caching stores already loaded database query results and serves the appropriate requests faster.
In order to keep WordPress static assets, shared storage is used for all web servers in the cluster.
WordPress Cluster Installation
Normally, deploying a WordPress cluster is quite time-consuming and complex, but with Jelastic PaaS, most of the work is done by the platform. Just a few clicks are needed to specify your preferences.
1. If you have no Jelastic PaaS account, you can register and deploy the WordPress Cluster by clicking the “DEPLOY TO JELASTIC PAAS” button below. Within the opened widget, specify your email address, and press Install.
2. In the opened installation window, you can customize your WordPress Cluster.
This Scaling Strategy parameter aims to foresee possible upcoming load growth in the cluster and scale out the application servers horizontally in order to prevent WordPress application downtime. Let’s take a look at how it works.
Jelastic PaaS allows automatically scale in/out servers using specially configured triggers. Based on best practices, three common scaling scenarios are available for WordPress to prevent overload (these settings can be adjusted after installation):
- Low Load:
- adds 1 application server node if the workload is higher than 70%;
- removes 1 application server node if the workload goes below 20%;
- Medium Load:
- adds 1 application server node if the workload is higher than 50%;
- removes 1 application server node if the workload goes below 20%;
- High Load:
- adds 2 application server nodes if the workload is higher than 30%;
- removes 1 application server node if the workload goes below 10%.
3. Activate the preferred Advanced Features.
- LiteSpeed High-Performance Web Server installs the cluster based on LiteSpeed Web Server and Web Application Delivery Controller. This option provides the highest possible speed of website content delivery to the clients via the modern HTTP/3 protocol. In case you untick this option, the cluster will be installed using NGINX web server and load balancer.
- The Web Application Firewall (WAF) enables/disables the feature (works with LiteSpeed Web Server only).
Note: It is not recommended to use LiteSpeed Web Admin Console to configure WAF since it will cause functionality failure during horizontal scaling. If you need to adjust Web Application Firewall after the installation, the appropriate WAF=TRUE/FALSE environment variable should be used.
Don’t forget to restart the application layer nodes after changing the environment variable.
- MariaDB Galera Cluster is a multi-master database cluster based on synchronous replication and InnoDB engine. When using the Galera Cluster, you can perform direct read and write operations to any node. If any single instance goes down, there will be no cluster downtime and no complex fail-over procedures. In case you untick the checkbox, a regular standalone MariaDB database will be installed. Thus, high availability and fail-over capabilities will be significantly decreased.
Note: In case you are going to migrate an existing database to Galera Cluster, you have to take into consideration the following requirements:
- All tables must be of InnoDB/XtraDB type;
- All tables must have a PRIMARY index.
- Lightning-Fast Premium CDN with 130+ PoPs integrates Verizon Edgecast CDN into the WordPress application.
- Let’s Encrypt SSL with Auto-Renewal add-on allows to issue and use a trusted, free certificate for a custom domain. The built-in functionality employs periodical renewal to prevent certificate expiration. The appropriate notifications are sent by email.
- WordPress Multisite Network enables/disables the same-named feature. It allows the application to act as a WordPress network hub, where the network can comprise several websites. With this built-in feature and Jelastic PaaS automation, you can create an independent network of websites and invite others to develop their sites on the same network even for commercial usage.
4. Specify Environment name, Display Name, choose availability Region (if available) and click Install. Wait several minutes for Jelatic PaaS to set up your WordPress Cluster.
Use the links and credentials from the successful installation frame or from the appropriate email to manage your WordPress application (or even create a network).
Domain and SSL Certificate Configurations
For production, the environment should have a public IP address and a custom domain that help to share information regarding your resource across the internet.
In case the WordPress was installed with Let’s Encrypt SSL Add-On, the public IP address was added to the Load Balancer node automatically.
The next step is to bind a custom domain to the environment and issue a trusted SSL certificate for it.
1. As for this example, create an A record for your custom domain that will map it to the public IP address attached to the Load Balancer node. If you are not familiar with this procedure, follow the steps in the linked guide.
2. Find the Let’s Encrypt Free SSL among the Load Balancer node Add-Ons and click the Configure button.
3. Paste the custom domain (e.g., vip.wpaas.pro) in the respective field and click the Apply button.
Once the SSL certificate is issued, you will be informed via a popup and an appropriate email.
4. The last step is to make sure all links within your WordPress application point to the custom domain. Open the admin panel using the link and credentials from the successful installation window or respective email. Go to the menu Settings and check whether the WordPress Address (URL) and Site Address (URL) fields contain the correct custom domain. If required, change it.
5. Finally, click the Save Changes button at the bottom of the Settings page and open the application with the new address.
As a result, we got a production-ready WordPress cluster with high-availability capabilities and resistance to web application security attacks. Extremely advanced performance is ensured by a new generation LiteSpeed application server, load balancer with fast HTTP/3 protocol support, reliable MariaDB Galera, built-in CDN, and Let’s Encrypt SSL. Try it out at our Jelastic PaaS platform.