Horizontal vs. Vertical Scaling Flashcards

1
Q

What is vertical scaling?

A

An example would be increasing the size of the virtual machine, like memory, cpu, etc.

Limited by the largest machine option available

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is horizontal scaling?

A

An example would be to make use of multiple virtual machines to spread out the work

Benefits:
1. Horizontal scaling has no limit, except maybe the cost
2. Increased high availability (can make use of multiple AZs)
3. Increased redundancy
4. Autoscaling options are available

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the 3Ws of scaling?

A
  1. What do we scale? What resources are we going to scale? How do you define the template?
  2. Where do we scale? When applying the model, where does it go? Should we scale out databases, or web servers?
  3. When do we scale? How do we know we need more? CloudWatch alarms can tell us when it’s time to add more resources.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a launch template?

A

A launch template specifies all of the needed settings to go into building out an EC2 instance.

It is a collection of settings that you can configure so you don’t have to walk through the EC2 wizard over and over.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between templates and configurations?

A

Templates:
1. More than just autoscaling
2. Supports versioning
3. More granularity
4. AWS supported

Configurations:
1. Only for autoscaling
2. Immutable
3. Limited configuration options
4. Don’t use them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What settings are available in an EC2 launch template?

A
  1. AMI
  2. EC2 instance size
  3. Security groups
  4. Networking information
  5. User data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

If you define networking information in an EC2 launch template, what options won’t be available?

A

You can’t use the launch template in an auto-scaling group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are auto-scaling groups in EC2?

A

Contains a collection of EC2 instances that are treated as a collective group for the purpose of scaling and management

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the steps to setting up an auto-scaling group in EC2?

A
  1. Define your template: Define your EC2 launch template (launch template of launch configuration
  2. Networking and purchasing: Pick your networking and purchasing options (using multiple AZs allows for high availability)
  3. ELB configuration: EC2 instances can be registered behind a load balancer; the auto-scaling group can be set to respect the load balancer health checks
  4. Set scaling policies: Minimum, maximum and desired capacity needs to be set or to ensure you don’t have too many or too few resources
  5. Notifications: SNS can act as a notification tool, allowing you to let someone know when the scaling event occurs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the three auto-scaling restrictions?

A
  1. Minimum - the lowest number of EC2 instances you’ll ever have online (likely the lowest would ever be 2)
  2. Maximum - the highest number of EC2 instances you’ll ever provision
  3. Desired - how many instances do you want right now? it will never be lower than the minimum and never be higher than the maximum
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How can you save money when using auto-scaling in EC2?

A

You can select to use spot instances

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What option in EC2 is integral to making an application highly available?

A

Auto-scaling

Remember to select answers that spread resources out over multiple AZs and utilize load balancers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is EC2 instance warm-up in auto-scaling?

A

Stops instances from being placed behind the load balancer, failing the health check, and being terminated

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is EC2 instance cool-down in auto-scaling?

A

Pauses auto-scaling for a set amount of time; helps to avoid runaway scaling events (default window is 5 minutes)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does it mean to “avoid thrashing” in auto-scaling?

A

Create instances quickly and spin them down slowly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the three types of auto-scaling?

A
  1. Reactive scaling - you’re playing catch-up; once the load is there, you measure it and then determine if you need to create more resources
  2. Scheduled scaling - if you have a predictable workload, create a scaling event to get your resources ready to go before they are actually needed
  3. Predictive scaling - AWS uses its machine learning algorithms to determine when you’ll need to scale; they are reevaluated every 24 hours to create a forecast for the next 48
17
Q

If you have a legacy application where you can’t have multiple instances running at the same time, but you want high-availability. How would you set it up?

A

Create an auto-scaling group with a minimum, maximum and desired count of 1, and select multiple AZs that it can run in. If the instance is terminated, it will likely spin up in another AZ.

Called a “steady-state group”.

18
Q

If you are given a scenario where you are asked to pick a scaling solution to handle the increase in CPU for your application. What option would you recommend?

  1. Create an auto-scaling group with 5,000 instances and they are all R5 24 XLs
  2. Create a very gradual increase and decrease of my instance count using reasonably sized EC2 instances
A

Obviously it would be #2 because it is the more cost-reasonable option

19
Q

What are the thoughts to consider when building auto-scaling policy in EC2?

A
  1. Scale out aggressively
  2. Scale in conservatively
  3. Provisioning - keep an eye on provisioning times; bake those AMIs to minimize it
  4. Costs - Use EC2 Reserved Instances for minimum count of EC2 instances; potentially use Spot Instances to scale with and then fail back on-demand
  5. CloudWatch is your #1 tool for alerting auto-scaling that you need more or less of something
20
Q

What are the four types of scaling to adjust relational database performance?

A
  1. Vertical scaling - resizing the database from one size to another can create greater performance
  2. Scaling storage - storage can be resized but it is only able to go up, not down (Aurora automatically scales in 10GB increments, the rest are manual)
  3. Read replicas - creating read-only copies of our data can help spread out the workload
  4. Aurora serverless - offload scaling to AWS; excels with unpredictable workloads
21
Q

If you are given a scenario where you have a read-heavy workload, what option should you consider?

A

Read replicas

22
Q

If you are given a scenarios giving the option to refactor and switch a database type to solve a scaling problem, would you select that option?

A

Yes, it is possible this could be the best option for the exam (even if in the real world it would be less likely)

Don’t be shy in picking an option of switching from relational to non-relational databases, especially in favor of DynamoDB, because it is easier to scale and is more managed

If non-relational isn’t an option, consider Aurora heavily

23
Q

What are the DynamoDB scaling options?

A
  1. Provisioned

Use Case: Generally predictable workload
Effort to Use: Need to review past usage to set upper and lower scaling bounds
Cost: Most cost-effective model

  1. On-Demand

Use Case: Sporadic workload
Effort to Use: Simply select “on-demand”
Cost: Pay small amount of money per read and write; less cost-effective

24
Q

When considering cost vs performance between two options related to DynamoDB scaling, what option should you consider most?

A

Cost

25
Q

Which scaling option costs more in DynamoDB, provisioned or on-demand?

A

On-demand

26
Q

What are some things to consider when using DynamoDB that affect scaling besides selecting between the two scaling options?

A
  1. Know your access patterns and whether they are predictable or unpredictable
  2. Avoiding hot keys will lead to better performance
  3. You can switch between provisioned and on-demand scaling but must wait 24 hours before switching back
  4. Keep cost in mind when considering which type of table to pick
27
Q

What are the four questions that you should ask yourself whenever you are given a scenario that relates to scaling and high-availability?

A
  1. Is it highly available? Always select options that are highly available, even when it isn’t mentioned specifically
  2. Which is appropriate for the situation? horizontal or vertical scaling
  3. Is the scaling option cost effective?
  4. Would switching databases fix the problem?
28
Q

What AWS services provide autoscaling?

A

Auto-scaling is only for EC2

No other service can be scaled using auto-scaling options. Other services might have a built-in option but they aren’t included in auto-scaling groups.

29
Q

Which option would be the best choice related to auto-scaling, predictive or reactive?

A

Predictive is preferred over reactive

30
Q

What is a way to make an EC2 more performant to start-up?

A

You can avoid long provisioning times by putting everything into an AMI, rather than using user data

31
Q

Can you spread an EC2 auto-scaling group over multiple AZs?

A

Yes, that is possible and preferred

32
Q

How do you configure a “stead-state” auto-scaling group in EC2?

A

Set the minimum, maximum and desired capacity to 1

33
Q

What is needed when you set up ELBs for auto-scaling?

A

Health checks on the ELB so instances won’t be terminated and replaced when they fail health checks