Skip to content
Load Balancing Strategies logo

Load Balancing Strategies

Comprehensive guide to load balancing algorithms, health checks, and high-availability patterns.

SKILL.md

Full skill instructions

Load Balancing Strategies

Overview

Load balancing distributes traffic across multiple targets to improve availability, performance, and resilience. This guide covers algorithms, health checks, and operational best practices.

Table of Contents

  1. Fundamentals
  2. Layer 4 vs Layer 7
  3. Algorithms
  4. Health Checks
  5. Session Persistence
  6. TLS Termination
  7. Connection Draining
  8. Global Load Balancing
  9. Cloud Load Balancers
  10. Software Load Balancers
  11. Service Mesh Load Balancing
  12. Autoscaling Integration
  13. Monitoring
  14. Troubleshooting

Fundamentals

Core goals:

  • Spread traffic evenly
  • Avoid single points of failure
  • Improve latency by routing to healthy targets

Layer 4 vs Layer 7

  • Layer 4 (TCP/​UDP): Fast, protocol-agnostic, no HTTP awareness.
  • Layer 7 (HTTP/​HTTPS): Route by path/​host/​headers, supports TLS termination.

Algorithms

Common strategies:

  • Round Robin: Simple rotation.
  • Weighted Round Robin: Bias to stronger nodes.
  • Least Connections: Route to least busy.
  • Weighted Least Connections: Combine weight + load.
  • IP Hash: Sticky routing by client IP.
  • Random: Low overhead.
  • Least Response Time: Prefer lowest latency target.

Health Checks

Types:

  • Active: Probes at intervals.
  • Passive: Detect failures from live traffic.

Use both for best detection and recovery.

Session Persistence

Sticky sessions route a client to the same target:

  • Cookie-based affinity
  • IP hash

Use only when state cannot be externalized.

TLS Termination

Terminate TLS at the load balancer for:

  • Centralized cert management
  • Better performance
  • Easier observability

Optionally re-encrypt to backend for end-to-end security.

Connection Draining

Allow in-flight requests to finish during scale-down or deploy:

  • Set drain timeout
  • Stop new connections

Global Load Balancing

GSLB routes across regions:

  • Geo-based routing
  • Latency-based routing
  • Failover routing

Cloud Load Balancers

  • AWS: ALB (L7), NLB (L4)
  • GCP: HTTP(S) Load Balancer, TCP/​UDP LB
  • Azure: Application Gateway, Azure Load Balancer

Software Load Balancers

  • NGINX: Popular L7 proxy with health checks.
  • HAProxy: High performance L4/​L7.
  • Envoy: Modern proxy with rich telemetry.

Service Mesh Load Balancing

Service meshes (Istio, Linkerd) provide client-side load balancing with retry policies, circuit breaking, and telemetry.

Autoscaling Integration

Combine with autoscaling:

  • Scale on CPU, latency, or queue depth
  • Pre-warm nodes to reduce cold starts

Monitoring

Track:

  • Request rate and latency
  • Backend error rates
  • Health check failures
  • Uneven traffic distribution

Troubleshooting

Common issues:

  • Misconfigured health checks (false negatives)
  • Sticky sessions causing hot spots
  • TLS mismatch or SNI routing errors
  • Draining too short for long requests

Related Skills

  • 09-microservices/​api-gateway
  • 09-microservices/​service-mesh
  • 15-devops-infrastructure/​kubernetes-helm

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
I
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View