跳到正文
cccskills
免费在 GitHub 公开

load-test-scenario-builder

Creates comprehensive load test plans with realistic scenarios, traffic models, k6 scripts, and success criteria. Use for "load testing", "performance testing", "capacity validation", or "stress testing".

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md5.6 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Load Test Scenario Builder

Validate system capacity with realistic load tests.

Load Test Scenarios

interface LoadTestScenario {
  name: string;
  description: string;
  virtualUsers: number;
  duration: string;
  rampUp: string;
  successCriteria: {
    p95Latency: number;
    errorRate: number;
    throughput: number;
  };
}

const scenarios: LoadTestScenario[] = [
  {
    name: "Baseline Load",
    description: "Normal traffic pattern",
    virtualUsers: 100,
    duration: "10m",
    rampUp: "2m",
    successCriteria: {
      p95Latency: 500, // ms
      errorRate: 0.01, // 1%
      throughput: 1000, // req/s
    },
  },
  {
    name: "Peak Load",
    description: "Black Friday traffic",
    virtualUsers: 1000,
    duration: "30m",
    rampUp: "5m",
    successCriteria: {
      p95Latency: 2000,
      errorRate: 0.05,
      throughput: 5000,
    },
  },
  {
    name: "Stress Test",
    description: "Find breaking point",
    virtualUsers: 5000,
    duration: "20m",
    rampUp: "10m",
    successCriteria: {
      p95Latency: 5000,
      errorRate: 0.1,
      throughput: 10000,
    },
  },
];

K6 Load Test Script

// load-tests/checkout-flow.js
import http from "k6/http";
import { check, sleep } from "k6";
import { Rate } from "k6/metrics";

const errorRate = new Rate("errors");

export let options = {
  stages: [
    { duration: "2m", target: 100 }, // Ramp up
    { duration: "10m", target: 100 }, // Stay at 100
    { duration: "2m", target: 0 }, // Ramp down
  ],
  thresholds: {
    http_req_duration: ["p(95)<500"], // 95% under 500ms
    errors: ["rate<0.01"], // Error rate <1%
  },
};

export default function () {
  // 1. Browse products
  let browseRes = http.get("https://api.example.com/products");
  check(browseRes, {
    "browse status 200": (r) => r.status === 200,
  }) || errorRate.add(1);
  sleep(1);

  // 2. Add to cart
  let addCartRes = http.post(
    "https://api.example.com/cart",
    JSON.stringify({
      productId: "123",
      quantity: 1,
    }),
    {
      headers: { "Content-Type": "application/json" },
    }
  );
  check(addCartRes, {
    "add cart status 201": (r) => r.status === 201,
  }) || errorRate.add(1);
  sleep(2);

  // 3. Checkout
  let checkoutRes = http.post(
    "https://api.example.com/checkout",
    JSON.stringify({
      paymentMethod: "card",
    }),
    {
      headers: { "Content-Type": "application/json" },
    }
  );
  check(checkoutRes, {
    "checkout status 200": (r) => r.status === 200,
    "checkout success": (r) => r.json("status") === "success",
  }) || errorRate.add(1);
  sleep(3);
}

Traffic Models

// Realistic traffic patterns
export const trafficModels = {
  // Steady state
  steadyState: {
    stages: [{ duration: "30m", target: 500 }],
  },

  // Gradual ramp
  gradualRamp: {
    stages: [
      { duration: "5m", target: 100 },
      { duration: "5m", target: 300 },
      { duration: "5m", target: 500 },
      { duration: "10m", target: 500 },
      { duration: "5m", target: 0 },
    ],
  },

  // Spike test
  spikeTest: {
    stages: [
      { duration: "2m", target: 100 },
      { duration: "1m", target: 2000 }, // Sudden spike
      { duration: "2m", target: 100 },
    ],
  },

  // Soak test (endurance)
  soakTest: {
    stages: [
      { duration: "5m", target: 500 },
      { duration: "4h", target: 500 }, // Long duration
      { duration: "5m", target: 0 },
    ],
  },
};

Success Thresholds

export const thresholds = {
  // Latency
  http_req_duration: [
    "p(50)<200", // 50% under 200ms
    "p(95)<500", // 95% under 500ms
    "p(99)<1000", // 99% under 1s
  ],

  // Error rate
  http_req_failed: ["rate<0.01"], // <1% errors

  // Throughput
  http_reqs: ["rate>1000"], // >1000 req/s

  // Custom metrics
  checkout_duration: ["p(95)<2000"],
  checkout_success_rate: ["rate>0.95"],
};

Running Load Tests

#!/bin/bash
# scripts/run-load-tests.sh

echo "Running load tests..."

# Baseline test
k6 run --vus 100 --duration 10m load-tests/checkout-flow.js

# Peak load test
k6 run --vus 1000 --duration 30m load-tests/checkout-flow.js

# Stress test (find breaking point)
k6 run --vus 5000 --duration 20m load-tests/stress-test.js

# Generate report
k6 run --out json=results.json load-tests/checkout-flow.js
k6 run --out influxdb=http://localhost:8086 load-tests/checkout-flow.js

Result Analysis

interface LoadTestResult {
  scenario: string;
  timestamp: Date;
  metrics: {
    p50Latency: number;
    p95Latency: number;
    p99Latency: number;
    errorRate: number;
    throughput: number;
    maxVUs: number;
  };
  passed: boolean;
  notes: string[];
}

function analyzeResults(results: LoadTestResult) {
  console.log(\`Load Test: \${results.scenario}\`);
  console.log(\`Status: \${results.passed ? '✅ PASS' : '❌ FAIL'}\`);
  console.log(\`p95 Latency: \${results.metrics.p95Latency}ms\`);
  console.log(\`Error Rate: \${(results.metrics.errorRate * 100).toFixed(2)}%\`);
  console.log(\`Throughput: \${results.metrics.throughput} req/s\`);

  if (!results.passed) {
    console.log('Failed criteria:');
    results.notes.forEach(note => console.log(\`  - \${note}\`));
  }
}

Output Checklist

  • Scenarios defined
  • k6 scripts created
  • Traffic models configured
  • Success criteria set
  • CI integration
  • Results analysis ENDFILE

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Audits and implements web accessibility (a11y) following WCAG 2.1 guidelines with ARIA patterns, keyboard navigation, screen reader support, and contrast checking. Use when users request "accessibility audit", "a11y review", "WCAG compliance", "screen reader support", or "keyboard navigation".

中文简介正在准备中。当前显示原文说明。

sathishssj3/Stereix-Engine22026年10月4日 更新

Creates Architecture Decision Records documenting key technical decisions with context, alternatives considered, tradeoffs, consequences, and decision owners. Use when documenting "architecture decisions", "technical choices", "design decisions", or "ADRs".

中文简介正在准备中。当前显示原文说明。

sathishssj3/Stereix-Engine22026年10月4日 更新

Designs multi-step agent workflows with tool usage, retry logic, state management, and budget controls. Provides orchestration diagrams, tool execution order, fallback strategies, and cost limits. Use for "AI agents", "agentic workflows", "multi-step AI", or "autonomous systems".

中文简介正在准备中。当前显示原文说明。

sathishssj3/Stereix-Engine22026年10月4日 更新

MUST USE when user wants to 调研/research/搜索/search/查/找/look up anything on the internet — e.g. 全网调研 X / 帮我调研一下 X / 查一下 X / 搜搜 X / 看看大家怎么评价 X / X 上有什么讨论 / research this topic。 Also MUST USE when user mentions any platform or shares any URL/链接: 小红书/xiaohongshu/xhs, Twitter/推特/X, B站/bilibili, Reddit, Facebook, Instagram, V2EX, LinkedIn/领英/招聘/求职/jobs, YouTube, GitHub code search, 小宇宙播客, 雪球/股票行情, RSS feeds, or any web URL. 15 platforms, multi-backend routing (OpenCLI / per-platform CLIs / APIs). Zero config for 6 channels. Run `agent-reach doctor --json` to see which backend serves each platform right now. NOT for: 写报告/数据分析/翻译等内容加工(本 skill 只负责从互联网获取内容); 发帖/评论/点赞等写操作;已有专门 skill 的平台(先用专门 skill)。 【路由方式】SKILL.md 包含路由表和常用命令,复杂场景需按需阅读对应分类的 references/*.md。 分类:search / social (小红书/推特/B站/V2EX/Reddit/Facebook/Instagram) / career(LinkedIn) / dev(github) / web(网页/文章/RSS) / video(YouTube/B站/播客) / finance(雪球/股票)。

中文简介正在准备中。当前显示原文说明。

sathishssj3/Stereix-Engine22026年10月4日 更新

Orchestrates multi-agent AI systems with task delegation, agent communication, shared memory, and workflow coordination. Use when users request "multi-agent system", "agent orchestration", "AI agents", "agent coordination", or "autonomous agents".

中文简介正在准备中。当前显示原文说明。

sathishssj3/Stereix-Engine22026年10月4日 更新

Creates SLO-based alerts and operational dashboards with key charts, alert thresholds, and runbook links. Use for "alerting", "dashboards", "SLO", or "monitoring".

中文简介正在准备中。当前显示原文说明。

sathishssj3/Stereix-Engine22026年10月4日 更新

查看 sathishssj3 的全部技能

报告此技能的问题