Amazon CloudFront and Amazon Route 53 can help optimize web application performance and availability. CloudFront improves performance by caching static and reusable content at edge locations and optimizing delivery of dynamic content through features like keep-alive connections and latency-based routing. Route 53 provides fast, reliable DNS services and can health check origins to improve high availability. Together, CloudFront and Route 53 provide a global network that caches content close to users and routes traffic based on network conditions to optimize performance and design for failure.
2. Fundamental Facts
Any web application must have…
• Tight Security
• High Availability
• High Performance
3. Why Does Availability Matter?
•
If your application is not available, your revenue loss is
100%.
•
Impact to customer loyalty and your brand image.
4. How AWS Helps?
Use Amazon Route 53 to health-check your origin
webservers, with automatic failover.
Use Amazon CloudFront to front your origins to reduce
load on your origins.
Use Amazon CloudFront to customize your error pages.
Amazon CloudFront will automatically serve stale
content when origin is unavailable.
9. How do we Improve Performance ?
A Typical Web Application Has …
•
Static or Re-Usable Content
•
•
•
High TTLs
Low TTLs (Customized Content)
Dynamic or Unique Content
•
Zero TTL
14. Why Don’t Customers Use a CDN for
Dynamic Content?
I don’t see the value - each request is unique and must go back
to the origin web server.
AND/OR
I see the value, but my current CDN charges premium rates for
dynamic content acceleration, with many additional fees.
AND/OR
Configuring a CDN for dynamic content acceleration requires
expensive professional services and is not self-service.
15. How Can Amazon CloudFront 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!
50. Steps to Find Cachable Content
1. Collect web (W3C) logs from your web tier
2. Run a report on your logs (Amazon EMR,
Amazon RDS, or Amazon Redshift)
3. Identify top N URLs
51. Steps to Find Cachable Content
Example of query:
Select count(url) count, url
from logs_table
Group by url sort by count;
53. STATIC or REUSABLE
A given content where the state of the content
does NOT change for a given period of time
t0
t1
54. Caching for Smaller Time Units
•
Goal: Find contents that can be cached for any
given period of time
•
•
Minutes
•
•
Hours
Seconds
CloudFront can cache content for any period of
time
55. Content with Query Strings
110 /factor/create_image?name=book1&size=10x10
Reusable?
56. Content with Query Strings
• CloudFront can cache content with query strings
• Every unique query string combination is a new
object in CloudFront’s cache
59. Caching for Smaller Time Units
1000 /api/GetBooks?top=10
•
Imagine your have a read heavy API GETS Hit 100 or 1000
RPS
•
Offload your web-tier from handling 1000 RPS
•
Offload your load balancer: Elastic Load Balancing or any
other LB
•
Provision less capacity and reduce cost
64. Can Dynamic Content Be Optimized?
Dynamic content is not cachable
Content proxied by CDN to the
origin and back
65. Can Dynamic Content Be Optimized?
Poke
Origin
Ok
Poke
Edge
Location
Poke
Ok
Poke
User
Request
User
Request
66. Can Dynamic Content Be Optimized?
That adds latency?
How to optimize dynamic content?
67. How to Optimize Dynamic Content?
TCP Connection
DNS Lookup
Time to First Byte
Content Download
68. How to Optimize Dynamic Delivery?
Faster Response Time =
Route 53
Reduced DNS Time
+
Keep-Alive Connections
& SSL Termination
Reduced Connection Time
+
Reduced First Byte Time
Keep-Alive Connections
TCP/IP Optimization
Rute53
Route 53
+
Reduced Content Download Time
72. Optimizing DNS Response Time
• Amazon Route 53 managed DNS offering
• Designed to be fast
• Low latency DNS resolution
• Global network of DNS servers
• Queries routed to the nearest DNS server
77. TCP/IP Hand Shake
• HTTP Runs on TCP/IP
• TCP has the concept of TCP handshake
• Every HTTP Connection has to complete TCP
Handshake
• TCP/IP Hand Shake Penalizes Dynamic
Contents
78. Two Users without CloudFront
SYN
SYN-ACK
360ms
ACK
GET /index.jsp
2nd
User
SYN
SYN-ACK
360ms
ACK
GET /index.jsp
90ms
84. CloudFront Keep Alive
• More users
Without CloudFront
With CloudFront
More TCP connections
2 connections
1 connection
• Offloads your web tier’s CPU/memory
• Improves response time
Without CloudFront
With CloudFront
720 ms
540 ms
88. SSL Optimization with CloudFront
• CloudFront has the ability to support SSL traffic
• Use CloudFront cert or bring your own
• SSL traffic gets terminated at the closest
CloudFront location
89. CloudFront SSL Optimization Benefits
• Taking advantage of keep-alive connections
• SSL introduces additional TCP handshake packets
• Keep alive eliminates additional SSL TCP handshake
packets
• Offloading your infrastructure from terminating 1000s of
end-users SSL connections
90. SSL Optimization Patterns with CloudFront
Two optimization patterns:
1. Half bridge SSL termination
2. Full bridge SSL termination
97. Slow-Start Optimization with CloudFront
• CloudFront can optimize slow start
• Slow start impacts new connections not the
existing ones
• CloudFront uses existing connections so users
can skip slow start
101. Performance Results
Test
# Of Packets
Response Time Per Request
Response Time For 200
Requests
Without
CloudFront
2605
170 ms
33.876 ms
With
CloudFront
896
96 ms
19.24 ms
104. PUT/POST Optimization with CloudFront
• CloudFront supports verbs: PUT, POST,
DELETE, OPTIONS, and PATCH
• Data won’t get cached
• CloudFront proxies data to origin
112. Latency-based Routing (LBR)
• Run multiple stacks of your application in different Amazon
EC2 regions around the world
• Create LBR records for each location and tag the location
with geo information
• Route 53 will route end users to the endpoint that provides
the lowest latency
112
113. LBR Benefits
• Better performance than running in a single region
• Improved reliability relative to running in a single
region
• Easier implementation than traditional DNS
solutions
• Much lower prices than traditional DNS solutions
113
116. CloudFront and Route 53
• Use CloudFront for dynamic content optimization
• Host your origin at multiple AWS locations (or data
centers)
– US
– Europe
117. CloudFront and Route 53
• Create Origin DNS records in Route 53 for each
location
• Route 53 measures the latency between CloudFront
and all configured origins
• Route 53 resolves origin’s hostname to the closest
location
• Reduce content download time
147. Users get connected to the
healthy regions if the
closest region is not
passing the health check
148. Design for Failure: Caching
• Caching improves performance
• Can also improve availability
• If your infrastructure is experiencing failure,
CloudFront can serve cached content instead of
5xx,4xx and etc
148
149. Design for Failure: Caching
• Going back to “cache as much as you can”
• More caching = better availability
149
150. Design for Failure: Serve Cached Content
Origin
Edge
Location
User Request A
151. Design for Failure: Serve Cached Content
Origin
Get Image
Edge
Location
User Request A
152. Design for Failure: Serve Cached Content
Get Image
Origin
Get Image
Edge
Location
User Request A
153. Design for Failure: Serve Cached Content
Get Image
Origin
Image
Get Image
Edge
Location
User Request A
154. Design for Failure: Serve Cached Content
Get Image
Origin
Image
Get Image
Edge
Location
Image
User Request A
155. Design for Failure: Serve Cached Content
Origin
Edge
Location
Image
User Request B
156. Design for Failure: Serve Cached Content
Get Image
Origin
Edge
Location
Get Image
User Request B
157. Design for Failure: Serve Cached Content
Get Image
Origin
Edge
Location
Get Image
User Request B
158. Design for Failure: Serve Cached Content
Get Image
Origin
Edge
Location
Image
Get Image
User Request B
159. Summary
• Accelerate all your content with CloudFront
• Use CloudFront with Route 53 latency-based
routing to improve your performance
• Design for failure with CloudFront and Amazon
Route 53
164. Customer Story: POST/PUT
“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
166. Customer Story: Health Checks &
Failover
“Amazon Route 53’s DNS Failover
feature provides high availability
across our multiple AWS regions and
gives us the ability to offload our
origins.”
167. Please give us your feedback on this
presentation
ARC309
As a thank you, we will select prize
winners daily for completed surveys!