Skill

Design and Execute Stress Test Scenarios

Designs stress test scenarios across volume, load, memory, CPU, I/O, concurrency and resource depletion, with runnable examples per category.

Works with githubkubernetes

Maintainer of this project? Claim this page to edit the listing.


78
Spark score
out of 100
Updated 10 days ago
Version 1.0.0
Models

Add to Favorites

Why it matters

Design and implement comprehensive stress test scenarios to identify application breaking points, performance bottlenecks, and failure modes under extreme conditions.

Outcomes

What it gets done

01

Create volume, load, memory, CPU, I/O, concurrency, and resource depletion stress tests.

02

Establish baseline performance, identify breaking points, and test system recovery.

03

Analyze cascading failures and monitor key system and application metrics.

04

Simulate infrastructure stress scenarios like Kubernetes resource limits and network partitions.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-stress-test-scenario | bash

Overview

Stress Test Scenario Designer

A skill for designing stress test scenarios across volume, load, memory, CPU, I/O, concurrency, and resource depletion, with runnable JMeter, Python, SQL, Kubernetes, and network chaos-engineering examples plus a monitoring metrics dashboard. Use it when designing a stress test for a specific failure mode with concrete thresholds and monitoring, applying stress gradually in an isolated test environment and verifying recovery afterward.

What it does

This skill designs comprehensive stress test scenarios for applications, systems, and infrastructure, aiming to reveal breaking points, performance bottlenecks, and failure modes under extreme conditions. It defines seven test categories - volume stress (maximum data volumes), load stress (beyond normal user capacity), memory stress (allocation limits and garbage collection), CPU stress (computationally intensive operations), I/O stress (disk/network/database throughput limits), concurrency stress (thread safety and race conditions), and resource depletion (behavior when resources are exhausted) - and a five-step design framework: establish a baseline of normal operating parameters, identify the breaking point (maximum sustainable load), test recovery behavior after stress is removed, analyze cascading failure impact on dependent systems, and monitor CPU/memory/I/O/network metrics throughout.

stress_scenario:
  name: "Progressive API Load Test"
  duration: 30m
  stages:
    - users: 100, duration: 5m    # Warm-up
    - users: 500, duration: 10m   # Normal load
    - users: 2000, duration: 10m  # Stress load
    - users: 5000, duration: 3m   # Peak stress
    - users: 100, duration: 2m    # Recovery
  
  success_criteria:
    response_time_p95: < 2000ms
    error_rate: < 5%
    system_recovery: < 60s

It gives concrete scenario templates per stress type: a JMeter-style progressive load plan (as above, warm-up through peak stress and recovery, with p95 response time, error rate, and recovery-time success criteria); a Python memory-exhaustion test that progressively allocates chunks (e.g. 100MB at a time) while monitoring psutil memory/CPU usage and halting at a critical threshold (95% memory used); a SQL Server script that exhausts the connection pool by holding long-running cross-join queries open for a fixed duration up to a max connection count; a Kubernetes Job manifest using the polinux/stress image to apply CPU, I/O, and memory worker load with defined resource requests/limits and a timeout; and a chaos-engineering bash script using tc qdisc to simulate network latency, packet loss, and bandwidth limitation while polling application response time, with cleanup to remove the simulated conditions afterward.

For monitoring it defines a metrics dashboard structure covering system metrics (CPU utilization, memory usage, disk I/O ops/sec, network throughput) and application metrics (p95 response time, error rate, active connections, queue depth, GC frequency), each with critical thresholds (e.g. CPU at 90%, memory at 85%, response time at 5000ms, error rate at 10%).

When to use - and when NOT to

Use it when designing a stress test for a specific failure mode - load capacity, memory exhaustion, database connection limits, CPU/IO saturation, or network degradation - and when you need concrete thresholds and monitoring metrics to define success/failure criteria, not just an ad hoc load spike.

Best practices to follow: use dedicated test environments that mirror production, implement circuit breakers to prevent cascading failures, monitor downstream dependencies during the test, and document baseline metrics beforehand. Apply stress gradually - start around 2x normal load and increase incrementally, allow stabilization between increases, isolate one component at a time, and include realistic user behavior with think times. Afterward, verify recovery to baseline, check data integrity, confirm no memory leaks or resource cleanup issues remain, and document exact test conditions, observed breaking points and failure modes, and runbooks for the failure scenarios found, on a regular schedule aligned with releases.

Inputs and outputs

Input is the system or component to stress test and the failure mode of interest (volume, load, memory, CPU, I/O, concurrency, or resource depletion). Output is a runnable stress test scenario in the appropriate tool/language - a JMeter-style load plan, a Python memory-stress script, a SQL connection-exhaustion script, a Kubernetes stress Job, or a tc-based network chaos script - paired with a monitoring dashboard definition and defined success/failure thresholds.

Who it's for

SREs, performance engineers, and infrastructure teams who need to design and run realistic stress tests to find system breaking points before production incidents do, across application, database, and infrastructure layers.

Source README

Stress Test Scenario Designer

You are an expert in designing and implementing comprehensive stress test scenarios for applications, systems, and infrastructure. You specialize in creating realistic, high-impact test scenarios that reveal system breaking points, performance bottlenecks, and failure modes under extreme conditions.

Core Stress Testing Principles

Test Categories

  • Volume Stress: Testing with maximum expected data volumes
  • Load Stress: Testing beyond normal user capacity
  • Memory Stress: Testing memory allocation limits and garbage collection
  • CPU Stress: Testing computational intensive operations
  • I/O Stress: Testing disk, network, and database throughput limits
  • Concurrency Stress: Testing thread safety and race conditions
  • Resource Depletion: Testing behavior when resources are exhausted

Stress Test Design Framework

  1. Baseline Establishment: Normal operating parameters
  2. Breaking Point Identification: Maximum sustainable load
  3. Recovery Testing: System behavior after stress removal
  4. Cascading Failure Analysis: Impact on dependent systems
  5. Resource Monitoring: CPU, memory, I/O, network metrics

Scenario Design Patterns

Progressive Load Pattern

### JMeter Test Plan Example
stress_scenario:
  name: "Progressive API Load Test"
  duration: 30m
  stages:
    - users: 100, duration: 5m    # Warm-up
    - users: 500, duration: 10m   # Normal load
    - users: 2000, duration: 10m  # Stress load
    - users: 5000, duration: 3m   # Peak stress
    - users: 100, duration: 2m    # Recovery
  
  success_criteria:
    response_time_p95: < 2000ms
    error_rate: < 5%
    system_recovery: < 60s

Memory Exhaustion Scenario

### Python stress test for memory leaks
import psutil
import threading
import time

class MemoryStressTest:
    def __init__(self, target_memory_gb=8):
        self.target_memory = target_memory_gb * 1024 * 1024 * 1024
        self.memory_hogs = []
        self.monitoring = True
    
    def allocate_memory_chunks(self):
        """Progressively allocate memory to stress test garbage collection"""
        chunk_size = 100 * 1024 * 1024  # 100MB chunks
        
        while psutil.virtual_memory().available > self.target_memory:
            try:
                chunk = bytearray(chunk_size)
                self.memory_hogs.append(chunk)
                time.sleep(0.1)
            except MemoryError:
                break
    
    def monitor_system_metrics(self):
        """Monitor system performance during stress test"""
        while self.monitoring:
            memory = psutil.virtual_memory()
            cpu = psutil.cpu_percent(interval=1)
            
            print(f"Memory: {memory.percent}% | Available: {memory.available // 1024**3}GB | CPU: {cpu}%")
            
            if memory.percent > 95:
                print("CRITICAL: Memory usage exceeded 95%")
                break

Database Connection Pool Exhaustion

-- SQL Server stress test scenario
DECLARE @ConnectionCount INT = 0;
DECLARE @MaxConnections INT = 1000;

WHILE @ConnectionCount < @MaxConnections
BEGIN
    BEGIN TRY
        -- Simulate long-running queries that hold connections
        SELECT TOP 1000000 
            a.column1, b.column2, c.column3
        FROM large_table a
        CROSS JOIN large_table b
        CROSS JOIN large_table c
        WHERE a.date_field BETWEEN DATEADD(day, -30, GETDATE()) AND GETDATE()
        ORDER BY NEWID();
        
        SET @ConnectionCount = @ConnectionCount + 1;
        WAITFOR DELAY '00:00:30'; -- Hold connection for 30 seconds
    END TRY
    BEGIN CATCH
        PRINT 'Connection limit reached at: ' + CAST(@ConnectionCount AS VARCHAR(10));
        BREAK;
    END CATCH
END

Infrastructure Stress Scenarios

Kubernetes Pod Resource Limits

apiVersion: batch/v1
kind: Job
metadata:
  name: cpu-stress-test
spec:
  template:
    spec:
      containers:
      - name: cpu-stress
        image: polinux/stress
        resources:
          requests:
            memory: "1Gi"
            cpu: "500m"
          limits:
            memory: "2Gi"
            cpu: "2000m"
        command: ["stress"]
        args:
          - "--cpu"
          - "4"              # 4 CPU workers
          - "--io"
          - "2"              # 2 I/O workers
          - "--vm"
          - "2"              # 2 memory workers
          - "--vm-bytes"
          - "1G"             # 1GB per memory worker
          - "--timeout"
          - "300s"           # Run for 5 minutes
      restartPolicy: Never

Network Partition Simulation

#!/bin/bash
### Chaos engineering script for network stress testing

### Simulate high latency
sudo tc qdisc add dev eth0 root netem delay 1000ms 200ms distribution normal

### Simulate packet loss
sudo tc qdisc change dev eth0 root netem loss 5% 25%

### Simulate bandwidth limitation
sudo tc qdisc add dev eth0 root tbf rate 1mbit burst 32kbit latency 400ms

### Monitor application behavior during network stress
while true; do
    curl -w "Response Time: %{time_total}s\n" -o /dev/null -s http://your-app/health
    sleep 5
done

### Cleanup after test
sudo tc qdisc del dev eth0 root

Monitoring and Alerting

Key Metrics Dashboard

{
  "stress_test_metrics": {
    "system_metrics": [
      "cpu_utilization_percent",
      "memory_usage_percent",
      "disk_io_operations_per_second",
      "network_throughput_mbps"
    ],
    "application_metrics": [
      "response_time_p95_ms",
      "error_rate_percent",
      "active_connections",
      "queue_depth",
      "garbage_collection_frequency"
    ],
    "thresholds": {
      "cpu_critical": 90,
      "memory_critical": 85,
      "response_time_critical": 5000,
      "error_rate_critical": 10
    }
  }
}

Best Practices

Test Environment Isolation

  • Use dedicated test environments that mirror production
  • Implement circuit breakers to prevent cascade failures
  • Monitor downstream dependencies during stress tests
  • Document baseline performance metrics before testing

Gradual Stress Application

  • Start with 2x normal load, then increase incrementally
  • Allow system stabilization between load increases
  • Test one component at a time to isolate failure points
  • Include realistic user behavior patterns and think times

Recovery and Cleanup

  • Test system recovery after stress removal
  • Verify data integrity post-stress test
  • Check for memory leaks and resource cleanup
  • Validate that all services return to baseline performance

Documentation

  • Record exact test conditions and configurations
  • Document breaking points and failure modes observed
  • Create runbooks for identified failure scenarios
  • Establish regular stress testing schedules aligned with releases

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.