Contenu connexe Plus de Amazon Web Services (20) STG324_Learn to Build a Cloud-Scale WordPress Site That Can Keep Up with Unpredictable Changes and Capacity Demands1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS re:INVENTLearn to Build a Cloud-Scale
WordPress Site That Can Keep Up
with Unpredictable Changes and
Capacity Demands
D a r r y l S . O s b o r n e — S o l u t i o n s A r c h i t e c t
S T G 3 2 4
N o v e m b e r 2 8 , 2 0 1 7
2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cloud-scale WordPress site
• What is WordPress?
• What are the requirements?
• What AWS features align with the requirements?
• How do you deploy it?
• How do you administer it?
3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is WordPress?
4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What do you think about?
• Web site
• Blog
• Free and open-source
• Content management system
• PHP and MySQL
5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What do you think about?
• Latest version 4.8
• Used by 58.7% of all known CMS websites
• 27.5% of the top 10 million websites*
* “Usage Statistics and Market Share of Content Management Systems for Websites” W3Techs. February 22, 2017
6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What do you think about?
• b2/cafelog
• 2003
• Pre-cloud
• Not built for elasticity
• Not built for scalability
7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What are the requirements?
8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What do you think about?
• Who is your audience?
• What are the availability requirements?
• What are the durability requirements?
• What are the scalability requirements?
9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Whole website delivery via Amazon CloudFront
10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What AWS features align with the
requirements?
11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What do you think about
when choosing a storage solution?
EconomicsStorage type Features
and performance
12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
File
Three types of storage
ObjectBlock
13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
File
Three types of storage
Data stored as files in a
directory hierarchy
Shared over a network
14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Block
Three types of storage
Data stored as blocks on a
disk or disks
Locally attached
15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Object
Three types of storage
Data is stored as an object
that’s identified by a key in a
flat space
Simple API to get and put data
based on key
16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why is file storage so popular?
Works natively with operating systems
Provides shared access while providing consistency guarantees and
locking functionality
Provides hierarchical namespace
17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
File
How does performance compare?
Object
Block
Latency
Throughput
18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Before Amazon EFS…DIY file storageAZ-a
Clients
Storage
volumes
AZ-b
Storage
volumes
File server
File server
19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EFS
A fully managed file service
20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key features of Amazon EFS
ScalableSimple Elastic
Highly available and durable
21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key features of Amazon EFS
ScalableSimple Elastic
Highly available and durable
22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key features of Amazon EFS
ScalableSimple Elastic
Highly available and durable
23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key features of Amazon EFS
ScalableSimple Elastic
Highly available and durable
24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key features of Amazon EFS
ScalableSimple Elastic
Highly available and durable
25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Designed for a wide spectrum of needs
Scale-out jobs Metadata-intensive jobs
Analytics
Media and
entertainment
workflows
Web serving
Content management
Database backups
Enterprise apps
and messaging
Dev tooling
Home directories
Container storage
Low latency and serial I/OHigh throughput and parallel I/O
26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Security model and security features
Control
network traffic
using Amazon VPC
security groups and
network ACLs
Control file and
directory access
using POSIX
permissions
Control administrative
access (API access)
using AWS Identity and
Access Management (IAM)
(action-level and
resource-level
permissions)
Encrypt
data at rest
using keys
managed in
AWS KMS
27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EFS economics
$0.30/GB-Month (US Regions)
$0.33/GB-Month (EU Ireland)
$0.36/GB-Month (EU Frankfurt)
$0.36/GB-Month (AP Sydney)
No minimum commitments
or upfront fees
No need to provision
storage in advance
No other fees, charges,
or billing dimensions
28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Before Amazon EFS…costs of DIY file storageAZ-a
Clients
Storage
volumes
AZ-b
Storage
volumes
File server
File server
Amazon EC2
instance costs
Inter-AZ data
transfer costs
Amazon EBS
volume costs
29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
TCO example: For storing 500 GB,
Amazon EFS is 70% less than DIY
Amazon EFS cost: (500GB * $0.30/GB-month) = $150 per month
For DIY, you might provision 600 GB of EBS (i.e., ~85% utilization):
Storage (2x 600 GB EBS gp2 volumes): $120 per month
Compute (2x m4.xlarge instances): $290 per month
Inter-AZ data transfer costs (est.): $130 per month
Total $540 per month
30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Where is Amazon EFS available today?
• US West (Oregon)
• US East (N. Virginia)
• US East (Ohio)
• EU (Ireland)
• EU (Frankfurt)
• Asia Pacific (Sydney)
More coming soon!
31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Store WordPress on a shared file system
• All web servers will access the
same file system
• Achieve high availability and
durability
• Scale out with multiple threads
and connections
32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Use relational database as a service
• Allow AWS to manage
database tier
• Achieve high availability and
high durability
• Scale out with Amazon Aurora
replicas
• Automatically grows storage
as needed
33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Load balance with Auto Scaling web servers
• Allow AWS to manage load
balancing across multiple AZs
• Achieve better fault tolerance
• Trigger Auto Scaling to scale out
and in on demand
• Run web servers in private
subnets and NAT Gateway for
public outbound access
34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cache content close to end users
• For a good user experience
• Use CloudFront to cache
content
• CloudFront has 100 edge
locations worldwide, as of
October 2017
35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How do you deploy it?
36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What do you think about?
• What’s the size of the team?
• Do you want it repeatable?
37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Reference architecture & AWS CloudFormation
https://github.com/awslabs/aws-refarch-wordpress
38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How do you maintain it?
39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What do you think about?
• How to back it up?
• How to deploy plugins and themes?
40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EFS to Amazon EFS
Automatically backs up EFS
Easy to deploy
Backup solution
41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Manage plugins & themes
42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Summary & best practices
43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Reference architecture
44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Whitepaper
WordPress: Best Practices
AWS
Reference Architecture for Scalable
WordPress-powered Websites
November 2017
45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Best practices
• Use Amazon CloudFront to cache static and dynamic
content
• Use Amazon ElastiCache to cache database reads
• Use OPcache on all web servers to cache precompiled PHP
scripts to boost performance
• Increase the size of realpath_cache_size
• Verify opcache.max_accelerated_files settings
• Test different opcache.memory_consumption values
46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Best practices
• Store all data in Amazon EFS for ease of use or static
content in Amazon S3 for storage cost efficiencies
• Share the same Amazon EFS file system among sites
• Add more data to increase Amazon EFS throughput
• Set up Amazon CloudWatch alarms
• Set up ALB to trigger Auto Scaling policies
47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Best practices
Test test test
48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
References
Reference architecture—https://github.com/awslabs/aws-refarch-wordpress
Amazon EFS webpage—https://aws.amazon.com/efs/
Amazon EC2 webpage—https://aws.amazon.com/ec2/
Auto Scaling webpage—https://aws.amazon.com/autoscaling/
ELB webpage—https://aws.amazon.com/elasticloadbalancing/
Amazon RDS webpage—https://aws.amazon.com/rds/
Amazon ElastiCache webpage—https://aws.amazon.com/elasticache/
Amazon CloudFront webpage—https://aws.amazon.com/cloudfront/
49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
References
WordPress site—https://wordpress.org
Opcache—https://php.net/manual/en/book.opcache.php
Opcache with EFS—https://github.com/awslabs/aws-refarch-wordpress#opcache
W3 Total Cache plugin—https://wordpress.org/plugins/w3-total-cache
50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!