felix-montanari
作者:felix-montanari更新於 2026-06-29@clawhub_felix-montanari/wrk
測試生成指令碼工具

據 AlphaMoat 統計,截至 2026-10,wrk 累計下載 10,153 次、獲 0 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 2,685 位,在「開發程式設計」分類(1,069 個)中排名第 207 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
1萬
星標
-
全站下載量排名
#2,685
全站前 25% · 「開發程式設計」前 20%
平台累計下載星標評論
ClawHub ↗9821--
SkillHub ↗1萬-—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

使用 wrk 進行 HTTP 負載測試,支援 Lua 指令碼實現動態請求頭,如隨機 X-Forwarded-For IP。

月度資料趨勢

累計下載1萬
980099901萬2026-09 · 累計下載 98262026-10 · 累計下載 1萬26-0926-10
星標-
0112026-09 · 星標 -2026-10 · 星標 -26-0926-10
月份累計下載環比星標
2026-101萬—-
2026-099826—-

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-11-20。

7.5 KB · ClawHub v1.0.0
---
name: wrk
description: Use wrk for HTTP load testing, including Lua scripting for dynamic request headers such as randomized X-Forwarded-For IPs.
version: 1.0.0
metadata:
  openclaw:
    requires:
      bins:
        - wrk
    install:
展開全部(共 231 行)
      - kind: brew
        formula: wrk
        bins: [wrk]
    emoji: "⚡"
---

# wrk Load Testing Skill

Use this skill when a user wants to run, design, or interpret HTTP load tests with [`wrk`](https://github.com/wg/wrk), especially when they need realistic request generation through Lua scripting.

`wrk` is a high-performance HTTP benchmarking tool. It can generate substantial load from a single machine by combining multiple threads, persistent connections, and an event-driven architecture. It is best suited for controlled testing of services the user is authorized to assess.

## Safety and scope

Before helping with a load test:

1. Confirm the target is authorized for load testing.
2. Prefer local, dev, staging, sandbox, or explicitly approved performance-test environments.
3. Warn the user before suggesting settings that may be disruptive, such as very high connection counts, long durations, or tests against production.
4. Start small and scale gradually while watching service health, logs, autoscaling, rate limits, and downstream dependencies.

Avoid recommending uncontrolled tests against third-party systems or production endpoints without explicit authorization.

## Basic `wrk` command pattern

```bash
wrk -t4 -c100 -d30s https://example.internal/health
```

Common options:

- `-t`: number of threads.
- `-c`: number of open connections.
- `-d`: test duration, such as `30s`, `2m`, or `10m`.
- `-s`: Lua script file for custom request behavior.
- `--latency`: include latency distribution statistics.
- `-H`: add a static header to every request.

Example with latency reporting:

```bash
wrk -t4 -c100 -d60s --latency https://example.internal/api/v1/items
```

Example with a static header:

```bash
wrk -t4 -c100 -d60s \
  -H 'Authorization: Bearer test-token' \
  -H 'Accept: application/json' \
  https://example.internal/api/v1/items
```

## Lua scripting with `wrk`

Use Lua when requests need dynamic headers, randomized inputs, multiple paths, request bodies, or per-request behavior.

A Lua script can define functions such as:

- `setup(thread)`: called once per thread before the test starts.
- `init(args)`: called when a thread initializes.
- `request()`: returns the HTTP request to send.
- `response(status, headers, body)`: called for each response.
- `done(summary, latency, requests)`: called after the benchmark finishes.

## Example: random `X-Forwarded-For` IP per request

Create a file named `random_xff.lua`:

```lua
-- random_xff.lua
-- Sends each request with a randomized X-Forwarded-For IPv4 address.

local counter = 0

local function random_octet(min, max)
  return math.random(min, max)
end

local function random_public_ipv4()
  -- Avoid common private, loopback, link-local, multicast, and reserved ranges
  -- by choosing from documentation-safe-ish public-looking ranges for testing.
  -- Adjust this for your environment if specific source ranges are required.
  local first_octets = { 8, 23, 34, 44, 52, 63, 74, 96, 104, 128, 137, 150, 172, 198 }
  local first = first_octets[math.random(#first_octets)]

  -- Avoid 172.16.0.0/12 when first octet is 172.
  local second
  if first == 172 then
    local allowed = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 32, 64, 96, 128, 160, 192, 224 }
    second = allowed[math.random(#allowed)]
  else
    second = random_octet(0, 255)
  end

  return string.format(
    "%d.%d.%d.%d",
    first,
    second,
    random_octet(0, 255),
    random_octet(1, 254)
  )
end

request = function()
  counter = counter + 1

  -- Seed periodically with time plus a per-thread counter. wrk runs Lua per thread,
  -- so this keeps sequences from being identical for long-running tests.
  if counter == 1 then
    math.randomseed(os.time() + counter)
  end

  local ip = random_public_ipv4()
  local headers = {
    ["X-Forwarded-For"] = ip,
    ["X-Real-IP"] = ip,
    ["Accept"] = "application/json",
    ["User-Agent"] = "wrk-random-xff/1.0"
  }

  return wrk.format("GET", nil, headers)
end
```

Run it with:

```bash
wrk -t4 -c100 -d60s --latency -s random_xff.lua https://example.internal/api/v1/items
```

## Example: POST JSON with random `X-Forwarded-For`

```lua
-- post_random_xff.lua

local function random_public_ipv4()
  local first_octets = { 8, 23, 34, 44, 52, 63, 74, 96, 104, 128, 137, 150, 198 }
  return string.format(
    "%d.%d.%d.%d",
    first_octets[math.random(#first_octets)],
    math.random(0, 255),
    math.random(0, 255),
    math.random(1, 254)
  )
end

init = function(args)
  math.randomseed(os.time())
end

request = function()
  local ip = random_public_ipv4()
  local body = string.format('{"requestId":"wrk-%d","sourceIp":"%s"}', math.random(1000000000), ip)

  local headers = {
    ["Content-Type"] = "application/json",
    ["Accept"] = "application/json",
    ["X-Forwarded-For"] = ip
  }

  return wrk.format("POST", "/api/v1/events", headers, body)
end
```

Run it with a base URL; the path comes from the Lua script:

```bash
wrk -t4 -c100 -d60s --latency -s post_random_xff.lua https://example.internal
```

## Choosing safe starting parameters

For initial validation, suggest conservative values:

```bash
wrk -t2 -c20 -d30s --latency https://example.internal/health
```

Then increase gradually:

```bash
wrk -t4 -c100 -d2m --latency https://example.internal/api/v1/items
wrk -t8 -c500 -d5m --latency https://example.internal/api/v1/items
```

Only recommend higher values after confirming the environment, service capacity, downstream dependencies, and monitoring coverage.

## Interpreting output

Important fields:

- `Requests/sec`: approximate throughput achieved by the client.
- `Latency`: average, standard deviation, max, and distribution if `--latency` is used.
- `Socket errors`: connection, read, write, or timeout failures; these often indicate saturation, network issues, or server-side limits.
- `Non-2xx or 3xx responses`: application errors, authorization failures, rate limits, or expected negative responses depending on the test.
- `Transfer/sec`: response bandwidth observed by the client.

When results look suspicious, check whether the bottleneck is the client machine, network path, proxy/load balancer, service, database, cache, or downstream dependency.

## Useful investigation checklist

When helping an agent run or analyze `wrk` tests, gather:

- Target URL and method.
- Environment: local, dev, staging, production, or approved external target.
- Desired traffic shape: threads, connections, duration, ramp-up strategy if any.
- Headers, authentication, cookies, tenant IDs, or feature flags needed.
- Whether randomized `X-Forwarded-For` is safe and meaningful in that environment.
- Expected status codes and response-size profile.
- Monitoring links, logs, dashboards, and alert thresholds.
- Known rate limits, WAF rules, bot protection, CDN behavior, and load balancer behavior.

## Common pitfalls

- `wrk` does not model browser behavior, JavaScript, or full user journeys.
- Very high connection counts can exhaust client resources before the service is saturated.
- Randomizing `X-Forwarded-For` may bypass or invalidate IP-based aggregation in logs, dashboards, caches, rate limiters, or abuse controls; use only when this is the intended authorized test.
- Some proxies overwrite or append to `X-Forwarded-For`; verify what the application actually receives.
- Production tests can be disruptive even with moderate settings if they hit expensive endpoints or shared dependencies.

「開發程式設計」分類下的熱門技能

程式設計大神.Skill開發程式設計

【全棧能力】程式設計大神.Skill:面向複雜真實專案的高階全棧程式設計助手。不止生成程式碼,而是從一句目標接手陌生程式碼庫,拆解需求、補齊實現、追到根因、完成重構、聯調前後端,並把結果推進到能執行、能驗證、能交付。覆蓋 Web、後端、指令碼、iOS、安卓、鴻蒙 ArkUI、微信小程式及其他技術棧,支援中英文工程、疑難 Bug、跨模組任務和長任務續做;用構建、日誌、真實入口、裝置或介面證據說明結果。僅問概念時直接回答,要求落地時持續推進到驗收或明確阻塞。

↓ 1125.9萬★ 82u_42bbb65f
程式設計專家Pro.Skill開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 626.9萬★ 32user_47d655f0
程式設計專家.Skill開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 600.7萬★ 378user_741dc82b
dev-expert開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 528.1萬★ 32user_814dbe54
dev-expert-pro開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 104.7萬★ -user_814dbe54
程式設計專家 Pro開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 98.2萬★ 1user_28275a78
程式設計專家.Skill開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 70.1萬★ 6user_613b33ea
Github開發程式設計

用 gh 命令列工具檢視 GitHub 上的 PR 檢查、工作流執行與 API 查詢的技能。

↓ 48萬★ 714Peter Steinberger

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。