Free. Easy. Flexible. They’re among the reasons WordPress is an extremely popular blogging tool, website builder, and robust content management system (CMS). With its REST API, it also provides a framework for online and mobile app development.
In general, it’s a great tool, but has its challenges. ClearScale worked with a couple of clients recently who encountered some of them when migrating complex WordPress applications to AWS. ClearScale was able to architect solutions that not only helped them overcome the issues, but the solutions also generated significant benefits that are saving time and money.
Performance and Scalability Challenges
Many organizations that use WordPress start out with it on a single server that runs all the dependencies. That typically includes a web server such as NGINX or Apache, dynamic language runtime, a database engine, and a distributed memory object caching system. That works well in the short term, but the options for increasing system performance are limited.
It’s possible to migrate to a larger server with more RAM and CPU cores or offload the database and web server to separate machines. To scale out and enhance performance, however, the best tactic is to migrate to the cloud. The AWS Cloud, in particular, offers numerous resources, as well as scaling and automation possibilities. Moving WordPress to the cloud, however, isn’t necessarily easy due to some of the inherent characteristics of the program.
For one thing, WordPress is a stateful application. By default, it saves all the files uploaded during the client’s or site administrator’s activities on the local disk. In order to make WordPress stateless, all the dynamic files, as well as static web assets, must be moved out of the server instance to some kind of shared file storage.
WordPress relies heavily on a database. In many cases, updates of the WordPress codebase require updates to the database schema and data. This means that the build and deployment processes must take into account all the many moving parts to ensure seamless deployments. This is especially true when looking towards the implementation of continuous integration and continuous delivery practices.
In addition, developers create and test updates in local in-house environments. Even if the same operating system is used, various dependency- and environment-related issues can arise at deployment that requires the Development and Operations teams to troubleshoot and fix them.
The Client Challenge
In the case of one of ClearScale’s clients, it had a unique web application built on WordPress and a Symfony framework that was securely storing and processing half of a terabyte of document files. Because the application ran on a single instance, there were concerns about its performance and availability. If the server was to go offline, whether due to a loss of power, hardware issues or just having too many clients online at a time, the application wouldn’t be available.
Moving to a highly available AWS Cloud environment would solve many of the client’s issues. But making that move would require expertise in AWS best practices and cloud migrations — and the ability to architect a solution appropriate for dealing with WordPress. ClearScale offered the requisite knowledge and experience in all three areas.
The ClearScale Solution
The first step for ClearScale was to gain an in-depth understanding of the client’s application, its uses, and the overall project goals. From there, ClearScale drew upon AWS best practices and its own expertise in architecting appropriate cloud infrastructure to design scalable, highly available cloud environments for the client’s development, staging, and production stages. Doing so would enable developers to use AWS’s wealth of resources, services, and automation on all three environments.
The WordPress Tier
ClearScale’s solution features the WordPress application running on Amazon Elastic Compute Cloud (Amazon EC2) instances, within an auto-scaling group (ASG) for automatic scaling and management, behind a public load balancer. Using a load-balanced, automatically scaled group of instances increases application availability and fault tolerance.
Elastic load balancing distributes the incoming application or network traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses in multiple Availability Zones to ensure the high availability of the web application.
The Storage Tier
Working closely with developers, ClearScale ensured that the application is stateless and doesn’t store data locally. All the data that was supposed to be shared between load-balanced application instances is moved to Amazon Elastic File System (Amazon EFS).
With Amazon EFS, storage capacity is elastic, growing and shrinking automatically as files are added and removed, so the application has the storage needed when necessary. When mounted on Amazon EC2 instances, the Amazon EFS file system provides a standard file system interface and file system access semantics, allowing for seamless integration of Amazon EFS with existing applications and tools.
Multiple Amazon EC2 instances can access an Amazon EFS file system at the same time, providing a common data source for workloads and applications running on more than one instance or server.
Amazon Elastic Block Store (Amazon EBS) is also used to provide block level storage volumes for use with EC2 instances. EBS volumes are highly available and reliable storage volumes that can be attached to any running instance that is in the same Availability Zone. EBS volumes that are attached to an EC2 instance are exposed as storage volumes that persist independently from the life of the instance.
The EBS volumes are protected by Amazon EBS encryption. The encryption operations occur on the servers that host EC2 instances, ensuring the security of both data at rest and data in transit between an instance and its attached EBS storage.
The Database Tier
The database tier is built on Amazon Relational Database Service (RDS) in a multi-Availability Zone configuration. Amazon RDS provides cost-efficient, resizable capacity for an industry-standard relational database and manages common database administration tasks.
The Cron Job Tier
The application relies on multiple cron jobs that play an important part in processing new incoming data. After consulting with the client’s development team, ClearScale’s engineers created a separate self-healing instance where all the cron jobs would run.
The auto-scaled instance uses a custom Amazon Machine Image (AMI), which includes all the dependencies required by the application. HashiCorp Packer is used to automate the creation of any new AMIs if there are changes in dependencies.
The cron job is built on the same base AMI with the WordPress app, but is used to run periodic cron tasks with various scripts. The cron job instance is used to execute period jobs. A CI/CD pipeline is used to update the cron tab schedule.
ClearScale developed an advanced CI/CD process based on AWS native services, including CodeBuild and CodeDeploy, which makes build and deployment to any of the environments fast and easy with no downtime.
The solution incorporates numerous other AWS services to handle management, monitoring, security, and compliance. They include Amazon CloudWatch and Amazon CloudFormation, AWS Identity and Access Management (IAM), and AWS CloudTrail.
A multi-component disaster recovery plan is included as well to protect the client’s data and IT infrastructure in the event of a manmade or natural disaster. This involves maintaining highly available systems, keeping both the data and system replicated off-site, and enabling continuous access to both.
By working closely with the client and staying in constant communication throughout the entire process, ClearScale delivered a solution that’s yielded multiple benefits. The web application is always fast and available, and doesn’t suffer from load spikes. That helps keep the client’s customers satisfied.
With the client’s developers using a development environment that’s consistent with the staging and production environments, and the same automation jobs for build and deploy processes, those processes are now faster and more predictable. The time required to release new features has been reduced, generating greater customer satisfaction as well.
The overall environment is now more cost effective because auto-scaling ensures that it’s running just enough resources for the current amount of load. In addition, infrastructure automation and the use of AWS-managed resources have significantly reduced the management burden, saving money and valuable IT resources.
The ClearScale Difference
Among the advantages ClearScale brings to complex projects like the one discussed here is that we’re an AWS Premier Consulting Partner. We have proven proficiency and expertise in applying AWS services and best practices across a broad range of industries and project types. Closely collaborating with our clients is a hallmark of how we work, as is our ability to architect solutions that yield process enhancements and added value for our clients.
Get in touch today to speak with a cloud expert and discuss how we can help: