{Wordpress Overview} {Type of Scaling} {Common vs Scalable Arch} {Decoupling Servers} {Wordpress Plugins} {Security Best Practices} {Autoscaling DEMO on AWS}
free and open source content management system (CMS) based on PHP and MySQL. It is the most widely used CMS software in the world, and as of May 2019, it powers more than 30% of the top 10 million websites and has an estimated 60% market share of all websites built using a CMS (Wordpress.com)
A process to increase (or decrease) server resource to adapt application needs.
{Requires downtime} {Low Availability} {Limited upgradeability: CPU, RAM}
{Run Multiple WP Instance} {Add Load Balancer} {File Server for: Upload, Themes, etc} {Cache Server: Redis/Memcache} {DB Server: Master and Slave} {Offload Assets to CDN: JS, CSS, Images}
{At least two AZ} {VPC: Public and Private Subnet} {EC2: WP on Nginx} {ELB: App Load Balancer} {RDS: DB Master and Slave} {EFS: File Server} {Elastic Cache: Redis Cache Server} {AutoScaling: Scalability} {S3: Deliver Media Assets}
By default Wordpress only support single database connection.
How to fix it? HyperDB to the rescue!
HyperDB is a very advanced database class that replaces a few of the WordPress built-in database functions. The main differences are:
* HyperDB can be connect to an arbitrary number of database server,
* HyperDB inspects each query to determine the appropriate database.
{Do not scale too early} {Monitor your servers} {Try aggressive caching first} {Try small vertical scaling} {Horizontal scale gradually}
{ELB on Public Subnet, others on Private Subnet} {Use AWS Security group instead of OS firewall} {SSH using bastion host to access instances} {Use EC2 IAM Role to upload to S3}
https://awsug-wp-talk.rioastamal.net
State | # of WP Servers |
---|---|
Normal | 2 |
Auto-Scaling | 4 |
Host awstalk-bastion
Hostname 18.140.255.131
User ubuntu
Host awstalk-wp-main
Hostname 10.11.2.11
User ubuntu
ProxyCommand ssh -A awstalk-bastion -W %h:%p
Host awstalk-wp-standby
Hostname 10.11.4.133
User ubuntu
ProxyCommand ssh -A awstalk-bastion -W %h:%p
e.g SSH into Wordpress main instance
$ ssh awstalk-wp-main
Accessing RDS Master
$ RDS_MASTER_HOST=YOUR_RDS_END_POINT
$ ssh -CNq -L \
127.0.0.1:4406:$RDS_MASTER_HOST:3306 awstalk-bastion
Use mysql client to connect on 127.0.0.1 port 4406
$ mysql -u admin -h 127.0.0.1 -P 4406 -p
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::cdn.awsug-wp-talk.rioastamal.net/*"
}
]
}