# Load Balancing Patterns

When distributing traffic across multiple servers or regions, use this skill to select...

- Repository: https://github.com/ancoleman/ai-design-components (526 stars)
- Category: DevOps
- License: MIT
- Last updated: 2025-12-11
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add ancoleman/ai-design-components --skill load-balancing-patterns -g -a claude-code -y`
Codex: `npx skills add ancoleman/ai-design-components --skill load-balancing-patterns -g -a codex -y`
Cursor: `npx skills add ancoleman/ai-design-components --skill load-balancing-patterns -g -a cursor -y`
Gemini CLI: `npx skills add ancoleman/ai-design-components --skill load-balancing-patterns -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add ancoleman/ai-design-components`

## Description

When distributing traffic across multiple servers or regions, use this skill to select and configure the appropriate load balancing solution (L4/L7, cloud-managed, self-managed, or Kubernetes ingress) with proper health checks and session management.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Load Balancing Patterns

Distribute traffic across infrastructure using the appropriate load balancing approach, from simple round-robin to global multi-region failover.

## When to Use This Skill

Use load-balancing-patterns when:
- Distributing traffic across multiple application servers
- Implementing high availability and failover
- Routing traffic based on URLs, headers, or geographic location
- Managing session persistence across stateless backends
- Deploying applications to Kubernetes clusters
- Configuring global traffic management across regions
- Implementing zero-downtime deployments (blue-green, canary)
- Selecting between cloud-managed and self-managed load balancers

## Core Load Balancing Concepts

### Layer 4 vs Layer 7

**Layer 4 (L4) - Transport Layer:**
- Routes based on IP address and port (TCP/UDP packets)
- No application data inspection, lower latency, higher throughput
- Protocol agnostic, preserves client IP addresses
- Use for: Database connections, video streaming, gaming, financial transactions, non-HTTP protocols

**Layer 7 (L7) - Application Layer:**
- Routes based on HTTP URLs, headers, cookies, request body
- Full application data visibility, SSL/TLS termination, caching, WAF integration
- Content-based routing capabilities
- Use for: Web applications, REST APIs, microservices, GraphQL endpoints, complex routing logic

For detailed comparison including performance benchmarks and hybrid approaches, see `references/l4-vs-l7-comparison.md`.

### Load Balancing Algorithms

The rest: https://github.com/ancoleman/ai-design-components/blob/HEAD/skills/load-balancing-patterns/SKILL.md
