plan-capacity-from-load-data
Use when sizing infrastructure for expected traffic. Derives required replicas from measured p95 throughput and latency, leaving explicit headroom over the saturation point.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- plan-capacity-from-load-data
- description
- Use when sizing infrastructure for expected traffic. Derives required replicas from measured p95 throughput and latency, leaving explicit headroom over the saturation point.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md354 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Plan Capacity from Load Data
Capacity plans built on averages fail at the p99. Size from the worst realistic peak latency, the throughput one instance sustains before saturation, and an explicit headroom factor.
Procedure
- Measure per-instance saturation throughput: the requests per second at which p99 latency starts climbing. Ramp with
k6 run --vus 50 --duration 2m script.jsand plot RPS vs p99 — the knee is your ceiling, not the peak RPS you reached. - Take the load model from real data, not a guess: peak RPS from access logs over 7 days, e.g.
awk '{print $4}' access.log | cut -c2-15 | sort | uniq -c | sort -rn | head. - Apply Little's Law to check concurrency:
concurrency = RPS × latency. 500 RPS at 40 ms needs ~20 in-flight requests per instance. - Compute replicas:
replicas = ceil(peak_RPS / per_instance_RPS / (1 - headroom)). Use headroom 0.3 for steady services, 0.5 for spiky ones so a lost instance or a rolling deploy is survivable. - Add N+1 for failure: a service that must tolerate one instance down sizes to
replicas + 1per zone if failures are zone-scoped. - Test the plan:
k6 run --vus <planned> --duration 10magainst the planned fleet size and confirm p99 stays under the SLO at peak × 1.3. - Set autoscaling on the leading indicator (RPS, queue depth, CPU at ~70%) with a scale-up cooldown shorter than the traffic ramp, and a floor that survives a zone loss.
- Record the assumptions (per-instance RPS, headroom, SLO) in a doc — a capacity number without its inputs cannot be revisited.
Pitfalls
- Sizing on average latency; the p99 drives timeouts and retries, which multiply load.
- Ignoring retry amplification: a client retrying 3× turns a 20% overload into 60%.
- Autoscaling on CPU for I/O-bound work never triggers; scale on concurrency or queue length instead.
- A load test from one region does not exercise the cross-region latency real users see.
- Forgetting the database: app replicas scale horizontally, one primary does not, so the DB becomes the ceiling.
- Cold start and connection-pool warmup make the first minute after scale-out slower than steady state; factor it into the ramp.
- A capacity plan without a cost line is half a plan; multiply replica count by instance price per hour before committing.
Verification
k6 run --out json=result.json --vus <n> --duration 10m load.js && \
jq '[.metrics.http_req_duration.values["p(99)"]][0]' result.json
p99 stays below the SLO threshold at 130% of forecast peak with one instance removed.
Report: "Per instance <N> RPS before the p99 knee; peak <P> RPS → <R> replicas at 30% headroom; verified p99 <X>ms at 1.3× peak with a faulted instance."
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.