Speeding up delivery of web content using Amazon Route 53, Elastic Load Balancer and CloudFront

3,866 views

Published on

Amazon Route 53, AWS Elastic Load Balancer, and Amazon CloudFront can be used together to increase website performance. In this intermediate-level webinar, we will show you how these services can also be used to provide health checks and load balancing. This session will detail design patterns for using these three services together and in different combinations to achieve better website performance and security. A couple other design patterns discussed are the use of S3 for static web site hosting and two tiered applications that avoid use of web or application servers.

Published in: Technology, Business
2 Comments
14 Likes
Statistics
Notes
No Downloads
Views
Total views
3,866
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
0
Comments
2
Likes
14
Embeds 0
No embeds

No notes for slide
  • 10sec
  • An once more to finalize the connection
    request content.

    and recieve the the first volley of TCP segments

  • We can persist connections between edge and origin, and save a long-haul connection setup for your viewers
  • Read slide, talk about how awesome the marketplace is to find the kind of tools you need to help you scale.

    1. Boundary
    One-second app visualization, cloud-compatible, and only a few minutes from setup to results
    By monitoring every packet that flows from server to server instance and analyzing them in seconds, Boundary alerts users to developing problems in seconds not minutes. No matter what computing environment you operate—including Amazon Ec2, private and hybrid cloud infrastructures—Boundary gives you real time visibility not obtainable from traditional monitoring tools. Boundary lets you innovate more, move faster and embrace new technologies without fear.

    2. About Sumo Logic Inc.
    Sumo Logic Log Management and Analytics enables enterprises to collect, manage, and analyze log data in order to improve their application and infrastructure management and monitoring. Sumo Logic collects any log data in real-time and enables our customers to perform analytics such as application troubleshooting and root cause analysis, application monitoring, IT infrastructure monitoring and troubleshooting, and application analytics. Sumo Logic service removes the overhead of installing and upgrading software, managing and scaling hardware and storage.

    3. New Relic is the all-in-one web application performance tool that lets you see performance from the end user experience, through servers, and down to the line of application code. It lets you monitor PHP, Python, Ruby, Java, Node.js, and .NET applications in production, troubleshoot potential performance issues proactively, and tune apps for optimal long-term performance. New Relic is used by thousands of organizations worldwide to ensure superior service delivery for their critical web apps. With its easy installation, intuitive user interface, and robust features




  • Speeding up delivery of web content using Amazon Route 53, Elastic Load Balancer and CloudFront

    1. 1. © 2011 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. Speed up Delivery of Web Content Tom Laszewski Strategic Solution Architect 1
    2. 2. © 2011 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. Caching at every tier Route 53 Elastic Load Balancer S3 for static web sites Two tiered application Resources Agenda 2
    3. 3. © 2011 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. The Latest CloudFront • Device Detection, Geo Targeting, Multi-site hosting, and Cross Origin Resource Sharing (CORS) Support • CloudTrail support • Custom SSL certificates with Amazon CloudFront with Server Name Indication (SNI) Custom SSL • Microsoft Smooth Streaming ELB • Access Logs • Connection draining • Perfect forward security Route 53 • String matching and HTTPS health checks • Fast interval health checks and configurable failover thresholds • Domain name base health checks
    4. 4. © 2011 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. Design pattern #1: Cache at every tier
    5. 5. © 2011 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. Content Breakdown 87% of Your Site Consists Of Static/Re-usable Content
    6. 6. © 2011 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. Browser Cache Edge Cache Web Cache Application Cache Database Cache Image Source: cakeormistake.wordpress.com
    7. 7. © 2011 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. 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.)
    8. 8. © 2011 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. Time to First Byte 68 ms 68 ms 68 ms Client Server 136 ms SYN SYN/ACK ACK, GET /image.jpg HTTP/1.1
    9. 9. © 2011 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. Bring the Bytes Closer to Your Users 68 ms Client Origin SYN 10 ms SYN/ACK GET /image.jpg HTTP/1.1ACK, GET /image.jpg HTTP/1.1 CloudFront Saves 68 ms RTT SYN SYN/ACK Time to first byte: 20 ms vs. 136 ms
    10. 10. © 2011 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. Edge Cache: Amazon CloudFront Amazon S3 Elastic Load Balancing Mobile Clients Browsers/Desktop Clients Tablets/Devices Amazon CloudFront Edge Location
    11. 11. © 2011 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. 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
    12. 12. © 2011 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 Customized Content Customized Content
    13. 13. © 2011 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. Content with Query Strings Reusable? 110 /factor/create_image?name=book1&size=10x10
    14. 14. © 2011 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. Content with Query Strings • CloudFront can cache content with query strings • Every unique query string combination is a new object in CloudFront’s cache
    15. 15. © 2011 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. Dynamic Content? Zero TTL – cannot be cached! CloudFront can still help…
    16. 16. © 2011 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. A simple help "Hi, I’d like to hear a TCP joke." "Hello, would you like to hear a TCP joke?" "Yes, I’d like to hear a TCP joke." "OK, I’ll tell you a TCP joke." "Ok, I will hear a TCP joke." "Are you ready to hear a TCP joke?" "Yes, I am ready to hear a TCP joke." "Ok, I am about to send the TCP joke. It will last 10 seconds, it has two characters, it does not have a setting, it ends with a punchline." "Ok, I am ready to get your TCP joke that will last 10 seconds, has two characters, does not have an explicit setting, and ends with a punchline." "I’m sorry, your connection has timed out. Hello, would you like to hear a TCP joke?"
    17. 17. © 2011 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. 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!
    18. 18. © 2011 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. PUT/POST Optimization Test Oregon Virginia Upload Uploading 10 MB data from an instance in US East region to US West region Avg. result: 5sec
    19. 19. © 2011 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. PUT/POST Optimization Test Oregon Virginia Upload U p load Uploading 10MB data from an instance in US East region to the closest CloudFront location Avg. result: 3.5sec CloudFront
    20. 20. © 2011 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. 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.
    21. 21. © 2011 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. 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
    22. 22. © 2011 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. Web Cache Popular solutions: • Varnish • Nginx • Apache with mod_cache/mod_proxy • Squid • Perlbal • Language/framework caches (i.e., APC, Zend)
    23. 23. © 2011 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. 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.
    24. 24. © 2011 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. Application Cache Application level caches for information such as session data, temporary application data such as cart information, and live aggregation of data feeds.
    25. 25. © 2011 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. Application Cache Availability Zone VPC Subnet VPC SubnetVPC Subnet Elastic Load Balancing Cache Instances Web/App Instances Elastic Load Balancing ElastiCache Cache Node Availability Zone VPC Subnet VPC SubnetVPC Subnet Elastic Load Balancing Cache Instances Web/App Instances Elastic Load Balancing ElastiCache Cache Node Internet Gateway
    26. 26. © 2011 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. Application Cache Popular solutions: • Memcached • Redis • Cassandra • Amazon DynamoDB
    27. 27. © 2011 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. Application Cache Use Cases: • Session information • Temporary data • Cart info, metadata • Counters • Views, Scores, Leader Boards
    28. 28. © 2011 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. 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).
    29. 29. © 2011 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. Database Cache Availability Zone VPC Subnet VPC SubnetVPC Subnet Elastic Load Balancing Cache Instances Web/App Instances Elastic Load Balancing ElastiCache Cache Node Availability Zone VPC Subnet VPC SubnetVPC 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)
    30. 30. © 2011 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. 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
    31. 31. © 2011 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. 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; } }
    32. 32. © 2011 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. 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
    33. 33. © 2011 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. Design pattern #2: latency-based load balancing
    34. 34. © 2011 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. How it Works 34 Users DNS Resolver Route 53 Where is www.example.com? I don’t know – I’ll ask the authority 1.2.3.4 1.2.3.4 53
    35. 35. © 2011 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. Route 53’s Key Features 35 High Availability DNS • Highly available and scalable DNS service. • Map the root or apex of your hosted zone to your Elastic Load Balancer and S3 • Run applications in multiple AWS regions and route users to the one that provides the lowest latency. • Specify the frequency with which different responses are served. Alias Records Weighted Round Robin Latency Based Routing
    36. 36. © 2011 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. Failover Only return answers for resources that are healthy and reachable from the outside world, so that your end users are routed away from a failed or unhealthy part of your application Health checks Automated requests sent over the Internet to your application to verify that your application is reachable, available, and functional + DNS Failover
    37. 37. © 2011 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. Latency Based Routing (LBR) 37 Run multiple stacks of your application in different EC2 regions around the world Create LBR records using the Route 53 API or Console • Tag each destination end-point to the EC2 region that it’s in • End-points can either be EC2 instances, Elastic IPs or ELBs Route 53 will route end users to the end-point that provides the lowest latency
    38. 38. © 2011 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. LBR Benefits 38 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
    39. 39. © 2011 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. amdocstore.com some-elb-name.us-west- 2.elb.amazonaws.com Name Type Value amdocstore.com ALIAS some-elb-name.us- west- 2.elb.amazonaws.co m amdocstore.com ALIAS some-elb-name.ap- southeast- 2.elb.amazonaws.co msome-elb-name.ap-southeast- 2.elb.amazonaws.com User
    40. 40. © 2011 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. Design pattern #3: Elastic Load Balancer
    41. 41. © 2011 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. Amazon Elastic Load Balancer Scalability: Stable DNS host name resolves via round robin to ELB IP addresses in each Availability Zone. Web Servers Web Servers A B some-elb- name.us-west- 2.elb.amazonaw s.com 123.234.123.234 123.234.123.235
    42. 42. © 2011 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. Amazon Elastic Load Balancer Scalability: As traffic increases, AWS adds IP addresses to ELB’s DNS entry Web Servers Web Servers A B some-elb- name.us-west- 2.elb.amazonaw s.com 123.234.123.234 123.234.123.235 123.234.123.237 123.234.123.236
    43. 43. © 2011 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. Amazon Elastic Load Balancer Scalability: As traffic decreases, AWS automatically removes IP address from the ELB’s DNS entry Web Servers Web Servers A B some-elb- name.us-west- 2.elb.amazonaw s.com 123.234.123.234 123.234.123.237
    44. 44. © 2011 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. Design pattern #4: S3 Static Web Site Hosting
    45. 45. © 2011 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. Website hosting using Amazon S3 • Static Sites with client-side scripts Setting default documents Redirecting requests
    46. 46. © 2011 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. Website bucket name: www.aws-examples.info bucket Record set for: aws-examples.info CNAME for www. to: www.aws-examples.info.s3- website-eu-west- 1.amazonaws.com Website bucket name: aws-examples.info bucket Error. html Index .html A Record ‘Alias’ to Amazon S3 website: aws-examples.info @ s3-website- eu-west-1.amazonaws.com R53 Website redirect to: aws-examples.info Amazon S3 and Route53
    47. 47. © 2011 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. Design pattern #5: Two tiered application
    48. 48. © 2011 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. Access AWS services from the browser Make direct calls to AWS services such as SQS, S3, and DynamoDB directly from the user’s browser. Authentication is based on STS tokens. Supports S3, SQS, SNS and DynamoDB.
    49. 49. © 2011 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. Example: Send messages from the browser Back to our sample architecture: • Browser authenticates against Elastic Beanstalk application • Response includes location of SQS Queue and STS Token for direct authentication. EMR Cluster Redshift Database S3 PUTSendMessage ReceiveMessage S3 Bucket Elastic Beanstalk Application GetToken
    50. 50. © 2011 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. 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
    51. 51. © 2011 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. 51 Getting Started aws.amazon.com/route53, aws.amazon.com/cloudfront, aws.amazon.com/elb, aws.amazon.com/s3 ElastiCache : http://www.youtube.com/watch?v=odMmdPBV8hM Scale your application : http://www.youtube.com/watch?v=6EKKKtdoRcA Scaling web site to 10 million + users: http://www.youtube.com/watch?v=RfAidKJ6KE8 Route53 and ELB : http://www.youtube.com/watch?v=l5HSED9FiPI tomlasz@amazon.com

    ×