Q: What is the difference between an Application Load Balancer (ALB) and a Network Load Balancer (NLB)? When do you use which?
ALB (Layer 7): Operates at the Application layer. It understands HTTP/HTTPS headers, URLs, and cookies.
Want to master this scenario in a live sandbox? KodeKloud's Istio Service Mesh & Advanced Kubernetes Networking Course covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "Networking issues can paralyze distributed applications. In our hybrid cloud architecture, we traced this packet path. The interviewer is testing: OSI model, Layer 7 vs Layer 4, TLS termination.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."
Initial Diagnostics & Root Cause Analysis
- ALB (Layer 7): Operates at the Application layer. It understands HTTP/HTTPS headers, URLs, and cookies. You use it when you need path-based routing (e.g.,
/apito one target group,/imagesto another), WebSocket support, or advanced WAF integrations. It terminates the connection and creates a new one to the backend. - NLB (Layer 4): Operates at the Transport layer. It only understands IP addresses and TCP/UDP ports. It is incredibly fast, handles millions of requests per second with ultra-low latency, and provides a static IP address. You use it for non-HTTP traffic (like databases, SSH, or custom TCP protocols) or when you require end-to-end TLS where the backend terminates the certificate.
Remediation & Permanent Safeguards
Execute the resolution runbook and verify workload health:
- ALB (Layer 7): Operates at the Application layer. It understands HTTP/HTTPS headers, URLs, and co...
- NLB (Layer 4): Operates at the Transport layer. It only understands IP addresses and TCP/UDP port...
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Confusing ALB 502 Bad Gateway (target connection reset) with 504 Gateway Timeout (upstream response timeout) when configuring Networking difference Application 502 indicates the backend target closed the TCP connection prematurely or returned malformed HTTP, whereas 504 means the target failed to respond before idle timeout.
- Setting target deregistration delay to zero instead of allowing connection draining when configuring Networking difference Application Instant target deregistration severs in-flight HTTP requests during auto-scaling scale-in or rolling deployments, causing immediate user-facing drops.
-
Failing to query CloudWatch ELB metrics (
HTTPCode_ELB_5XXvsHTTPCode_Target_5XX) during load balancer outages when configuring Networking difference Application Comparing load balancer generated errors against target generated errors immediately isolates whether the issue lies in the proxy tier or application runtime. - Overlooking Security Group rules on backend EC2/ECS instances that block health check traffic from the ALB when configuring Networking difference Application Target instances must explicitly permit inbound HTTP/HTTPS traffic from the ALB security group on the configured container/application port.