testing-load-balancers

Validate load balancer behavior, failover, and traffic distribution. Use when performing specialized testing. Trigger with phrases like "test load balancer", "validate failover", or "check traffic distribution".

1,868 stars

Best use case

testing-load-balancers is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Validate load balancer behavior, failover, and traffic distribution. Use when performing specialized testing. Trigger with phrases like "test load balancer", "validate failover", or "check traffic distribution".

Teams using testing-load-balancers should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/testing-load-balancers/SKILL.md --create-dirs "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/plugins/testing/load-balancer-tester/skills/testing-load-balancers/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/testing-load-balancers/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How testing-load-balancers Compares

Feature / Agenttesting-load-balancersStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Validate load balancer behavior, failover, and traffic distribution. Use when performing specialized testing. Trigger with phrases like "test load balancer", "validate failover", or "check traffic distribution".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Load Balancer Tester

## Overview

Validate load balancer behavior including traffic distribution algorithms, health check mechanisms, failover scenarios, session persistence, and SSL termination. Supports testing for NGINX, HAProxy, AWS ALB/NLB, GCP Load Balancers, and Kubernetes Ingress controllers.

## Prerequisites

- Load balancer deployed and accessible in a test environment
- Multiple backend instances running with identifiable responses (hostname headers)
- HTTP client tools (`curl`, `wrk`, `hey`, or `k6`) for sending test traffic
- Access to load balancer configuration and health check settings
- Ability to stop/start backend instances to simulate failures

## Instructions

1. Verify basic load balancer connectivity:
   - Send a request through the load balancer and confirm a backend response.
   - Check the response includes identifying headers (`X-Backend-Server`, `Server`) to determine which instance served the request.
   - Verify SSL/TLS termination works correctly (valid certificate, proper redirect from HTTP to HTTPS).
2. Test traffic distribution algorithm:
   - Send 100+ sequential requests and record which backend handled each.
   - For round-robin: verify even distribution across all backends (within 5% tolerance).
   - For least-connections: verify the least-loaded backend receives new requests.
   - For weighted: verify traffic ratio matches configured weights.
3. Validate health check behavior:
   - Stop one backend instance.
   - Verify the load balancer detects the failure within the configured health check interval.
   - Confirm subsequent requests are routed only to healthy backends (zero errors).
   - Restart the backend and verify it is returned to the pool after passing health checks.
4. Test failover scenarios:
   - Stop all backends except one and verify the remaining backend handles all traffic.
   - Stop all backends and verify the load balancer returns a 502 or 503 error (not hang).
   - Simulate slow backend responses and verify timeout behavior.
5. Validate session persistence (sticky sessions):
   - Send multiple requests with the same session cookie.
   - Verify all requests route to the same backend instance.
   - Verify a new session (no cookie) can route to any backend.
6. Test connection draining:
   - Start a long-running request, then remove the backend from the pool.
   - Verify the in-flight request completes successfully.
   - Verify new requests route to remaining backends.
7. Document all results with request/response evidence and timing data.

## Output

- Traffic distribution report showing request counts per backend instance
- Health check failover timeline with detection and recovery durations
- Session persistence validation results
- SSL/TLS certificate and configuration verification
- Load balancer behavior summary with pass/fail for each test scenario

## Error Handling

| Error | Cause | Solution |
|-------|-------|---------|
| All requests hit the same backend | Session affinity enabled unintentionally or DNS caching | Disable sticky sessions for distribution tests; use different source IPs; bypass DNS cache |
| Health check passes but backend is unhealthy | Health check endpoint does not reflect actual application health | Configure health checks to hit a deep endpoint that verifies database connectivity |
| 502 Bad Gateway during failover | Health check interval too long; load balancer still routing to failed backend | Reduce health check interval and failure threshold; verify deregistration delay settings |
| SSL certificate error | Certificate does not match domain or is expired | Verify certificate SAN entries; check expiration date; ensure full certificate chain is configured |
| Connection refused on backend port | Firewall or security group blocking load balancer to backend traffic | Verify security group rules allow traffic from load balancer subnet; check backend listen address |

## Examples

**Traffic distribution test with curl:**
```bash
#!/bin/bash
set -euo pipefail
declare -A counts
for i in $(seq 1 100); do
  backend=$(curl -s -H "Host: app.test.com" http://lb.test.com/health \
    | jq -r '.hostname')
  counts[$backend]=$(( ${counts[$backend]:-0} + 1 ))
done
echo "Traffic distribution:"
for backend in "${!counts[@]}"; do
  echo "  $backend: ${counts[$backend]} requests"
done
```

**Failover test sequence:**
```bash
set -euo pipefail
# 1. Verify both backends serve traffic
curl -s http://lb.test.com/health  # Backend A
curl -s http://lb.test.com/health  # Backend B

# 2. Stop Backend A
docker stop backend-a

# 3. Verify all traffic goes to Backend B (no errors)
for i in $(seq 1 10); do
  curl -sf http://lb.test.com/health || echo "FAIL: request $i"
done

# 4. Restart Backend A and verify it rejoins
docker start backend-a
sleep 10  # Wait for health check interval
curl -s http://lb.test.com/health  # Should see Backend A again
```

**k6 load test against load balancer:**
```javascript
import http from 'k6/http';
import { check } from 'k6';

export const options = { vus: 50, duration: '30s' };

export default function () {
  const res = http.get('http://lb.test.com/api/data');
  check(res, {
    'status is 200': (r) => r.status === 200,  # HTTP 200 OK
    'response time < 500ms': (r) => r.timings.duration < 500,  # HTTP 500 Internal Server Error
  });
}
```

## Resources

- NGINX load balancing: https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/
- HAProxy documentation: https://www.haproxy.org/download/2.9/doc/configuration.txt
- AWS ALB documentation: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/
- k6 load testing: https://grafana.com/docs/k6/latest/
- hey HTTP load generator: https://github.com/rakyll/hey

Related Skills

testing-visual-regression

1868
from jeremylongshore/claude-code-plugins-plus-skills

Detect visual changes in UI components using screenshot comparison. Use when detecting unintended UI changes or pixel differences. Trigger with phrases like "test visual changes", "compare screenshots", or "detect UI regressions".

performing-security-testing

1868
from jeremylongshore/claude-code-plugins-plus-skills

Test automate security vulnerability testing covering OWASP Top 10, SQL injection, XSS, CSRF, and authentication issues. Use when performing security assessments, penetration tests, or vulnerability scans. Trigger with phrases like "scan for vulnerabilities", "test security", or "run penetration test".

testing-mobile-apps

1868
from jeremylongshore/claude-code-plugins-plus-skills

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

testing-browser-compatibility

1868
from jeremylongshore/claude-code-plugins-plus-skills

Test across multiple browsers and devices for cross-browser compatibility. Use when ensuring cross-browser or device compatibility with BrowserStack, Sauce Labs, LambdaTest, or Kobiton. Trigger with phrases like "test browser compatibility", "check cross-browser", "validate on browsers", "test on real devices", "kobiton test".

automating-api-testing

1868
from jeremylongshore/claude-code-plugins-plus-skills

Test automate API endpoint testing including request generation, validation, and comprehensive test coverage for REST and GraphQL APIs. Use when testing API contracts, validating OpenAPI specifications, or ensuring endpoint reliability. Trigger with phrases like "test the API", "generate API tests", or "validate API contracts".

performing-penetration-testing

1868
from jeremylongshore/claude-code-plugins-plus-skills

Perform security testing on web applications, APIs, and codebases. Use when the user asks to "run a security scan", "check for vulnerabilities", "audit dependencies", "check security headers", "find security issues", "pentest", "security audit", or "scan for secrets". Trigger with "pentest", "security scan", "vulnerability check", "audit dependencies", "check headers", "find secrets".

windsurf-load-scale

1868
from jeremylongshore/claude-code-plugins-plus-skills

Scale Windsurf adoption across large organizations with workspace strategies and performance tuning. Use when rolling out Windsurf to 50+ developers, managing large monorepo workspaces, or planning enterprise-scale deployment. Trigger with phrases like "windsurf at scale", "windsurf large team", "windsurf monorepo", "windsurf organization", "windsurf 100 developers".

vercel-load-scale

1868
from jeremylongshore/claude-code-plugins-plus-skills

Load test and scale Vercel deployments with concurrency tuning and capacity planning. Use when running performance tests, planning for traffic spikes, or optimizing serverless function scaling on Vercel. Trigger with phrases like "vercel load test", "vercel scale", "vercel performance test", "vercel capacity", "vercel benchmark".

supabase-load-scale

1868
from jeremylongshore/claude-code-plugins-plus-skills

Scale Supabase projects for production load: read replicas, connection pooling tuning via Supavisor, compute size upgrades, CDN caching for Storage, Edge Function regional deployment, and database table partitioning. Use when preparing for traffic spikes, optimizing connection limits, setting up read replicas for analytics queries, or partitioning large tables. Trigger with phrases like "supabase scale", "supabase read replica", "supabase connection pooling", "supabase compute upgrade", "supabase CDN storage", "supabase edge function regions", "supabase partitioning", "supavisor", "supabase pool mode".

snowflake-load-scale

1868
from jeremylongshore/claude-code-plugins-plus-skills

Implement Snowflake load testing, warehouse scaling, and capacity planning. Use when testing query performance at scale, configuring multi-cluster warehouses, or planning capacity for production Snowflake workloads. Trigger with phrases like "snowflake load test", "snowflake scale", "snowflake capacity", "snowflake benchmark", "snowflake multi-cluster".

shopify-load-scale

1868
from jeremylongshore/claude-code-plugins-plus-skills

Load test Shopify integrations respecting API rate limits, plan capacity with k6, and scale for Shopify Plus burst events (flash sales, BFCM). Trigger with phrases like "shopify load test", "shopify scale", "shopify BFCM", "shopify flash sale", "shopify capacity", "shopify k6 test".

sentry-load-scale

1868
from jeremylongshore/claude-code-plugins-plus-skills

Scale Sentry for high-traffic applications handling millions of events per day. Use when optimizing SDK performance at high volume, implementing adaptive sampling, managing quotas and costs at scale, or deploying Sentry across multi-region infrastructure. Trigger with phrases like "sentry high traffic", "scale sentry", "sentry millions events", "sentry high volume", "sentry quota management", "sentry load test".