Scaling on AWS for the First 10 Million Users
• ME: Chris Munns – Solutions Architect – Amazon Web
Services – munns@amazon...
So how do we scale?
a lot of things to read
not where we want to start
a lot of things to read
Auto-Scaling is a tool and a
destination. It’s not the
single thing that fixes
everything.
What do we need first?
Some basics:
US-WEST (Oregon)
EU-WEST (Ireland)
ASIA PAC (Tokyo)
US-WEST (N. California)
SOUTH AMERICA (Sao Paulo)
US-EAST (Virginia)
A...
US-WEST (Oregon)
EU-WEST (Ireland)
ASIA PAC (Tokyo)
US-WEST (N. California)
SOUTH AMERICA (Sao Paulo)
US-EAST (Virginia)
A...
• $5.2B retail business
• 7,800 employees
• A whole lot of servers
Every day, AWS adds enough
server capacity to power tha...
Compute Storage
AWS Global Infrastructure
Database
App Services
Deployment & Administration
Networking
Compute Storage
AWS Global Infrastructure
Database
App Services
Deployment & Administration
Networking
Amazon
CloudWatch A...
So let’s start from day
one, user one ( you ):
Day One, User One:
• A single EC2 Instance
– With full stack on this host
• Web App
• Database
• Management
• Etc.
• A sin...
“We’re gonna need a bigger box”
• Simplest approach
• Can now leverage PIOPs
• High I/O instances
• High memory instances
...
Day One, User One:
• We could potentially get
to a few hundred to a few
thousand depending on
application complexity
and t...
Day Two, User >1:
First let’s separate out
our single host into
more than one.
• Web
• Database
– Make use of a database
s...
Self-Managed Fully-Managed
Database Server
on Amazon EC2
Your choice of
database running on
Amazon EC2
BringYour Own
Licen...
But how do I choose
what DB technology I
need? SQL? NoSQL?
Some folks won’t like
this. But…
Start with SQL
databases
But, but, but, but…
No.You don’t.
Start with SQL
databases
Why start with SQL?
• Established and well worn technology
• Lots of existing code, communities, books,
background, tools,...
AH HA! You said “massive
amounts”, I will have
massive amounts!
If your usage is such that you
will be generating several TB
( >5 ) of data in the first year
OR have an incredibly data
i...
But this is probably
less than 90% of you
User >100:
First let’s separate out
our single host into
more than one.
• Web
• Database
– Use RDS to make your life
easie...
User > 1000:
Next let’s address our
lack of failover and
redundancy issues:
• Elastic Load Balancer
• Another Web Instance...
• Create highly scalable applications
• Distribute load across EC2 instances
in multiple availability zones
Feature Detail...
Scaling this horizontally
and vertically will get
us pretty far
( 10s-100s of thousands )
User >10ks-100ks:
RDS DB Instance
Active (Multi-AZ)
Availability Zone Availability Zone
RDS DB Instance
Standby (Multi-AZ)...
This will take us pretty far
honestly, but we care about
performance and efficiency,
so let’s clean this up a bit
Shift some load around:
Let’s lighten the load on
our web and database
instances:
• Move static content from the
Web Insta...
Working with S3 - Amazon Simple Storage Service
• Object based storage for the web
• 11 9s of durability
• Good for things...
DynamoDB
• Provisioned throughput NoSQL
database
• Fast, predictable performance
• Fully distributed, fault tolerant
archi...
ElastiCache
• Hosted Memcached
– Speaks same API as traditional open source
memcached
• Scale from one to many nodes
• Sel...
Now that our Web tier is
much more lightweight, we
can revisit the beginning of
our talk…
Auto-Scaling!
Automatic resizing of compute
clusters based on demand
Trigger auto-scaling
policy
Feature Details
Control Define minimum ...
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Typical weekly traffic to Amazon.com
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Typical weekly traffic to Amazon.com
Provisioned capacity
November traffic to Amazon.com
November
November traffic to Amazon.com
Provisioned capacity
November
November traffic to Amazon.com
76%
24%
Provisioned capacity
November
November traffic to Amazon.com
November
Auto-Scaling lets you do this!
There’s further
improvements to be made
in breaking apart our
web/app layer more
SOA = Service Oriented Architecture
SOA’ing
Move services into their own
tiers/modules.Treat each of
these as 100% whole-y separate
pieces of your infrastruct...
Loose coupling sets you free!
• The looser they're coupled, the bigger they scale
– Independent components
– Design everyt...
Loose coupling + SOA = winning
Examples:
• Email
• Queuing
• Transcoding
• Search
• Databases
• Monitoring
• Metrics
• Log...
On re-inventing the wheel: If
you find yourself writing
your own: queue, DNS
server, database, storage
system, monitoring ...
Take a deep breath and stop
it. Now.
Back to SOA
Imagine we let our users
upload photos
S3 Bucket
For Ingest
User
SNS Topic
RRS S3
Bucket to
Serve
content to
CloudFront
S3 Bucket
For
originals
CloudFront
Downlo...
User >1mil+:
Reaching a million and above is going to require some bit
of all the previous things:
• Multi-AZ
• Elastic Lo...
User >1mil+:
RDS DB Instance
Active (Multi-AZ)
Availability Zone
Elastic Load
Balancer
RDS DB Instance
Read Replica
RDS DB...
The next big steps
User >5mil – 10mil:
You’ll potentially start to run into issues with your
database around contention on the write master.
...
Database Federation
• Split up Databases by
function/purpose
• Harder to do cross function
queries
• Essentially delaying ...
Sharded Horizontal Scaling
• More complex at the
application layer
• ORM support can help
• No practical limit on
scalabil...
User >5mil – 10mil:
You’ll potentially start to run into issues with speed and
performance of your applications.
• Make su...
HOST
LEVEL
METRICS
AGGREGATE
LEVEL
METRICS
LOG
ANALYSIS
EXTERNAL
SITE
PERFORMANCE
Not having proper
monitoring/metrics is like
flying a plane with an eye
mask on in a thunderstorm.
Oh and your wing is on ...
AWS Marketplace & Partners Can Help
• Customer can find, research,
buy software
• Simple pricing, aligns with EC2
usage mo...
User >5mil – 10mil:
Managing your infrastructure will become an ever
increasing important part of your time. Use tools to
...
AWS Application Management Solutions
Elastic Beanstalk OpsWorks CloudFormation EC2
Convenience Control
Higher-level Servic...
Host Based Configuration Management
Two big players:
– Opscode Chef
– PuppetLabs Puppet
• Both do more or less the same th...
A Quick Review:
• Multi-AZ your infrastructure
• Make use of self scaling services ( ELB, S3, SNS, SQS, SWF,
SES, etc )
• Build in redunda...
Putting all this together
means we should now
easily be able to handle
10+ million users!
To infinity…..
User >10mil:
A lot of what we covered today will
get you potentially into the high
10s of millions. Iterating on top of
th...
User >10mil:
• More fine tuning of your application
• More SOA of features/functionality
• Going from Multi-AZ to Multi-Re...
Next steps?
READ! –
• aws.amazon.com/documentation
• aws.amazon.com/architecture
• aws.amazon.com/start-ups
Next steps?
START USING AWS –
aws.amazon.com/free/
Next steps?
ASK FOR HELP!
• forums.aws.amazon.com
• aws.amazon.com/support
• Your local account manager
THANKS F0R LISTENING!
Chris Munns - munns@amazon.com
Aws webcast - Scaling on AWS 13 08-20
Aws webcast - Scaling on AWS 13 08-20
Aws webcast - Scaling on AWS 13 08-20
Upcoming SlideShare
Loading in...5
×

Aws webcast - Scaling on AWS 13 08-20

2,435

Published on

Learn about the patterns and techniques a business should be using in building their infrastructure on Amazon Web Services to be able to handle rapid growth and success in the early days. From leveraging highly scalable AWS services, to architecting best patterns, there are a number of smart choices you can make early on to help you overcome some typical infrastructure issues.

Presenter: Chris Munns,Solutions Architect, Amazon Web Services

Published in: Technology, Business
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,435
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
80
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Aws webcast - Scaling on AWS 13 08-20

  1. 1. Scaling on AWS for the First 10 Million Users • ME: Chris Munns – Solutions Architect – Amazon Web Services – munns@amazon.com • YOU: Here to learn more about scaling infrastructure on AWS • TODAY: about best practices and things to think about when building for large scale
  2. 2. So how do we scale?
  3. 3. a lot of things to read
  4. 4. not where we want to start a lot of things to read
  5. 5. Auto-Scaling is a tool and a destination. It’s not the single thing that fixes everything.
  6. 6. What do we need first?
  7. 7. Some basics:
  8. 8. US-WEST (Oregon) EU-WEST (Ireland) ASIA PAC (Tokyo) US-WEST (N. California) SOUTH AMERICA (Sao Paulo) US-EAST (Virginia) AWS GovCloud (US) ASIA PAC (Sydney) Regions ASIA PAC (Singapore)
  9. 9. US-WEST (Oregon) EU-WEST (Ireland) ASIA PAC (Tokyo) US-WEST (N. California) SOUTH AMERICA (Sao Paulo) US-EAST (Virginia) AWS GovCloud (US) ASIA PAC (Sydney) Availability Zones ASIA PAC (Singapore)
  10. 10. • $5.2B retail business • 7,800 employees • A whole lot of servers Every day, AWS adds enough server capacity to power that whole $5B enterprise
  11. 11. Compute Storage AWS Global Infrastructure Database App Services Deployment & Administration Networking
  12. 12. Compute Storage AWS Global Infrastructure Database App Services Deployment & Administration Networking Amazon CloudWatch AWS IAM AWS CloudFormation Amazon Elastic Beanstalk AWS Data Pipeline AWS OpsWorks Amazon CloudSearch Amazon SQSAmazon SNS Amazon Elastic Transcoder Amazon SWF Amazon SES Amazon DynamoDB Amazon RDS Amazon ElastiCache Amazon RedShift AWS Storage Gateway Amazon S3 Amazon Glacier Amazon CloudFrontAmazon EC2 Amazon EMR Amazon VPC Amazon Route 53 AWS Direct Connect
  13. 13. So let’s start from day one, user one ( you ):
  14. 14. Day One, User One: • A single EC2 Instance – With full stack on this host • Web App • Database • Management • Etc. • A single Elastic IP • Route53 for DNS EC2 Instance Elastic IP Amazon Route 53 User
  15. 15. “We’re gonna need a bigger box” • Simplest approach • Can now leverage PIOPs • High I/O instances • High memory instances • High CPU instances • High storage instances • Easy to change instance sizes • Will hit an endpoint eventually hi1.4xlarge m2.4xlarge m1.small
  16. 16. Day One, User One: • We could potentially get to a few hundred to a few thousand depending on application complexity and traffic • No failover • No redundancy • Too many eggs in one basket EC2 Instance Elastic IP Amazon Route 53 User
  17. 17. Day Two, User >1: First let’s separate out our single host into more than one. • Web • Database – Make use of a database service? Web Instance Database Instance Elastic IP Amazon Route 53 User
  18. 18. Self-Managed Fully-Managed Database Server on Amazon EC2 Your choice of database running on Amazon EC2 BringYour Own License (BYOL) Amazon DynamoDB Managed NoSQL database service using SSD storage Seamless scalability Zero administration Amazon RDS Microsoft SQL, Oracle or MySQL as a managed service Flexible licensing BYOL or License Included Amazon Redshift Massively parallel, petabyte-scale, data warehouse service Fast, powerful and easy to scale Database Options
  19. 19. But how do I choose what DB technology I need? SQL? NoSQL?
  20. 20. Some folks won’t like this. But…
  21. 21. Start with SQL databases
  22. 22. But, but, but, but…
  23. 23. No.You don’t.
  24. 24. Start with SQL databases
  25. 25. Why start with SQL? • Established and well worn technology • Lots of existing code, communities, books, background, tools, etc • You aren’t going to break SQL DBs in your first 10 million users. No really, you won’t* • Clear patterns to scalability *Unless you are doing something SUPER weird with the data or MASSIVE amounts of it, even then SQL will have a place in your stack
  26. 26. AH HA! You said “massive amounts”, I will have massive amounts!
  27. 27. If your usage is such that you will be generating several TB ( >5 ) of data in the first year OR have an incredibly data intensive workload you might need NoSQL
  28. 28. But this is probably less than 90% of you
  29. 29. User >100: First let’s separate out our single host into more than one. • Web • Database – Use RDS to make your life easier Web Instance Elastic IP RDS DB Instance Amazon Route 53 User
  30. 30. User > 1000: Next let’s address our lack of failover and redundancy issues: • Elastic Load Balancer • Another Web Instance – In another Availability Zone • Enable RDS Multi-AZ Web Instance RDS DB Instance Active (Multi-AZ) Availability Zone Availability Zone Web Instance RDS DB Instance Standby (Multi-AZ) Elastic Load Balancer Amazon Route 53 User
  31. 31. • Create highly scalable applications • Distribute load across EC2 instances in multiple availability zones Feature Details Available Load balance across instances in multiple Availability Zones Health checks Automatically checks health of instances and takes them in or out of service Session stickiness Route requests to the same instance Secure sockets layer Supports SSL offload from web and application servers with flexible cipher support Monitoring Publishes metrics to CloudWatch Elastic Load Balancer Elastic Load Balancing
  32. 32. Scaling this horizontally and vertically will get us pretty far ( 10s-100s of thousands )
  33. 33. User >10ks-100ks: RDS DB Instance Active (Multi-AZ) Availability Zone Availability Zone RDS DB Instance Standby (Multi-AZ) Elastic Load Balancer RDS DB Instance Read Replica RDS DB Instance Read Replica RDS DB Instance Read Replica RDS DB Instance Read Replica Web Instance Web Instance Web Instance Web Instance Web Instance Web Instance Web Instance Web Instance Amazon Route 53 User
  34. 34. This will take us pretty far honestly, but we care about performance and efficiency, so let’s clean this up a bit
  35. 35. Shift some load around: Let’s lighten the load on our web and database instances: • Move static content from the Web Instance to S3 and CloudFront • Move session/state and DB caching to ElastiCache or DynamoDB Web Instance RDS DB Instance Active (Multi-AZ) Availability Zone Elastic Load Balancer Amazon S3 Amazon Cloudfront Amazon Route 53 User ElastiCache DynamoDB
  36. 36. Working with S3 - Amazon Simple Storage Service • Object based storage for the web • 11 9s of durability • Good for things like: – Static assets ( css, js, images, videos ) – Backups – Logs – Ingest of files for processing • “Infinitely scalable” • Supports fine grained permission control • Ties in well with CloudFront • Ties in with EMR • Acts as a logging endpoint for S3/CloudFront/Billing • Supports Encryption at transit and at rest • Reduced Redundancy 1/3 cheaper • Glacier for super long term storage
  37. 37. DynamoDB • Provisioned throughput NoSQL database • Fast, predictable performance • Fully distributed, fault tolerant architecture • Considerations for non-uniform data Feature Details Provisioned throughput Dial up or down provisioned read/write capacity. Predictable performance Average single digit millisecond latencies from SSD-backed infrastructure. Strong consistency Be sure you are reading the most up to date values. Fault tolerant Data replicated across Availability Zones. Monitoring Integrated to CloudWatch. Secure Integrates with AWS Identity and Access Management (IAM). Elastic MapReduce Integrates with Elastic MapReduce for complex analytics on large datasets.
  38. 38. ElastiCache • Hosted Memcached – Speaks same API as traditional open source memcached • Scale from one to many nodes • Self healing ( replaces dead instance ) • Very fast ( single digit ms speeds usually (or less) ) • Local to a single AZ – So need to run different clusters across different Azs • Data is only in memory, so not persistent • Use AWS’s Auto Discovery client to simplify clusters growing and shrinking without affecting your application
  39. 39. Now that our Web tier is much more lightweight, we can revisit the beginning of our talk…
  40. 40. Auto-Scaling!
  41. 41. Automatic resizing of compute clusters based on demand Trigger auto-scaling policy Feature Details Control Define minimum and maximum instance pool sizes and when scaling and cool down occurs. Integrated to Amazon CloudWatch Use metrics gathered by CloudWatch to drive scaling. Instance types Run Auto Scaling for On-Demand and Spot Instances. Compatible with VPC. as-create-auto-scaling-group MyGroup --launch-configuration MyConfig --availability-zones us-east-1a --min-size 4 --max-size 200 Auto-Scaling Amazon CloudWatch
  42. 42. Sunday Monday Tuesday Wednesday Thursday Friday Saturday Typical weekly traffic to Amazon.com
  43. 43. Sunday Monday Tuesday Wednesday Thursday Friday Saturday Typical weekly traffic to Amazon.com Provisioned capacity
  44. 44. November traffic to Amazon.com November
  45. 45. November traffic to Amazon.com Provisioned capacity November
  46. 46. November traffic to Amazon.com 76% 24% Provisioned capacity November
  47. 47. November traffic to Amazon.com November
  48. 48. Auto-Scaling lets you do this!
  49. 49. There’s further improvements to be made in breaking apart our web/app layer more
  50. 50. SOA = Service Oriented Architecture
  51. 51. SOA’ing Move services into their own tiers/modules.Treat each of these as 100% whole-y separate pieces of your infrastructure and scale them independently. Amazon.com and AWS do this extensively! It offers flexibility and greater understanding of each component.
  52. 52. Loose coupling sets you free! • The looser they're coupled, the bigger they scale – Independent components – Design everything as a black box – Decouple interactions – Favor services with built in redundancy and scalability than building your own Controller A Controller B Controller A Controller B Q Q Tight Coupling Use Amazon SQS as Buffers Loose Coupling
  53. 53. Loose coupling + SOA = winning Examples: • Email • Queuing • Transcoding • Search • Databases • Monitoring • Metrics • Logging Amazon CloudSearch Amazon SQSAmazon SNS Amazon Elastic Transcoder Amazon SWF Amazon SES In the early days, if someone has a service for it already, opt to use that instead of building it yourself. DON’T REINVENT THE WHEEL
  54. 54. On re-inventing the wheel: If you find yourself writing your own: queue, DNS server, database, storage system, monitoring tool
  55. 55. Take a deep breath and stop it. Now.
  56. 56. Back to SOA
  57. 57. Imagine we let our users upload photos
  58. 58. S3 Bucket For Ingest User SNS Topic RRS S3 Bucket to Serve content to CloudFront S3 Bucket For originals CloudFront Download Distribution SQS Queue Size for Thumbnail SQS Queue Size Image for Mobile SQS Queue Size Image for Web Auto scaling Group Instances Auto scaling Group Instances Auto scaling Group Instances
  59. 59. User >1mil+: Reaching a million and above is going to require some bit of all the previous things: • Multi-AZ • Elastic Load Balancer between tiers • Auto-Scaling • Service oriented architecture • Serving content smartly ( S3/CloudFront ) • Caching off DB • Moving state off tiers that auto-scale
  60. 60. User >1mil+: RDS DB Instance Active (Multi-AZ) Availability Zone Elastic Load Balancer RDS DB Instance Read Replica RDS DB Instance Read Replica Web Instance Web Instance Web Instance Web Instance Amazon Route 53 User Amazon S3 Amazon Cloudfront DynamoDB Amazon SQS ElastiCache Worker Instance Worker Instance Amazon CloudWatch Internal App Instance Internal App Instance Amazon SES
  61. 61. The next big steps
  62. 62. User >5mil – 10mil: You’ll potentially start to run into issues with your database around contention on the write master. How can you solve it? • Federation ( splitting into multiple DBs based on function) • Sharding ( splitting one data set up across multiple hosts) • Moving some functionality to other types of DBs ( NoSQL )
  63. 63. Database Federation • Split up Databases by function/purpose • Harder to do cross function queries • Essentially delaying the need for something like sharding/NoSQL until much further down the line • Won’t help with single huge functions/tables ForumsDB UsersDB ProductsDB
  64. 64. Sharded Horizontal Scaling • More complex at the application layer • ORM support can help • No practical limit on scalability • Operation complexity/sophistication • Shard by function or key space • RDBMS or NoSQL User ShardID 002345 A 002346 B 002347 C 002348 B 002349 A A B C
  65. 65. User >5mil – 10mil: You’ll potentially start to run into issues with speed and performance of your applications. • Make sure you have monitoring/metrics/logging in place – If you can’t build it internally, outsource it! ( 3rd party SaaS ) • Pay attention to what customers are saying works well vs. what doesn’t • Try to work on squeezing as much performance out of each service/component
  66. 66. HOST LEVEL METRICS AGGREGATE LEVEL METRICS LOG ANALYSIS EXTERNAL SITE PERFORMANCE
  67. 67. Not having proper monitoring/metrics is like flying a plane with an eye mask on in a thunderstorm. Oh and your wing is on fire.
  68. 68. AWS Marketplace & Partners Can Help • Customer can find, research, buy software • Simple pricing, aligns with EC2 usage model • Launch in minutes • Marketplace billing integrated into your AWS account • 700+ products across 20+ categories Learn more at: aws.amazon.com/marketplace
  69. 69. User >5mil – 10mil: Managing your infrastructure will become an ever increasing important part of your time. Use tools to automate repetitive tasks. • Tools to manage AWS resources • Tools to manage software and configuration on your instances • Automated data analysis of logs and user actions
  70. 70. AWS Application Management Solutions Elastic Beanstalk OpsWorks CloudFormation EC2 Convenience Control Higher-level Services Do it yourself
  71. 71. Host Based Configuration Management Two big players: – Opscode Chef – PuppetLabs Puppet • Both do more or less the same thing • Both have syntax that isn’t too dissimilar • Use HBCM along side one of the tools from the previous slide • Spend the time required to learn them • Can’t scale easily without HBCM
  72. 72. A Quick Review:
  73. 73. • Multi-AZ your infrastructure • Make use of self scaling services ( ELB, S3, SNS, SQS, SWF, SES, etc ) • Build in redundancy at every level. • Start SQL. Seriously. • Move to NoSQL if it really makes sense • Leverage managed/low touch services • Split tiers into individual services ( SOA ) • Use Auto-scaling once you’re ready to • Use automation tools in your infrastructure • Make sure you have good metrics/monitoring/logging tools in place • Don’t reinvent the wheel
  74. 74. Putting all this together means we should now easily be able to handle 10+ million users!
  75. 75. To infinity…..
  76. 76. User >10mil: A lot of what we covered today will get you potentially into the high 10s of millions. Iterating on top of the patterns seen here will get you up and over 100 million users.
  77. 77. User >10mil: • More fine tuning of your application • More SOA of features/functionality • Going from Multi-AZ to Multi-Region • Needing to start potentially building custom solutions • Deep analysis of your whole stack
  78. 78. Next steps? READ! – • aws.amazon.com/documentation • aws.amazon.com/architecture • aws.amazon.com/start-ups
  79. 79. Next steps? START USING AWS – aws.amazon.com/free/
  80. 80. Next steps? ASK FOR HELP! • forums.aws.amazon.com • aws.amazon.com/support • Your local account manager
  81. 81. THANKS F0R LISTENING! Chris Munns - munns@amazon.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×