← 返回 CLI 目录
oha
$ oha 社区开源 中风险 hatoo (OSS) · 浏览器与网页抓取 · MIT · macos / linux / windows
oha 是受 rakyll/hey 启发的 Rust 高性能 HTTP/1.1 与 HTTP/2 压测工具。交互运行会展示实时 TUI,而传入 --no-tui --output-format json 后可输出整洁、可解析的延迟与吞吐量 JSON 报告。
FCRS-1.0 综合评分
87 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install oha CLI vs MCP 选型建议 仅 CLI 可用
直接在 Shell 中对本地或预发环境执行高吞吐压测并产出结构化 JSON 摘要。
Agent 友好度体检单
✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
✓ 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
Agent 友好度 22 / 25
原生支持 --output-format json(及 csv)与 --no-tui,但 Agent 需显式传入 --no-tui 以免触发 TUI。
- Supports
--no-tui,--output-format json|csv|quiet, and-o
安全与权限边界 21 / 25
默认限制 200 次请求并支持 -t 超时;但高并发参数若用于外部站点仍有过载风险。
- Finite default
-n 200and per-request-ttimeout flag
安装与运行摩擦 14 / 15
单一 Rust 二进制,可通过 Homebrew、Cargo 与 GitHub Releases 安装。
- Cross-platform binary via
brew,cargo, and releases
能力覆盖与边际价值 14 / 15
Rust 引擎性能强劲,提供 JSON Schema、HTTP/2 与恒定 QPS 限速(-q)。
- Structured JSON output with percentiles, RPS, and status breakdown
维护与来源背书 8 / 10
社区活跃维护的 Rust 项目(hatoo/oha),MIT 协议。
- Active
hatoo/ohaGitHub repository
文档与可验证性 8 / 10
README 清晰且仓库内附带规范的 schema.json。
- Published JSON schema (
schema.json) in repository
安全边界、鉴权与放权指南
鉴权方式
无需鉴权 环境变量密钥
凭证存储位置
按次通过 -H 传入认证请求头;不存储任何凭据。
潜在副作用
只读查询 远端写入
费用与配额提示
免费开源(MIT 协议)Rust 二进制。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# oha Agent Rules - Always pass `--no-tui --output-format json` so `oha` never enters interactive TUI mode in agent shells. - Keep `-n` or `-z` bounded and never benchmark production or external third-party hosts without approval.
Agent 高频安全命令配方
只读查询(安全推荐)
对本地服务执行无头 JSON 压测
oha --no-tui --output-format json -n 200 -c 10 -t 5s http://localhost:8080/health
禁用交互式 TUI(--no-tui),以 JSON 格式打印结构化性能汇总指标。
受控写入与预演
将 POST 接口的 JSON 压测报告写入文件
oha --no-tui --output-format json -o bench.json -n 100 -c 5 -m POST -H 'Content-Type: application/json' -d '{"ok":true}' http://localhost:8080/api 将结构化的延迟分位与 RPS 数据保存至 bench.json。
核心优势
- +
--no-tui --output-format json可输出带 Schema 约束的干净 JSON 指标。 - + 支持
--latency-correction与恒定速率压测(-q)。
注意事项与踩坑点
- ! 默认启用交互式 TUI,自动化脚本务必显式加上
--no-tui。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI