Thursday, February 9, 2012

Architecting WordPress on AWS Series : Part 2

In first part of this series we dealt with Simple Single Server architecture for WordPress. Now we will see the next most common architecture in WordPress deployment – Multi-tiered architecture. This architecture is better than the Single Server architecture in terms of Stability and Performance.

Architecture 2: Multi-Tiered Setup in AWS



This architecture may sound little complex than Architecture 1 because of bringing RDS MySQL into picture. But on the contrary, it is easier to deploy RDS MySQL into the application than configuring a MySQL. Users or customers with minimum technical knowledge can get this started and running like the previous architecture.
In addition to RDS MySQL, Amazon CloudFront CDN is introduced into this architecture for improving the performance. W3TotalCache Plugin can be configured in WP to use AWS CloudFront for delivering Static assets like CSS, images, JS and themes. W3TotalCache plugin +CDN improves the response time by 3-4X times.
Overall this architecture uses two EC2 instances one for WP, Linux and Apache and second one for RDS MySQL. WP EC2 instance is an EBS backed AMI and it has both the WP mgmt and content running. Both the WP EC2 and RDS should be placed in Same Availability Zone and Same region. This reduces latency and also saves inter-AZ cost. It is minimum recommended to start the WP EC2 with large instance and RDS MySQL Large instance for the DB. WP EC2 large instance is 64-bit vm with better CPU, memory and high IO and bandwidth compared to its smaller counterparts in AWS.
Periodic EBS Snapshot backups can be taken for the WP EC2 instances and moved to S3.  RDS MySQL Dumps and snapshots can be configured in AWS console. RDS MySQL offers point in time recovery and configurable backup retention period. RDS MySQL currently supports only innoDB engine, so developers and implementers should note this before migrating to RDS. Overall AWS managed RDS services will ease the management headache and save significant maintenance cost for the company in long term.
Both the EC2 instance can be enabled with Detailed CloudWatch monitoring in the AWS console. Cloudwatch monitoring can be combined with SNS for System alerts to Email.
This architecture does not factor High Availability or Scalability needs. It is suitable for website serving few thousands pages per day and not suitable for scenarios with heavy traffic serving millions of pages.
Since the MySQL DB and WP EC2 instance are separated into Multi Tiers, each of the tiers operate with their own memory and CPU. This multi-tiered architecture improves the performance over the single server architecture discussed on part 1.
Customers should be aware this architecture has single point of failure at all levels. Since the RDS MySQL is separated from WP EC2 instance, DB and WP EC2 instance failures can be separated. In case of premature EC2 instance shutdown/crash, recovery might take from minutes to hours depending upon the complexity.  RDS can be recovered from the Point in time recovery or snapshots. RDS Recovery usually takes 5-10 minutes for 5 GB DB. Recovered RDS MySQL will have different end point URL and the new URL needs to be again configured in the WP EC2 instance configuration files.

The running infra cost will be around 700 USD per month in AWS (24X7 and not including any licensed software) and may vary depending upon the Data transfer usage/EBS Storage.

Note: Since AWS is constantly reducing their prices, it is better to use their Calculator and find the latest price at the time of reading this article.




Related Articles:


FAQ for Scalable WP architecture can be found here (Must read)
Architecting WordPress in AWS : Part 1 : Single Server Setup
Architecting WordPress in AWS : Part 2 : Multi tiered setup
Scaling WordPress in AWS to serve million page hits


No comments:

Need Consulting help ?

Name

Email *

Message *

DISCLAIMER
All posts, comments, views expressed in this blog are my own and does not represent the positions or views of my past, present or future employers. The intention of this blog is to share my experience and views. Content is subject to change without any notice. While I would do my best to quote the original author or copyright owners wherever I reference them, if you find any of the content / images violating copyright, please let me know and I will act upon it immediately. Lastly, I encourage you to share the content of this blog in general with other online communities for non-commercial and educational purposes.

Followers