Load Balancing & Scaling Flashcards
What is a load balancer?
A service that distributes incoming application traffic across multiple targets, such as EC2 instances, in multiple Availability Zones to increase the availability of your application.
How does a load balancer work?
By using one or more listeners. It checks for connection requests, then forwards the request based on your rules. A listener has a default rule and you can add more.
What are the features of a load balancer rule?
Target group,
Condition,
Priority.
Forwarding happens when the condition is met.
Can a target for a load balancer belong to more than one target group?
Yes.
What is ELB? What are the features?
Elastic Load Balancing. It automatically distributes incoming application traffic across multiple targets and virtual appliances in one or more Availability Zones (AZs).
- Single point of access (DNS)
- Handles failures of downstream instances
- Does health checks
- Provides HTTPS
- Enforce stickiness with cookies
- High availability across zones
- Separates private and public traffic
- Security (use with security groups)
- Monitoring (integrates with CloudWatch, request tracing)
What are the 4 types of load balancers?
Classic CLB
Application ALB
Network NLB
Gateway GWLB
I have some third-party virtual appliances. Which load balancer should I choose?
Gateway Load Balancer.
I need flexible application management, using Lambda functions and redirects. Which load balancer should I choose?
Application Load Balancer.
I need extreme performance and a static IP address. Which load balancer should I choose?
Network Load Balancer.
What does it mean to scale vertically? What kind of application would do that?
Make your instance bigger, like micro to large.
Non-distributed applications like databases would scale vertically.
Describe an Application Load Balancer.
Works at the application layer (layer 7).
• HTTP
• Supports HTTP/2, WebSocket
• Supports content-based routing (e.g. IP address, the path or hostname in the URL, or query string/headers in request)
• Can route to targets on the same instance: good for applications that run in containers
• Supports redirects (e.g. HTTP -> HTTPS)
• 1 ALB can support many applications
• Fixed hostname
Good for:
• Microservices
• Containers
Describe a Classic Load Balancer.
Previous-generation load balancer; no longer recommended. • TCP (layer 4) • HTTP/HTTPS (layer 7) • fixed hostname • one application = 1 load balancer
Describe a Network Load Balancer.
Works at layer 4
• TCP/UDP
• Ultra-low latency, extreme performance
Has 1 Static IP per AZ
Supports Elastic IP (good for white-listing)
Supports VPC endpoint services
Different listener on unique ports
Target can be outside your VPC like on-prem
What can be in a target group of an NLB?
EC2 instances
Private IP addresses
• specify fixed static IP address
• e.g. if you have a server in your own datacenter
ALB
• you can chain NLB to ALB
• e.g. you want to use the static IPs of the NLB but also the HTTP features of the ALB
Describe a Gateway Load Balancer
Operates at Level 3 (Network Layer - IP packets)
- Works as Load Balancer
- ALSO works as Transparent Network Gateway (single entry/exit point for all traffic)
Allows you to deploy/manage/scale a fleet of 3rd party network virtual appliances in AWS. These appliances sit between your users and the targets.
Users -> GLB -> appliances -> GLB -> target
E.g. You want all traffic to be inspected for security
I need to use the GENEVE protocol on port 6081.
Gateway Load Balancer.
What can be in a target group of the Gateway Load Balancer?
EC2.
Private IP addresses
What is a sticky session? How does it work? What are the pros and cons?
Aka Affinity Session.
An optional feature for CLB & ALB
Uses a cookie with an expiration date
Allows user to always communicate with the same EC2
Pros: keep session data like login ID
Cons: unbalanced load
What are the 2 types of cookie used for sticky sessions?
Application Based:
a) Custom
• generated by target (application)
• can include custom attributes required by the app
• must have a different name for each target group
• name is anything except AWSALB, AWSALBAPP, AWSALBTG
b) Application cookie:
• generated by load balancer
• name is AWSALBAPP
Duration Based:
• generated by load balancer
• name is AWSALB or AWSELB (for classic)