scaling on aws to the first 10 million users
TRANSCRIPT
![Page 1: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/1.jpg)
© 2014 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.
Spain Tech Talk
Scaling on AWS for the First 10 Million Users
Matt Auerbach, Associate Solutions Architect
April 24, 2015
![Page 2: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/2.jpg)
Scaling on AWS for the First 10 Million Users
• Me: – Matt Auerbach; [email protected]
• YOU: Here to learn more about scaling infrastructure on AWS
• TODAY: about best practices and things to think about when building for large scale
![Page 3: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/3.jpg)
So how do we scale?
![Page 4: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/4.jpg)
![Page 5: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/5.jpg)
![Page 6: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/6.jpg)
a lot of things to read
![Page 7: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/7.jpg)
a lot of things to read
not where we want to start
![Page 8: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/8.jpg)
us today
![Page 9: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/9.jpg)
What do we need first?
![Page 10: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/10.jpg)
Lets start with the basics…
![Page 11: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/11.jpg)
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)
EU-WEST (Frankfurt)
![Page 12: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/12.jpg)
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)
EU-WEST (Frankfurt)
![Page 13: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/13.jpg)
Edge Locations
![Page 14: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/14.jpg)
• $7B+ retail business
• 8,000+ employees
• A whole lot of servers
Every day, AWS adds enough
server capacity to power that
entire $7B enterprise
2004 2015
![Page 15: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/15.jpg)
Storage & Content Delivery
AWS Global Infrastructure
Database
App Services
Deployment & Management
Compute & Networking
Analytics
![Page 16: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/16.jpg)
Storage & Content Delivery
AWS Global Infrastructure
Database
App Services
Deployment & Management
Compute & Networking
Analytics
Amazon DynamoDB
Amazon RDS
Amazon ElastiCache
AmazonRedShift
AWS Storage Gateway
Amazon S3
AmazonGlacier
Amazon CloudFront
Amazon CloudWatch AWS IAM AWS
CloudFormationAmazon Elastic
BeanstalkAWS
OpsWorksAWS
CloudTrail
Amazon SQS
Amazon Elastic
Transcoder
Amazon SNS
Amazon SES
Amazon CloudSearch
Amazon SWF
Amazon AppStream
AmazonEC2
AmazonVPC
AmazonRoute 53
AWSDirect Connect
AmazonWorkSpaces
AmazonEMR
AmazonKinesis
AWS Data Pipeline
![Page 17: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/17.jpg)
So let’s start from day one, user one (you)
![Page 18: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/18.jpg)
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
![Page 19: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/19.jpg)
“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
c3.8xlarge
m3.2xlarge
t2.micro
![Page 20: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/20.jpg)
“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
c3.8xlarge
m3.2xlarge
t2.micro
![Page 21: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/21.jpg)
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
![Page 22: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/22.jpg)
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
![Page 23: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/23.jpg)
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
DatabaseInstance
Elastic IP
Amazon Route 53
User
![Page 24: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/24.jpg)
Self-Managed Fully-Managed
Database Server on Amazon EC2
Your choice of database running on
Amazon EC2
Bring Your Own License (BYOL)
Amazon DynamoDB
Managed NoSQL database service
using SSD storage
Seamless scalability Zero administration
Amazon RDS
Microsoft SQL, Oracle, MySQL or PostgreSQL as a managed service
Flexible licensingBYOL or License
Included
Amazon Redshift
Massively parallel, petabyte-scale, data warehouse serviceFast, powerful and
easy to scale
Database Options
![Page 25: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/25.jpg)
But how do I choose what DB technology I need? SQL? NoSQL?
![Page 26: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/26.jpg)
Start with SQL databases
![Page 27: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/27.jpg)
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
![Page 28: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/28.jpg)
AH HA! You said “massive
amounts”, I will have massive amounts!
![Page 29: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/29.jpg)
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,
then you might need NoSQL
![Page 30: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/30.jpg)
Why else might you need NoSQL?
• Super low latency applications• Metadata driven datasets• Highly non-relational data• Need schema-less data constructs*• Massive amounts of data (again, in the TB range)• Rapid ingest of data ( thousands of records/sec )
*Need != “its easier to do dev without schemas”
![Page 31: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/31.jpg)
User >100:First let’s separate out our single host into more than one.• Web• Database
– Use Amazon RDS to make your life easier
Web Instance
Elastic IP
RDS DB Instance
Amazon Route 53
User
![Page 32: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/32.jpg)
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 InstanceActive (Multi-AZ)
Availability Zone Availability Zone
Web Instance
RDS DB Instance Standby (Multi-AZ)
Elastic LoadBalancer
Amazon Route 53
User
![Page 33: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/33.jpg)
• Create highly scalable applications
• Distribute load across EC2 instances
in multiple availability zonesFeature 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 and can get logs of requests processed
Elastic LoadBalancer
Elastic Load Balancing
![Page 34: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/34.jpg)
Scaling this horizontally and vertically will get us
pretty far( 10s-100s of thousands )
![Page 35: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/35.jpg)
User >10ks-100ks:
RDS DB InstanceActive (Multi-AZ)
Availability Zone Availability Zone
RDS DB Instance Standby (Multi-AZ)
Elastic LoadBalancer
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
![Page 36: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/36.jpg)
This will take us pretty far honestly, but we care about performance and efficiency, so let’s improve this further
![Page 37: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/37.jpg)
Shift some load around:Let’s lighten the load on our web and database instances:• Move static content from
the web instance to Amazon S3 and Amazon CloudFront
• Move session/state and DB caching to Amazon ElastiCache or Amazon DynamoDB
Web Instance
RDS DB InstanceActive (Multi-AZ)
Availability Zone
Elastic LoadBalancer
Amazon S3
Amazon Cloudfront
Amazon Route 53
User
ElastiCache
DynamoDB
![Page 38: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/38.jpg)
Working with Amazon S3
• 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• Amazon Glacier for super long term
storage
![Page 39: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/39.jpg)
CloudFrontAmazon CloudFront is a web service for scalable content delivery: • Cache static content at the edge for faster delivery• Helps lower load on origin infrastructure• Dynamic and static content• Streaming video• Zone apex support• Custom SSL certificates• Low TTLs (as short as 0 seconds)• Lower costs for origin fetches (between Amazon
S3 / Amazon EC2 and CloudFront)• Optimized to work with Amazon EC2, Amazon S3,
Elastic Load Balancing, and Amazon Route 53
Resp
onse
Tim
e
Serv
er L
oad
Resp
onse
Tim
e
Serv
er
Load
Resp
onse
Tim
e
Serv
er
Load
No CDN CDN for Static
Content
CDN for Static &
Dynamic Content
08:00:00 AM09:42:00 AM11:24:00 AM 01:06:00 PM 02:48:00 PM 04:30:00 PM 06:12:00 PM 07:54:00 PM0
10
20
30
40
50
60
70
80
Vo
lum
e o
f D
ata
De-
live
red
(G
bp
s)
![Page 40: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/40.jpg)
Shift some load around:
Web Instance
RDS DB InstanceActive (Multi-AZ)
Availability Zone
Elastic LoadBalancer
Amazon S3
Amazon Cloudfront
Amazon Route 53
User
ElastiCache
DynamoDB
Let’s lighten the load on our web and database instances:• Move static content from
the web instance to Amazon S3 and Amazon CloudFront
• Move session/state and DB caching to Amazon ElastiCache or Amazon DynamoDB
![Page 41: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/41.jpg)
Amazon DynamoDB
• Managed, provisioned throughput
NoSQL database
• Fast, predictable performance
• Fully distributed, fault tolerant
architecture
• Considerations for non-uniform
data
Feature DetailsProvisioned 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 with Amazon CloudWatch.
Secure Integrates with AWS Identity and Access Management (IAM).
Amazon EMR Integrates with Amazon EMR for complex analytics on large datasets
![Page 42: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/42.jpg)
Amazon ElastiCache• Hosted Memcached & Redis
– Speaks same API as traditional open source Memcached and Redis
• 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 for Memcache, with no persistence or
replication• With Redis can put a replica in a different AZ with
persistence• Use AWS’s Auto Discovery client to simplify clusters
growing and shrinking without affecting your application
![Page 43: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/43.jpg)
Shift some load around:
Web Instance
RDS DB InstanceActive (Multi-AZ)
Availability Zone
Elastic LoadBalancer
Amazon S3
Amazon Cloudfront
Amazon Route 53
User
ElastiCache
DynamoDB
Let’s lighten the load on our web and database instances:• Move static content from the
web instance to Amazon S3 and Amazon CloudFront
• Move dynamic content from the ELB to Amazon CloudFront
• Move session/state and DB caching to ElastiCache or DynamoDB
![Page 44: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/44.jpg)
Now that our Web tier is much more lightweight, we can revisit the beginning of
our talk…
![Page 45: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/45.jpg)
Auto-Scaling!
![Page 46: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/46.jpg)
Automatic resizing of compute
clusters based on demand
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.
aws autoscaling create-auto-scaling-group--auto-scaling-group-name MyGroup--launch-configuration-name MyConfig--min-size 4--max-size 200--availability-zones us-west-2c
Auto-ScalingTrigger auto-scaling policy
Amazon CloudWatch
![Page 47: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/47.jpg)
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Typical weekly traffic to Amazon.com
![Page 48: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/48.jpg)
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Typical weekly traffic to Amazon.com
Provisioned capacity
![Page 49: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/49.jpg)
November traffic to Amazon.com
November
![Page 50: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/50.jpg)
November traffic to Amazon.comProvisioned capacity
November
![Page 51: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/51.jpg)
November traffic to Amazon.com76%
24%
Provisioned capacity
November
![Page 52: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/52.jpg)
November traffic to Amazon.com
November
![Page 53: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/53.jpg)
Auto Scaling lets you do this!
![Page 54: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/54.jpg)
User >500k+:
Availability Zone
Amazon Route 53
User
Amazon S3
Amazon Cloudfront
Availability Zone
Elastic LoadBalancer
DynamoDBRDS DB Instance
Read Replica
Web Instance
Web Instance
Web Instance
ElastiCache RDS DB Instance Read Replica
Web Instance
Web Instance
Web Instance
ElastiCacheRDS DB Instance Standby (Multi-AZ)
RDS DB InstanceActive (Multi-AZ)
![Page 55: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/55.jpg)
![Page 56: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/56.jpg)
Use Tools: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
![Page 57: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/57.jpg)
AWS Application Management Solutions
Convenience Control
Higher-level Services Do it yourself
AWSElastic Beanstalk
AWSOpsWorks
AWSCloudFormation
Amazon EC2
![Page 58: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/58.jpg)
User >500k+: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, use this direction
• Try to work on squeezing as much performance out of each service/component
![Page 59: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/59.jpg)
HOST LEVEL
METRICS
AGGREGATE LEVEL
METRICS
LOG ANALYSIS
EXTERNALSITE
PERFORMANCE
![Page 60: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/60.jpg)
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.
![Page 61: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/61.jpg)
![Page 62: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/62.jpg)
AWS Marketplace & Partners Can Help
• Customer can find, research, and buy software
• Simple pricing, aligns with Amazon EC2 usage model
• Launch in minutes• AWS Marketplace billing
integrated into your AWS account
• 1300+ products across 20+ categories
Learn more at: aws.amazon.com/marketplace
![Page 63: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/63.jpg)
There’s further improvements to be
made in breaking apart our web/app layer
![Page 64: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/64.jpg)
![Page 65: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/65.jpg)
SOA = Service Oriented Architecture
![Page 66: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/66.jpg)
SOA’ingMove 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.
![Page 67: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/67.jpg)
Loose coupling + SOA = winning
DON’T REINVENT THE WHEEL
Examples:• Email• Queuing• Transcoding• Search• Databases• Monitoring• Metrics• Logging
Amazon CloudSearch
Amazon SQSAmazon SNS
Amazon Elastic Transcoder
Amazon SWFAmazon SES
In the early days, if someone has a service for it already, opt to use that instead of building it yourself.
![Page 68: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/68.jpg)
On re-inventing the wheel: If you find yourself writing
your own: queue, DNS server, database, storage system, monitoring tool
![Page 69: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/69.jpg)
Take a deep breath and stop it. Now.
![Page 70: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/70.jpg)
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 (Amazon S3/CloudFront )• Caching off DB• Moving state off tiers that auto-scale
![Page 71: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/71.jpg)
User >1mil+:
RDS DB InstanceActive (Multi-AZ)
Availability Zone
Elastic LoadBalancer
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
WorkerInstance
WorkerInstance
Amazon CloudWatch
Internal AppInstance
Internal AppInstance
Amazon SES
![Page 72: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/72.jpg)
The next big steps
![Page 73: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/73.jpg)
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 )
![Page 74: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/74.jpg)
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
![Page 75: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/75.jpg)
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
![Page 76: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/76.jpg)
Shifting functionality to NoSQL
• Similar in a sense to federation• Again, think about the earlier points for when you
need NoSQL vs SQL• Leverage hosted services like DynamoDB• Some use cases:
– Leaderboards/scoring– Rapid ingest of clickstream/log data– Temporary data needs ( cart data )– “Hot” tables– Metadata/lookup tables
DynamoDB
![Page 77: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/77.jpg)
A Quick Review
![Page 78: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/78.jpg)
A Quick Review
• Multi-AZ your infrastructure• Make use of self scaling services - ELB, Amazon S3,
Amazon SNS, Amazon SQS, Amazon SWF, Amazon SES, etc
• Build in redundancy at every level.• Start SQL. Seriously.• Cache data both inside and outside your
infrastructure• Use automation tools in your infrastructure
![Page 79: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/79.jpg)
A Quick Review
• Make sure you have good metrics/monitoring/logging tools in place
• Split tiers into individual services ( SOA )• Use Auto Scaling once you’re ready for it• Don’t reinvent the wheel• Move to NoSQL if/when it makes sense
![Page 80: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/80.jpg)
Putting all this together means we should now
easily be able to handle 10+ million users!
![Page 81: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/81.jpg)
To infinity…..
![Page 82: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/82.jpg)
User >10mil:
Iterating on top of the patterns seen here will get
you up and over 100 million users.
![Page 83: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/83.jpg)
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
![Page 84: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/84.jpg)
Next steps?
READ! – • aws.amazon.com/documentation• aws.amazon.com/architecture• aws.amazon.com/start-ups
![Page 85: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/85.jpg)
Next steps?
START USING AWS –
aws.amazon.com/free/
![Page 86: Scaling on AWS to the First 10 Million Users](https://reader038.vdocuments.site/reader038/viewer/2022110200/55c532d0bb61ebbf328b4695/html5/thumbnails/86.jpg)
Next steps?
ASK FOR HELP!• forums.aws.amazon.com• aws.amazon.com/support• Your Account Manager • A Solutions Architect