scale your application while improving performance and lowering costs (svc203) | aws re:invent 2013
DESCRIPTION
Scaling your application as you grow should not mean slow to load and expensive to run. Learn how you can use different AWS building blocks such as Amazon ElastiCache and Amazon CloudFront to “cache everything possible” and increase the performance of your application by caching your frequently-accessed content. This means caching at different layers of the stack: from HTML pages to long-running database queries and search results, from static media content to application objects. And how can caching more actually cost less? Attend this session to find out!TRANSCRIPT
![Page 1: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/1.jpg)
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc.
Cache is King: Scale Your Application while Improving
Performance and Lowering Costs
November 15, 2013
![Page 2: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/2.jpg)
Cash is King Cash is King
![Page 3: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/3.jpg)
Cache is Cash
![Page 4: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/4.jpg)
Httparchive
![Page 5: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/5.jpg)
Content Breakdown
87% of Your Site Consists Of Static/Re-usable Content
![Page 6: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/6.jpg)
56% of The Internet’s Content is NOT Cached Today
But Wait…
![Page 7: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/7.jpg)
Cache is King
Source: httparchive.org
300K Tracked Websites Oct 15 2012-Oct 1 2013
~56% {
![Page 8: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/8.jpg)
CACHE EVERYTHING
![Page 9: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/9.jpg)
Browser Cache
Edge Cache
Web Cache
Application Cache
Database Cache
Image Source: cakeormistake.wordpress.com
![Page 10: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/10.jpg)
![Page 11: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/11.jpg)
![Page 12: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/12.jpg)
Speed of Light ~300,000 Km/s
Image Source: wordlesstech.com
![Page 13: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/13.jpg)
~200,000 Km/s through fiber
Image Source: www2.wiringandcabling.com
![Page 14: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/14.jpg)
Download Performance
Round Trip: 13,026 km
![Page 15: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/15.jpg)
Download Performance
Round Trip: 13,026 km
Theoretical: 65 ms
![Page 16: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/16.jpg)
Download Performance
Round Trip: 13,026 km
Theoretical: 65 ms
Measured: 68 ms
![Page 17: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/17.jpg)
Time to First Byte
68 ms
Client Server
![Page 18: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/18.jpg)
Time to First Byte
68 ms
68 ms
Client Server
SYN
SYN/ACK
![Page 19: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/19.jpg)
Time to First Byte
68 ms
68 ms
68 ms
Client Server 136 ms
SYN
SYN/ACK
ACK,
GET /image.jpg HTTP/1.1
![Page 20: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/20.jpg)
Browser Cache
![Page 21: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/21.jpg)
Browser Caching
Set max-age or expiry date in the headers.
HTML5 Application Cache.
Helps eliminate network latency.
But… Browser cache size is limited. (e.g. IE is 8-50M, Chrome is < 80M, Firefox is 50MB, etc.)
![Page 22: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/22.jpg)
Browser Cache
Edge Cache
![Page 23: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/23.jpg)
Time to First Byte
68 ms
68 ms
68 ms
Client Server 136 ms
SYN
SYN/ACK
ACK,
GET /image.jpg HTTP/1.1
![Page 24: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/24.jpg)
Bring the Bytes Closer to Your Users
68 ms
Client Origin
SYN
10 ms
SYN/ACK
GET /image.jpg HTTP/1.1 ACK,
GET /image.jpg HTTP/1.1
CloudFront
Saves 68 ms
RTT
SYN
SYN/ACK
Time to first byte: 20 ms vs. 136 ms
![Page 25: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/25.jpg)
Amazon CloudFront: 46 Global Locations
=
![Page 26: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/26.jpg)
Edge Cache: Amazon CloudFront
Amazon S3
Elastic Load
Balancing
Mobile Clients
Browsers/Desktop
Clients
Tablets/Devices
Amazon CloudFront
Edge Location
![Page 27: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/27.jpg)
Edge Cache
How do you decide what to cache?
• Static or Re-Usable Content
• Customized Content
• On-Demand and Live Video
• Dynamic or Unique Content
![Page 28: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/28.jpg)
Cache Static or Re-Usable Content
HTTP/1.0 200 OK
Date: Mon, 19 Mar 201 12:51:28 GMT
Server: Apache
Last-Modified: Mon, 19 Mar 2012 07:15:25 GMT
Accept-Ranges: bytes
Content-Length: 1918
Cache-Control: max-age=86400
Content-Type: image/jpeg Vary: Accept-Encoding
Age: 16
X-Cache: Hit from cloudfront
Connection: keep-alive
![Page 29: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/29.jpg)
![Page 30: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/30.jpg)
Cache Customized Content
Customized Content
![Page 31: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/31.jpg)
![Page 32: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/32.jpg)
Cache Video Content
![Page 33: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/33.jpg)
![Page 34: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/34.jpg)
Caching Your Live Stream?
Source
HTTP
Cache
Edge
Paris
New York
Encoder
HLS, HDS,
Smooth Streaming
Hong Kong
![Page 35: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/35.jpg)
![Page 36: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/36.jpg)
Dynamic Content?
Zero TTL – cannot be cached! CloudFront can still help…
![Page 37: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/37.jpg)
Dynamic Content?
Zero TTL – cannot be cached! CloudFront can still help…
TCP/IP optimizations for the network path
Keep-Alive Connections to reduce RTT
SSL Termination close to viewers
POST/PUT upload optimizations
Latency Based Routing
Low prices, same as static content delivery!
![Page 38: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/38.jpg)
“We are excited to use CloudFront's new
POST, PUT, PATCH, and DELETE capabilities
to accelerate our RESTful APIs on Amazon
EC2. With these new HTTP methods we can
now take advantage of CloudFront’s global
footprint and optimized connections back to
our origin servers in AWS. Routing our
customers’ API requests via a CloudFront edge
location near them will help improve their
experience by minimizing packet loss and
upload latency. This will help provide a
streamlined experience for our customers.”
- Ilan Rabinovitch, Tech Lead, Site Reliability Engineering
![Page 39: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/39.jpg)
Browser Cache
Edge Cache
Web Cache
![Page 40: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/40.jpg)
You can’t have dessert,
until you have your dinner!
-An Experiment. https://secure.flickr.com/photos/stephen-oung/6319155216/
![Page 41: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/41.jpg)
Experiment Premise
• Start with basic infrastructure. – Single m1.large EC2 instance running Amazon Linux
– Single non-Multi-AZ m1.xlarge RDS MySQL 5.6 instance
– Apache httpd-2.2.25
– PHP 5.3.27
– Drupal Commerce Kickstart 7.2
– EIP on Instance
• Throw a ton of traffic at it. – 8,000,000 queries, 40 per second, from 4 other instances.
• Profile it. – New Relic PHP agent
– webpagetest.org
![Page 42: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/42.jpg)
Experiment Infrastructure
Web/App
Instance
Elastic IP Amazon RDS
DB Instance Clients
![Page 43: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/43.jpg)
Results? (not pretty)
14.7 second responses
Mostly Static Data
Low RPM
![Page 44: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/44.jpg)
Web Cache
Webserver or proxy caches would live between
your CDN/Users and your web tier and can offer
up increased cost performance via reducing
internal application and database load. Can also
offer up increased edge to origin speed for lots of
content.
![Page 45: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/45.jpg)
Web Cache
Popular solutions: – Varnish
– Nginx
– Apache with mod_cache/mod_proxy
– Squid
– Perlbal
– Language/framework caches (i.e., APC, Zend)
![Page 46: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/46.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 47: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/47.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 48: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/48.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 49: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/49.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 50: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/50.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 51: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/51.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 52: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/52.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 53: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/53.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 54: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/54.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 55: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/55.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 56: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/56.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 57: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/57.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 58: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/58.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 59: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/59.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 60: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/60.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 61: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/61.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 62: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/62.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 63: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/63.jpg)
Web Cache
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing
Internet
Gateway
Amazon
Route 53
Amazon
CloudFront
Customer
Traffic
![Page 64: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/64.jpg)
Web Cache
• Opt for in-memory caching when possible.
• Pay attention to your cache hit/miss ratios. It could be a sign that you need to re-size the instances or re-size the number of nodes in your cache pool.
• Set smart TTLs so that you don’t affect new deploys or cache content for too long.
• Be smart about what cookies can burst cache and what cookies can’t. Don’t serve up other people’s content or stale dynamic pages.
![Page 65: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/65.jpg)
Web Cache
How do you decide what to cache? – All logged out user pages
– Any completely static pages
– Traffic/log analysis
• Look at your web logs/CDN logs
• Find heavily hit pages
• Figure out how often they actually change
• Apply a TTL to that page to be cached
– Even 60 second TTLs could help drastically!
![Page 66: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/66.jpg)
Browser Cache
Edge Cache
Web Cache
Application Cache
![Page 67: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/67.jpg)
Application Cache
Application level caches for information such
as session data, temporary application data
such as cart information, and live aggregation
of data feeds.
![Page 68: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/68.jpg)
Application Cache
Popular solutions: – Memcached
– Redis
– Cassandra
– Amazon DynamoDB
![Page 69: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/69.jpg)
Application Cache
Availability Zone
VPC Subnet VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing ElastiCache
Cache Node
Availability Zone
VPC Subnet VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing ElastiCache
Cache Node
Internet
Gateway
![Page 70: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/70.jpg)
Application Cache
Availability Zone
VPC Subnet VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing ElastiCache
Cache Node
Availability Zone
VPC Subnet VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing ElastiCache
Cache Node
Internet
Gateway
![Page 71: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/71.jpg)
Amazon DynamoDB Session Handler for PHP
https://aws.amazon.com/sdkforphp/
![Page 72: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/72.jpg)
Application Cache
Internet
Gateway
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing Squid Proxy
Instances Amazon
DynamoDB
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing Squid Proxy
Instances
![Page 73: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/73.jpg)
Application Cache
Internet
Gateway
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing Squid Proxy
Instances Amazon
DynamoDB
Availability Zone
VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing Squid Proxy
Instances
![Page 74: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/74.jpg)
Application Cache
Use Cases: – Session information
– Temporary data
• Cart info, metadata
– Rate limiting
• Fight abuse of APIs, spamming, functionality abuse
– Counters
• Views, Scores, Leader Boards
![Page 75: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/75.jpg)
Application Cache
How do you decide what to cache?
– Ideally, you have to treat data you cache at this tier as
loss tolerant if working with in-memory caches.
– Session information that wouldn’t make sense in
cookies or in a true DB.
– Look at the kind of data your application is generating
and storing in a DB that it might not need to.
![Page 76: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/76.jpg)
Browser Cache
Edge Cache
Web Cache
Application Cache
Database Cache
![Page 77: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/77.jpg)
Database Cache
Reduce workload on database servers by
caching commonly requested information, or
any information that might not change
frequently (i.e., user info, listing info, product
info).
![Page 78: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/78.jpg)
Database Cache
Popular solutions: – In-engine query caches
– Memcached
• On dedicated host
• On DB host (built in w/ MySQL 5.6)
– Redis
• On dedicated host
![Page 79: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/79.jpg)
Database Cache
A word of caution: In-engine DB caches are often not recommended for
many use cases, as they can significantly impact the
performance of many databases. Depending on the
workload and dataset you have, an in-engine query
cache might not be a good idea for you. We recommend
off DB caches where possible.
![Page 80: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/80.jpg)
Database Cache
Availability Zone
VPC Subnet VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing ElastiCache
Cache Node
Availability Zone
VPC Subnet VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing ElastiCache
Cache Node
Internet
Gateway
RDS Instance
Primary (M-AZ)
RDS Instance
Standby (MAZ)
![Page 81: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/81.jpg)
Database Cache
Availability Zone
VPC Subnet VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing ElastiCache
Cache Node
Availability Zone
VPC Subnet VPC Subnet VPC Subnet
Elastic Load
Balancing Cache
Instances
Web/App
Instances
Elastic Load
Balancing ElastiCache
Cache Node
Internet
Gateway
RDS Instance
Primary (M-AZ)
RDS Instance
Standby (MAZ)
![Page 82: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/82.jpg)
Memcached – Code Sample function retrieveValue($query)
{
$queryId = md5($query);
if ($myValue = $memcache->get($queryId))
{
return $myValue;
}
else
{
$myValue = dbfetch($query);
$memcache->set($queryId, $myValue);
return $myValue;
}
}
![Page 83: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/83.jpg)
MySQL 5.6 + Memcached
RDS MySQL supports version
5.6 with integrated Memcached
on the instance: – Part of the InnoDB engine
– Memcached running as part of MySQL
talks directly to data in InnoDB tables,
essentially turning MySQL into a fast
“key-value store”
– From the opposite view point, adds
persistence to Memcached
– Same Memcached API as standalone
https://dev.mysql.com/doc/refman/5.6/en/innodb-memcached-intro.html
![Page 84: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/84.jpg)
AWS Marketplace & Partners Can Help
• Customers can find, research, buy
software.
• Simple pricing, aligns with Amazon
EC2 usage model.
• Launch in minutes!
• Marketplace billing integrated into your
AWS account.
• 1100+ products across 24+ categories.
Learn more at: aws.amazon.com/marketplace
![Page 85: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/85.jpg)
Back To Our
Experiment!
https://secure.flickr.com/photos/toyochin/1382531438/
![Page 86: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/86.jpg)
Experiment Infrastructure (original)
Web/App
Instance
Elastic IP Amazon RDS
DB Instance Clients
![Page 87: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/87.jpg)
Results? (not pretty)
14.7 second responses
Mostly Static Data
Low RPM
![Page 88: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/88.jpg)
Experiment Infrastructure (with cake)
• Added in ElastiCache Memcached cache.m1.large
• Added in Amazon CloudFront for static content – Tuned expires and cache headers in Apache
• Added in APC for PHP caching – Increased memory to 128Mb, no other changes
• Did nothing to the DB
• Drupal memcached & CDN modules
![Page 89: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/89.jpg)
CloudFront
Experiment Infrastructure (with cake)
Web/App
Instance
Elastic IP
Amazon RDS
DB Instance
Clients
ElastiCache
Cache Node
![Page 90: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/90.jpg)
Results? (AWESOME!)
response time ~1/2
~2x RPM
Repeat Page view from 15.8sec to 2.75sec
![Page 91: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/91.jpg)
Easy as Pie!
https://secure.flickr.com/photos/linecon0/2654865842/
![Page 92: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/92.jpg)
Toronto Star
• Canada’s largest daily newspaper
• Focused on metro Toronto
• 3.3 million monthly unique visitors
• Small in-house digital group,
supported by vendors & corporate IT
• Digital group run as “startup” within
corporate structure
• Tech stack includes Java, PHP,
Ruby, Python
![Page 93: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/93.jpg)
mystar
![Page 94: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/94.jpg)
Wheels.ca
![Page 95: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/95.jpg)
Toronto.com
![Page 96: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/96.jpg)
Thegridto.com
![Page 97: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/97.jpg)
Why Cache?
• Performance
• Scalability
• Reliability
• Cost
![Page 98: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/98.jpg)
Breaking News
![Page 99: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/99.jpg)
Breaking News: Client View
![Page 100: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/100.jpg)
Breaking News: Server View
![Page 101: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/101.jpg)
The Caching Onion
![Page 102: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/102.jpg)
DB
App
Reverse proxy
Edge
![Page 103: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/103.jpg)
Edge – The Onion Skin
• Examples: Akamai,
CloudFront
• Static Asset caching
• Full site caching
• Origins
• Behaviors
• thestar.com, wheels.ca,
toronto.com, thegridto.com
Edge
![Page 104: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/104.jpg)
Edge – The Onion Skin
Production - US East Region
Elastic Load Balancer
Dispatcher/ApacheAmazon Linux 64 Bit
C1 Medium
Dispatcher/ApacheAmazon Linux 64 Bit
C1 Medium
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Master
Author CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Dispatcher/ApacheAmazon Linux 64 Bit
C1 Medium
Availability Zone A Availability Zone DAvailability Zone B
Cloudfront
VPC
Standby
Author CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Thestar.com
architecture
![Page 105: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/105.jpg)
Production - US East Region
Elastic Load Balancer
Dispatcher/ApacheAmazon Linux 64 Bit
C1 Medium
Dispatcher/ApacheAmazon Linux 64 Bit
C1 Medium
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Master
Author CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Dispatcher/ApacheAmazon Linux 64 Bit
C1 Medium
Availability Zone A Availability Zone DAvailability Zone B
Cloudfront
VPC
Standby
Author CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
Publish CQ/CRXAmazon Linux 64 Bit
C1-Xlarge
![Page 106: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/106.jpg)
Whole Site Delivery
• Cache everything possible
• No server side cookies written,
only select pages pass query
strings
• Control caching granularly using
19 different rules
• We use a single origin, but Elastic
Load Balancing and multi-tiered
multi-AZ configuration on backend
• Planning a multi-region DR
architecture that will also leverage
Amazon CloudFront
![Page 107: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/107.jpg)
Reverse Proxy / Web Accelerator
• Examples: Varnish, Nginx, Apache
• Serves “static” content
• Reduce load on app server
• wheels.ca, mystar, thestar.com, thegridto.com
Reverse proxy
![Page 108: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/108.jpg)
![Page 109: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/109.jpg)
![Page 110: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/110.jpg)
![Page 111: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/111.jpg)
Reverse Proxy / Web Accelerator
mystar
![Page 112: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/112.jpg)
Reverse Proxy / Web Accelerator
mystar
![Page 113: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/113.jpg)
Reverse Proxy / Web Accelerator
Wheels.ca
![Page 114: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/114.jpg)
App-level caching
• Examples:
Memcached, Reddis – ElastiCache now supports
both
• Session caching
• View caching
• mystar
App
![Page 115: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/115.jpg)
App-level caching
![Page 116: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/116.jpg)
![Page 117: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/117.jpg)
Database caching
• Example:
Memcached
• Cache frequent SQL
queries
• Reduce DB server
load, response time
• mystar, wheels.ca
DB
![Page 118: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/118.jpg)
![Page 119: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/119.jpg)
![Page 120: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/120.jpg)
Database Caching
Wheels.ca
![Page 121: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/121.jpg)
Database Caching
Wheels.ca
![Page 123: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/123.jpg)
Please give us your feedback on this
presentation
As a thank you, we will select prize
winners daily for completed surveys!
SVC203
![Page 124: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/124.jpg)
APPENDIX
![Page 125: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/125.jpg)
Reverse Proxy / Web Accelerator
Varnish Cache is a web application accelerator also
known as a caching HTTP reverse proxy. You install it
in front of any server that speaks HTTP and configure
it to cache the contents. Varnish Cache is really, really
fast. It typically speeds up delivery with a factor of 300
- 1000x, depending on your architecture.
- varnish-cache.org
![Page 126: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/126.jpg)
Reverse Proxy / Web Accelerator
Nginx (pronounced "engine x") is an open
source reverse proxy server for HTTP,
HTTPS, SMTP, POP3, and IMAP protocols,
as well as a load balancer, HTTP cache, and
a web server (origin server). The nginx
project started with a strong focus on high
concurrency, high performance and low
memory usage.
- Wikipedia
![Page 127: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/127.jpg)
App-level caching Memcached
Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering
![Page 128: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/128.jpg)
App-level caching
Redis
Redis is an open source, BSD licensed, advanced
key-value store. It is often referred to as a data
structure server since keys can contain strings,
hashes, lists, sets and sorted sets. – Redis.io
![Page 129: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/129.jpg)
Edge – The Onion Skin
“A content delivery network is a large distributed
system of servers deployed in multiple data
centers across the Internet. The goal of a CDN is
to serve content to end-users with high availability
and high performance.” - Wikipedia
![Page 130: Scale Your Application while Improving Performance and Lowering Costs (SVC203) | AWS re:Invent 2013](https://reader033.vdocuments.site/reader033/viewer/2022061223/54c6ad724a79593f6c8b456f/html5/thumbnails/130.jpg)
Reverse Proxy / Web Accelerator
“A web accelerator is a proxy server that
reduces web site access times. They can be
a self-contained hardware appliance or
installable software.” - Wikipedia