testing-load-balancers

0
0
Source

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".

Install

mkdir -p .claude/skills/testing-load-balancers && curl -L -o skill.zip "https://mcp.directory/api/skills/download/8518" && unzip -o skill.zip -d .claude/skills/testing-load-balancers && rm skill.zip

Installs to .claude/skills/testing-load-balancers

About this skill

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

ErrorCauseSolution
All requests hit the same backendSession affinity enabled unintentionally or DNS cachingDisable sticky sessions for distribution tests; use different source IPs; bypass DNS cache
Health check passes but backend is unhealthyHealth check endpoint does not reflect actual application healthConfigure health checks to hit a deep endpoint that verifies database connectivity
502 Bad Gateway during failoverHealth check interval too long; load balancer still routing to failed backendReduce health check interval and failure threshold; verify deregistration delay settings
SSL certificate errorCertificate does not match domain or is expiredVerify certificate SAN entries; check expiration date; ensure full certificate chain is configured
Connection refused on backend portFirewall or security group blocking load balancer to backend trafficVerify security group rules allow traffic from load balancer subnet; check backend listen address

Examples

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
  });
}

Resources

svg-icon-generator

jeremylongshore

Svg Icon Generator - Auto-activating skill for Visual Content. Triggers on: svg icon generator, svg icon generator Part of the Visual Content skill category.

8227

d2-diagram-creator

jeremylongshore

D2 Diagram Creator - Auto-activating skill for Visual Content. Triggers on: d2 diagram creator, d2 diagram creator Part of the Visual Content skill category.

4926

automating-mobile-app-testing

jeremylongshore

This skill enables automated testing of mobile applications on iOS and Android platforms using frameworks like Appium, Detox, XCUITest, and Espresso. It generates end-to-end tests, sets up page object models, and handles platform-specific elements. Use this skill when the user requests mobile app testing, test automation for iOS or Android, or needs assistance with setting up device farms and simulators. The skill is triggered by terms like "mobile testing", "appium", "detox", "xcuitest", "espresso", "android test", "ios test".

14217

performing-penetration-testing

jeremylongshore

This skill enables automated penetration testing of web applications. It uses the penetration-tester plugin to identify vulnerabilities, including OWASP Top 10 threats, and suggests exploitation techniques. Use this skill when the user requests a "penetration test", "pentest", "vulnerability assessment", or asks to "exploit" a web application. It provides comprehensive reporting on identified security flaws.

4615

designing-database-schemas

jeremylongshore

Design and visualize efficient database schemas, normalize data, map relationships, and generate ERD diagrams and SQL statements.

11514

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

11410

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

1,1421,171

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

969933

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

683829

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

691549

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

797540

pdf-to-markdown

aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.

697374

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.