Upgrade to Pro — share decks privately, control downloads, hide ads and more …

High Performance Web Applications

39488f9d172ab92fd352f2cd7b73258d?s=47 Matt Wood
October 29, 2012

High Performance Web Applications

Building high performance web applications on AWS.

39488f9d172ab92fd352f2cd7b73258d?s=128

Matt Wood

October 29, 2012
Tweet

Transcript

  1. High Performance Web Applications matthew@amazon.com Dr. Matt Wood @mza

  2. Hello

  3. Building blocks for wonderful applications Storage, compute, databases, managed services

  4. None
  5. Retail Merchant services Web services

  6. Retail Merchant services Web services

  7. Getting started with Amazon Web Services quick review H

  8. Utility computing Available at the end of an API call.

    Metered billing. H
  9. Family of 20 services Adding new services and refinement weekly.

    Rapid rate of innovation. H
  10. Undi!erentiated heavy lifting Focus on your app, customers and business

    H
  11. H

  12. aws.amazon.com H Free account. Free tier.

  13. Building High Performance Web Applications r

  14. Deliver a great experience to your customers. Responsive, fast web

    applications. r
  15. g DECOUPLED SCALE OUT S OPTIMIZE COST FOR C AUTOMATE

    v CALIBRATED FOR: CPU performance v CALIBRATED FOR: IO performance 5patterns for performance
  16. g DECOUPLED

  17. Monolithic Mega System v2

  18. Application Assets Analytics

  19. Application Assets Analytics

  20. Images, javascript, stylesheets, HTML pages Deliver as fast as possible

    to customers r
  21. Websites without the servers Highly durable: 99.999999999% Zero config: fire

    and forget r
  22. None
  23. Low latency delivery of assets Local caching for fast downloads

    Amazon CloudFront r
  24. P P

  25. Create content distributions From objects in S3 Any custom origin

    Dynamic, streaming and static content r
  26. P P P

  27. CNAME? Map to any custom URL assets.domain.com, www.domain.com r

  28. Application Assets Analytics

  29. Application Assets Analytics

  30. Application architecture Small things, loosely coupled r

  31. Application Assets Analytics

  32. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  33. Shared responsibility Infrastructure by AWS OS, application and data by

    customers Tools to help meet best practices r
  34. Security groups Customer controlled firewalls All ports are closed by

    default r
  35. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  36. Load balancer App servers Database Asynchronous processing Application Assets Analytics

    x
  37. Decoupling provides an architectural framework for performance Easier to separate

    concerns: assets, streaming, etc. Easier to manage and scale. r
  38. SCALE OUT

  39. Elasticity is a tenet of the cloud Scale up when

    you need to Scale down when you don’t r
  40. Predictable peaks r Time Demand Capacity

  41. Predictable peaks r Time Demand Capacity

  42. Variable usage r Time Demand Capacity

  43. Variable usage r Time Demand Capacity

  44. Variable usage r Time Demand

  45. Horizontal scaling drives performance up ...and costs down r

  46. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  47. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  48. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  49. Amazon Machine Images encapsulate your app Customize your virtual machines

    AMI can be the unit of deployment r
  50. 1. Spin up a new instance using your AMI Configured

    to bootstrap the app. r
  51. 2. Pull down latest code base From S3 or code

    repository r
  52. 3. Start up the app on the instance Ready to

    receive requests r
  53. 4. Register with the load balancer Job done. r

  54. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  55. Horizontal scaling allows for fault tolerance r

  56. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  57. Load balancer App servers Database Asynchronous processing :( Application Assets

    Analytics
  58. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  59. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  60. Deploying and scaling a datastore r Follow the same patterns:

    horizontal scale, availability, automation.
  61. One question: r Does your application require a strict, controlled

    schema for query flexibility?
  62. Amazon Relational Database Service r Management systems: CRM, ERP, finance

    Does your application require a strict, controlled schema for query flexibility? Yes
  63. Focus on your app r Handles tedious database admin tasks

    Designed for availability
  64. Multi-engine r MySQL, Oracle, Microsoft SQL Server Up and running

    in six clicks
  65. Point in time snapshots r Automatic. Easy recovery.

  66. High availability r Deployed across multiple availability zones. Synchronous writes.

  67. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  68. Read replicas r Perfect for read heavy applications. Asynchronous writes.

    Replication metrics available.
  69. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  70. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  71. Amazon DynamoDB r Web apps, social apps, mobile apps, user

    generated content, unstructured data integration, lots of data. Does your application require a strict, controlled schema for query flexibility? No
  72. Focus on your app r Managed NoSQL database service. No

    schema.
  73. Unlimited scale r Unlimited storage Pay as you go

  74. High performance r Single digit millisecond latencies

  75. Zero admin r No instances to manage Tiny API, perfectly

    formed
  76. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  77. Asynchronous processing r Resize images. Transcode movies. Resample media.

  78. Follow the same best practices r Decouple. Stateless. Horizontal scale.

  79. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  80. CloudFront for dynamic content r Edge caching for dynamic content

    Cache by query string parameters Multiple origin servers Persistent connections to origin servers
  81. C AUTOMATE

  82. Automate everything The tedious. The time consuming. The error prone.

    r
  83. For example: when increasing capacity Launch instance. Update application code.

    Register with load balancer. r
  84. Auto-scaling CloudWatch Auto-scaling service Elastic Load Balancer r

  85. Set operational thresholds Network capacity > 80% Memory utilization >

    75% CPU < 50% r
  86. Automatically respond to operational alarms r Network capacity > 80%:

    add instances Memory utilization > 75%: add instances CPU < 50%: remove instances
  87. Set bounds Step change configured by number or percentage of

    instances r
  88. Custom metrics Respond to custom metrics Page load time Database

    query time r
  89. Automatic load balancer configuration Instances added/removed automatically Health check for

    running application before routing tra"c r
  90. Stateless operations are important Decoupled, but stateless Instances are naive

    to other instances r
  91. Treat your data as a royal garden Backup to S3:

    high durability Compute is a disposable resource r
  92. v CALIBRATED FOR: CPU performance

  93. Range of resources Choose the best instance type for performance

    r
  94. r t1.micro m1.small cc2.8xlarge

  95. r t1.micro m1.small cc2.8xlarge High memory High CPU High CPU

    + memory
  96. Load balancer App servers Database Asynchronous processing Application Assets Analytics

  97. 1 instance for 100 hours = 100 instances for 1

    hour
  98. Balance cost/performance Mix instance types for application servers, databases, ancillary

    services, analytics etc. r
  99. Migrate to large instance types As your application grows Use

    64 bit from the outset, if possible r
  100. v CALIBRATED FOR: IO performance

  101. IO bound web applications are more common Application requires predictable,

    consistent IO r
  102. Provisioned throughput with DynamoDB No need to provision storage Provision

    IO requirements: reads and writes per second r
  103. None
  104. None
  105. None
  106. None
  107. Scale up, and carry on DynamoDB will manage resources to

    achieve and maintain throughput r
  108. Low latency, unlimited scale Writes acknowledged when saved to disk

    in multiple data centres. Backed on SSDs. r
  109. ...and SSDs for all

  110. hi1.4xlarge instances High capacity, high performance storage 2 x 1Tb

    SSD drives r
  111. Perfect match for databases Relational and NoSQL storage r

  112. Perfect match for databases Relational and NoSQL storage 90k to

    120k IOPS r
  113. High performance network 10 gigabit ethernet Placement groups Perfect for

    distributed stores r
  114. S OPTIMIZE COST FOR

  115. Economies of scale Drive down prices for customers 20 price

    drops in past 6 years r
  116. Maximize utilization Greater utilization drives down cost r

  117. Reserved capacity Time Utilization

  118. Reserved instances Small upfront payment Guaranteed capacity for 1 or

    3 years Lower hourly rate r
  119. Reserved instance resale Sell your reservations on the resale market

    Sellers set your own price Buyers select and check out r
  120. Reserved capacity Time Utilization

  121. Reserved capacity On-demand Time Utilization

  122. Reserved capacity On-demand Time Utilization

  123. Spot instances Name your price computing r

  124. Spot instances Lower costs ‘Overclock’ your app: more bang for

    your buck r
  125. Load balancer App servers Database on SSDs Asynchronous processing Application

    Assets Analytics
  126. Load balancer App servers Database on SSDs Asynchronous processing Application

    Assets Analytics
  127. Load balancer App servers Database on SSDs Asynchronous processing Application

    Assets Analytics
  128. Become price aware Price is a driver of your architecture

    r
  129. Automated bidding Automate bids based on on-demand price Run on

    spot only when cost e!ective r
  130. Continuous cost optimization Evaluate your reserved instance/on-demand/ spot mix regularly

    as app requirements change r
  131. 5patterns for performance g DECOUPLED

  132. 5patterns for performance g DECOUPLED SCALE OUT

  133. 5patterns for performance g DECOUPLED SCALE OUT S OPTIMIZE COST

    FOR
  134. 5patterns for performance g DECOUPLED SCALE OUT S OPTIMIZE COST

    FOR v CALIBRATED FOR: CPU performance v CALIBRATED FOR: IO performance
  135. 5patterns for performance g DECOUPLED SCALE OUT S OPTIMIZE COST

    FOR v CALIBRATED FOR: CPU performance v CALIBRATED FOR: IO performance C AUTOMATE
  136. Thank you aws.amazon.com @mza matthew@amazon.com