How load balancers distribute traffic, CDN edge nodes, HTTPS/TLS termination, and setting up Cloudflare.
Learn the core concepts of Load Balancers and CDNs and apply them in practical exercises.
A load balancer sits in front of your servers and distributes incoming requests across them. Without one, a single server handles everything — one failure takes down the site.
Round Robin: 1→2→3→1→2→3 (simple, even distribution) Least Connections: route to the server with fewest active connections IP Hash: same client always goes to same server (session affinity) Weighted: server A gets 70% of traffic, server B gets 30%
upstream app_servers {
least_conn; # least connections algorithm
server app1.example.com:3000;
server app2.example.com:3000;
server app3.example.com:3000;
}
server {
listen 80;
location / {
proxy_pass http://app_servers;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# CDN = Content Delivery Network # Copies your static assets to edge servers worldwide # User gets content from nearest edge, not your origin server # Cloudflare: free tier, DNS + CDN + DDoS protection # Add your domain → change nameservers to Cloudflare # All traffic routes through Cloudflare edge # Cloudflare handles: # - Static asset caching # - DDoS protection # - TLS termination (HTTPS for free) # - Firewall rules # - Bot protection
Before moving on, confirm understanding of these key concepts: