Update: More recent version of highly-available WordPress cluster is described in the article "Highly-Available WordPress Hosting with Automatic Clusterization on All Stack Layers"
The availability and performance have a direct business impact and therefore 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. Thus, to minimize the risk of such issue occurrence and to ensure an extra level of redundancy, the clustering approach can be used. Today, we'll take a closer look at auto-scaling and clusterization of WordPress CMS.
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.
In this article, we’ll cover 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
Pre-packaged WordPress cluster is available in 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+ Super PoPs located on six continents. Jelastic 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 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, the 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, 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 account, you can register and deploy the WordPress Cluster by clicking the “DEPLOY TO JELASTIC” button below. Within the opened widget, specify your email address, choose one of the Jelastic Public Cloud providers, and press Install.
The registered users can install WordPress Cluster Kit by importing the appropriate manifest.jps file from GitHub or from the Jelastic Marketplace directly at the dashboard. Note that this clustered solution is available only for billing customers.
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 allows automatically scale in/out servers using specially configured triggers. Based on our experience, we offer three common scaling scenarios 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
3. Activate the preferred Advanced Features.
- LiteSpeed High-Performance Web Server installs 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 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 the 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 variable.
- Highly-Available WordPress Hosting with Automatic Clusterization on All Stack Layers 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 failover procedures.In case you untick the checkbox, a regular standalone MariaDB database will be installed. Thus, high availability and failover 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 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 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 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 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 our example, create an A record for your custom domain that will map it to the public IP address attached to Load Balancer. If you are not familiar with this procedure, follow the steps in the linked guide.
2. Then find the Let’s Encrypt Free SSL among the Load Balancer Add-Ons and click the Configure button.
3. Paste the custom domain (for example, vip.wpaas.pro) in the respective field and click Apply.
Once the SSL certificate is issued, you will be informed via popup and the 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 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 a new address.
As a result, we got a production-ready WordPress cluster with high-availability capabilities and resistance to the web application security attacks. Extremely advanced performance is ensured by a new generation LiteSpeed application servers, load balancer with fast HTTP/3 protocol support, reliable MariaDB Galera, built-in CDN, and Let’s Encrypt SSL. Try it out at one of the Jelastic service providers.