Key Challenges

Due to high utilizations on the server during the critical business hours, We need to implement auto-scaling for a WordPress server in AWS while ensuring seamless data synchronization between servers without using NFS or EFS due to client requirements to avoid downtime and incur additional costs.

Key Results

The project achieved substantial cost savings by leveraging S3 instead of NFS or EFS, effectively reducing operational expenses. Automatic scaling was successfully implemented, ensuring uninterrupted service during peak traffic periods through consistent data synchronization. Efficiency was improved with inotifywait, minimizing data transfer and boosting overall system performance. These outcomes collectively enhanced operational efficiency while meeting client requirements without incurring additional costs.

Overview

The client required an auto scaling solution for their WordPress server hosted on AWS. The objective was to handle high CPU and memory utilization by automatically scaling out the infrastructure. Two primary use cases needed to be addressed:

  1. Changes made via the WP Admin Console.
  2.  Changes made via FTP by developers.

The challenge was to synchronize the WordPress data directory across multiple instances without incurring additional costs associated with NFS or EFS.

Challenges

  1. Data Synchronization: Ensuring that changes made through the WP Admin Console and FTP are consistently reflected across all instances.
  2. Cost Constraints: Avoiding the use of NFS or EFS and other affiliated resources due to client cost constraints in the environment .
  3. Efficient Syncing: Implementing a solution that efficiently syncs data without re-syncing the entire directory.

Solution

  1.  Prepare S3 Bucket : Created an S3 bucket to store the WordPress data. This bucket serves as the central repository for syncing data across all instances.
  2. Setup EC2 Instance : Installed necessary tools such as inotify-tools and awscli on the EC2 instance to facilitate real-time monitoring and syncing of file changes.
  3. Create the Syncing Script : Developed a script using inotifywait to monitor changes in the local WordPress directory. The script ensures that any modifications, creations, or deletions in the directory are promptly synced to the S3 bucket
  1. Set Up the Service File : Configured the script to run as a service, ensuring it starts automatically at boot and runs continuously to monitor and sync changes.
  2. Setting up Launch Template : Created an Amazon Machine Image (AMI) of the configured EC2 instance. Updated the launch template to use this AMI, ensuring that new instances created during autoscaling are pre-configured with the syncing script and necessary tools.

Business Outcome

  1. Enhanced Reliability and Availability : By implementing an auto scaling solution, the WordPress server could automatically handle traffic spikes and high resource utilization without manual intervention. This ensured that the website remained available and responsive, providing a consistent user experience even during peak usage times. The real-time syncing of data across all instances ensured that any changes made via the WP Admin Console or FTP were immediately reflected, maintaining data integrity and consistency.
  1. Operational Efficiency : The use of inotifywait for file monitoring and syncing allowed for an efficient and low-overhead way to manage changes in the WordPress data directory. This approach minimized the amount of data transfer required, reducing both bandwidth usage and synchronization time. The automated setup reduced the need for manual monitoring and intervention, freeing up the IT team to focus on other critical tasks. This efficiency contributed to overall smoother operations and quicker response times to changing conditions.
  1. Cost Management : By avoiding the use of NFS or EFS and leveraging the existing S3 infrastructure, the solution kept operational costs low. The client was able to achieve the desired functionality and performance without incurring additional expenses associated with managed file systems. This cost-effective approach allowed the client to allocate budget resources to other areas of their business, supporting growth and development initiatives without compromising on the performance and reliability of their WordPress infrastructure.

Share this post

Related Case Studies

No Case Studies available related to this page.

The Ankercloud Team loves to listen