brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
testing-load-balancersValidate 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".
Independent GitHub snapshot · Automated classification · Original documentation governs
name: testing-load-balancers description: '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".
' allowed-tools: Read, Write, Edit, Grep, Glob, Bash(test:loadbalancer-*) version: 1.21.0 author: Jeremy Longshore jeremy@intentsolutions.io license: MIT tags:
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.
curl, wrk, hey, or k6) for sending test trafficX-Backend-Server, Server) to determine which instance served the request.| 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 |
Traffic distribution test with curl:
#!/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:
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:
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
});
}