QA
Beginner LevelCloud Computing (AWS/GCP/Azure)

Compare Application Load Balancer (ALB) vs Network Load Balancer (NLB).

❓ Interview Prompt: Compare Layer 7 ALB vs Layer 4 NLB features, performance, protocols, and use cases.

AWS Elastic Load Balancing (ELB) provides two primary modern load balancer options:

1. Application Load Balancer (ALB - Layer 7):

•
OSI Layer: Operates at the Application Layer (Layer 7 - HTTP/HTTPS/HTTP2/gRPC).
•
Routing Capabilities: Advanced path-based routing ('/api' vs '/static'), host-based routing ('app.com' vs 'admin.com'), HTTP header routing, and cookie sticky sessions.
•
TLS Termination: Offloads SSL/TLS encryption certificates via AWS Certificate Manager (ACM).

2. Network Load Balancer (NLB - Layer 4):

•
OSI Layer: Operates at the Transport Layer (Layer 4 - TCP/UDP/TLS).
•
Performance: Capable of handling millions of requests per second with ultra-low sub-millisecond latency.
•
Static IP: Provides dedicated static IP addresses (or Elastic IPs) per Availability Zone. Ideal for non-HTTP protocols, gaming, or financial trading APIs.

Code Implementation Example

typescript
function chooseLoadBalancer(protocol: 'HTTP' | 'TCP', needsUltraLowLatency: boolean) {
  if (protocol === 'HTTP' && !needsUltraLowLatency) {
    return 'Application Load Balancer (ALB - Layer 7)';
  }
  return 'Network Load Balancer (NLB - Layer 4)';
}
💡Decision helper for ALB vs NLB selection.
🎯 Interview Key Takeaway

ALB handles Layer 7 HTTP/HTTPS path-based routing; NLB handles Layer 4 TCP/UDP for ultra-low latency and static IPs.

#ALB#NLB#Load Balancing#Layer 7#Beginner
Back to all Cloud Computing (AWS/GCP/Azure) Questions→

More Cloud Computing (AWS/GCP/Azure) Interview Questions

Beginner LevelCloud Computing (AWS/GCP/Azure)

How does Serverless Architecture (AWS Lambda / GCP Cloud Run) handle Auto-Scaling and Cold Starts?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is the difference between IaaS, PaaS, and SaaS cloud service models?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is AWS EC2 and what are On-Demand, Reserved, and Spot Instance pricing models?