Architecting to scale Flashcards
What is a loosely coupled architecture?
Where components can stand independently and require little or no knowledge of the inner workings of the other components
Why use a loosely coupled architecture for scalability?
4 points
1) provides abstraction
2) Interchangeable components
3) More atomic functional units
4) you can scale components independently
What is horizontal scaling? (4 points)
1) Where you add instances as demand increases
2) no downtime required to scale up or down
3) You can do this automatically using auto-scaling groups
4) theoretically unlimited
What is vertical scaling (4 points)?
1) Where you add more CPI and or RAM to an existing instance as demand increases
2) Requires restart to scale up or down
3) Would require scripting to automate
4) limited by instance size
Define scale out…
Where you add another instance
Define scale up…
Where you increase resources of an instance
Define scale in…
Where you remote an instance
Define scale down…
Where you decrease the resources of an instance
Why would you scale out over scaling up?
Because demand is never constant! So you will be wasting resources when scaling up…
What is the key benefit of scaling out?
Cost savings!
What are the 2 types of autoscaling offered by AWS?
1) EC2 autoscaling
2) Application autoscaling
What is AWS auto scaling? and why would you use it?
What- Provides a centralised way to manage scalability for whole stacks and can provide predictive scaling.
why- Gives you the ability to manage EC2 and application autoscaling from a unified standpoint
What are the 4 scaling options with EC2 autoscaling groups/types?
1) Maintaining- Keep a specific or min number of instances running
2) Manual- use max and min or specified number of instances
3) schedule- increase or decrease instances based on a schedule
4) Dynamic scale based on real-time metrics of the system
What is a launch configuration? and what 7 things do you include in this?
A launch configuration is an instance configuration template that an Auto Scaling group uses to launch EC2 instances. When you create a launch configuration, you specify information for the instances.
1) Include the ID of the Amazon Machine Image (AMI)
2) the instance type
3) a key pair
4) one or more security groups
5) a block device mapping
6) define a health check grace period
7) the scale type (how we want to scale)
What is a health check grace period?
A time period that the scaling policy will allow to let that system to spin up before checking the health of that service.
Which use case would be the most appropriate for a maintain scaling type?
When you always need X number of instances always
e.g. 3
Which use case would be the most appropriate for a manual scaling type?
My needs change so rarely that I can just manually add and remove instances
Which use case would be the most appropriate for a scheduled scaling type?
Every Monday morning we get a rush on our website
Which use case would be the most appropriate for a dynamic scaling type?
When CPU utilisation gets to 70% on current instances, scale up
Within the dynamic scaling type, we have EC2 autoscaling policies. Name and describe the 3 policies…
1) Target tracking policy- Scale based on a pre-defined or customer metric in relation to a target value
2) Simple scaling policy- wait until health checks and cold down period expires before evaluating new need
3) Step scaling policy- Responds to scaling needs with more sophistication and logic
Which use case would be the most appropriate for a target tracking policy…
When CPU utilization gets to 70% on current instances, scale up
Which use case would be the most appropriate for a simple scaling policy…
Let’s add new instances slowly and steadily
Which use case would be the most appropriate for a step scaling policy…
AGG add all the instances!
What is a scaling cooldown?
Configurable duration that gives your scaling a chance to “come up to speed” and absorb load.
Different than a health check!
How long is the default cooldown period?
300 seconds
Which scaling policy does cooldown period get applied to by default?
Dynamic scaling
Can you override the default cooldown period?
Yes
What is the benefit of a cool down period?
Sanity check to see if adding the resource was enough to absorb the load.
Name 3 types of scaling policies available with application autoscaling…
1) Target tracking policy- initiates scaling to try and track as closely as possible to a given metric
2) Step scaling policy- Based on a metric it adjusts capacity to a given defined threshold
3) Scheduled scaling policy- Initiated scaling events based on a pre-defined time, day or date
Which use case would be the most appropriate for a target tracking policy…
I want my ECS (container) hosts to stay at or below 70% CPU utilization
Which use case would be the most appropriate for a step scaling policy…
I want to increase my EC2 spot fleet by 20% everytime I add another 10,000 connections on my ELB
Which use case would be the most appropriate for a scheduled scaling policy…
Every Moday at 08:00 I want to increase the read capacity units of my DynmoDB table to 20,000
What is a shard?
Shard is the base throughput unit of an Amazon Kinesis data stream. One shard provides a capacity of 1MB/sec data input and 2MB/sec data output.
What are the 3 parts of a shard?
1) partition key
2) sequence (order of the shard in a sequence)
3) data
What are the two dimensions of DynamoDB scaling?
1) Throughput- Read capacity units and write capacity units
2) Size- Max size is 400KB but it can scale as you can store as many as you like
What is a partition in DynamoDB?
A physical space where DynamoDB is stored
What is a partition key in DynamoDB?
A unique identifier for each record sometimes called a hash key
What is a sort key in DynamoDB?
An optional key that defines storage order on the partition
How does dynamoDB scale out?
DynamoDB adds additional partitions to scale out
How do you work out the number of partitions you get?
You work out how many partitions you need by capacity (how many RCU and WRU you have provisioned!) and the size. Then take the MAX of the largest dimension and round up to get the total number of partitions
What is the formula for calculating the partition size of your DynamoDB table by capacity?
(total RCU/3000) + (total WCU/1000)
What is the formula for calculating the partition size of your DynamoDB table by size?
Total size in GB/10GB
How are the read and write capacity allocated across partitions?
Splits equally across partitions