AI streaming performance
Measures responsiveness, cancellation, rate limits and cost across streamed model responses and multi-step agent runs.
ai-streaming-performance
See how it helpsWhen is it useful?
Use when AI responses appear frozen or concurrent sessions increase latency and spending.
What does it help you do?
- Separates repeatable simulated load tests from bounded live-provider measurements.
- Measures first meaningful output, gaps between chunks and total workflow latency.
- Checks cancellation cleanup, retry behavior, token accounting and growing context.
Try asking this
Load-test our streamed assistant with a replay provider, then propose a bounded live check for latency and cancellation. Cancel half the simulated streams midway. Confirm worker cleanup and show latency percentiles separately for completed requests and interrupted ones.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
AI & Streaming Performance
When to Use
Use when load testing or benchmarking LLM-powered endpoints, SSE/WebSocket streaming responses, multi-step AI agent runtimes, vector search / RAG pipelines, or tool-calling workflows.
Separate Simulated Provider Load from Live Model Calls
Live LLM calls are slow, non-deterministic, rate-limited, and expensive. Always separate AI performance testing into two distinct modes:
- Deterministic Mock / Replay Upstream Mode (Gateway & Runtime Stress):
- Use a local mock LLM server that simulates realistic Time to First Token (TTFT) (e.g.,
300ms–1500ms), Inter-Token Latency (ITL / TPOT) (e.g.,15–40msper SSE chunk), tool-call payloads, and occasional429/529errors. - Use this mode to stress-test the application's own SSE/WebSocket proxy buffering, DB state persistence, event loop, memory footprint per open stream, and concurrency limits at high RPS with zero token cost.
- Use a local mock LLM server that simulates realistic Time to First Token (TTFT) (e.g.,
- Bounded Live Provider Benchmark Mode (End-to-End Calibration):
- Run strictly bounded concurrency and request counts (with a hard token/cost cap) against the real provider to measure actual model latency distributions, prompt cache hit rates, and RPM/TPM rate-limit behavior.
Streaming & LLM-Specific SLIs to Measure
Standard HTTP http_req_duration only measures total stream completion time—which hides frozen streams! Always measure:
- TTFT (Time to First Token / First Meaningful Chunk): Time from request dispatch until the first content token or tool event arrives (
p50,p95,p99). - TPOT / ITL (Time Per Output Token / Inter-Token Latency) and Token Throughput (
tokens/sec): Detects stream stuttering or reverse-proxy buffering (e.g., Nginx/Cloudflare buffering the entire SSE stream instead of flushing chunks immediately). - Total Completion Time & End-to-End Agent Turn Latency: Breakdown across prompt assembly / RAG retrieval $\rightarrow$ LLM inference $\rightarrow$ tool execution $\rightarrow$ state persistence.
- Stream Interruption & Client Abort Cleanup:
- Simulate clients disconnecting mid-stream (
AbortController.abort()after 2s). - Verify the backend immediately cancels the upstream LLM stream and aborts in-flight tool subprocesses rather than continuing to burn tokens and compute in the background.
- Simulate clients disconnecting mid-stream (
Provider Quotas, Retries & Token Cost Economics
- Rate-Limit Handling (
429RPM / TPM / ITPM / OTPM):- Verify that concurrent agent runs respect
Retry-After/x-ratelimit-reset-*headers, use token-aware queuing or semaphores, and fail over or degrade gracefully without triggering retry storms.
- Verify that concurrent agent runs respect
- Cost & Token Accounting Under Load:
- Track input tokens, cached input tokens (
cache_read_input_tokens), output tokens, and total cost per workflow run: $$\text{Cost per Run} = \sum_{\text{steps}} \left( T_{\text{in}} \cdot C_{\text{in}} + T_{\text{cached}} \cdot C_{\text{cached}} + T_{\text{out}} \cdot C_{\text{out}} \right)$$ - Detect runaway agent loops, unbounded context growth across turns, or missing prompt-cache hits that multiply latency and cost under concurrent load.
- Track input tokens, cached input tokens (
Included files 1
SKILL.md
About this skill package
ai-streaming-performance
ai-streaming-performance: Find performance limits with realistic workloads, measured bottlenecks and repeatable capacity and recovery tests.
Show less
ai-streaming-performance
ai-streaming-performance: Find performance limits with realistic workloads, measured bottlenecks and repeatable capacity and recovery tests.
Includes the complete skill and its supporting files (1 files). The exact authored scope is preserved below.
Original skill description (source language)
Use when benchmarking and load-testing AI agents, LLM integrations, SSE/WebSocket token streams, RAG pipelines, and tool-calling workflows—measuring TTFT, TPOT, stream cancellations, provider rate limits, and cost per run.
Install the skill, review its source and trust settings, then enable it for the relevant project or agent.
Requirements
- Orqestria installed on your computer.
