如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Fortio(Φορτίο)最初是 Istio 的负载测试工具,现已发展为独立项目,也被 Meshery 等项目采用。它能以指定的每秒查询数(QPS)运行,记录执行时间直方图并计算百分位数(如 p99),可运行指定时长、固定调用次数或直至中断。名称源自希腊语“φορτίο”,意为“负载/负担”。
启动 Fortio 服务器
shelldocker run -p 8080:8080 -p 8079:8079 fortio/fortio server &
此命令启动 Fortio 服务器,映射 HTTP 端口 8080 和 gRPC 端口 8079,可通过 http://localhost:8080/fortio/ 访问 Web UI。
运行负载测试
shelldocker run fortio/fortio load http://www.google.com/
对指定目标(如 http://www.google.com/)执行负载测试。
Go 安装:
shellgo get fortio.org/fortio
二进制下载:从 https://github.com/fortio/fortio/releases 下载对应平台的二进制文件。
macOS(Homebrew):
shellbrew install fortio
Windows:下载 ZIP 包并解压,在命令提示符中运行 fortio.exe server。
| 参数 | 描述与示例 |
|---|---|
-qps rate | 每秒查询数(QPS),0 表示无等待/最大 QPS(默认 8) |
-c connections | 并行连接数(goroutine/线程数,默认 4) |
-t duration | 测试持续时间(如 -t 30m 表示 30 分钟,默认 5s),0 表示运行至中断 |
-n numcalls | 固定调用次数,替代持续时间模式(默认 0,使用 -t) |
-r resolution | 直方图最低桶分辨率(秒,默认 0.001,即 1ms),建议设为预期典型延迟的 1/10 |
-H "header: value" | 添加请求头,可多次指定(如 -H "Host: example.com") |
-a | 自动保存 JSON 结果,文件名基于标签和时间戳 |
-json filename | JSON 结果输出文件(或 - 表示 stdout),默认相对 -data-dir 目录 |
-labels "l1 l2 ..." | 添加到 JSON 结果的额外标签,默认包含目标 URL 和主机名 |
运行 fortio help 查看所有命令和参数,包括 gRPC、TCP、UDP 测试相关参数。
shellfortio server & # 输出示例: # 14:11:05 I fortio_main.go:171> 未使用动态标志监控(使用 -config 设置监控目录) # Fortio 1.17.0 tcp-echo server listening on [::]:8078 # Fortio 1.17.0 grpc 'ping' server listening on [::]:8079 # Fortio 1.17.0 https redirector server listening on [::]:8081 # Fortio 1.17.0 echo server listening on [::]:8080 # Data directory is /Users/ldemailly/go/src/fortio.org/fortio # UI started - visit: http://localhost:8080/fortio/
shellfortio server -http-port 10.10.10.10:8088
将 HTTP 服务器绑定到 10.10.10.10:8088。
shell# 启动 HTTP 服务器监听 Unix 域套接字 fortio server --http-port /tmp/fortio-uds-http & # 通过 Unix 域套接字访问 fortio curl -unix-socket=/tmp/fortio-uds-http http://foo.bar/debug
shell# 启动 TCP 回显服务器 fortio tcp-echo & # 对 TCP 服务器执行最大 QPS 负载测试(100000 次调用) fortio load -qps -1 -n 100000 tcp://localhost:8078
shell# 启动 UDP 回显服务器 fortio udp-echo & # 对 UDP 服务器执行最大 QPS 负载测试(100000 次调用) fortio load -qps -1 -n 100000 udp://localhost:8078/
简单 gRPC Ping
shellfortio grpcping -n 5 localhost
向本地 gRPC 服务器发送 5 次 Ping 请求。
使用 TLS 的 gRPC Ping
shell# 启动带 TLS 的 Fortio 服务器 fortio server -cert /path/to/server.crt -key /path/to/server.key # 使用 CA 证书连接 fortio grpcping -cacert /path/to/ca.crt localhost
shellfortio load http://www.google.com
以默认 QPS(8)和持续时间(5s)测试 http://www.google.com。
负载测试结果包含以下关键指标:
例如,测试输出中可能包含:
Ended after 5.059691387s : 40 calls. qps=7.9056 Aggregated Function Time : count 40 avg 0.060587641 +/- 0.006564 min 0.052549016 max 0.089893269 sum 2.42350566 # target 50% 0.0605556 # target 75% 0.065 # target 90% 0.075 # target 99% 0.0849466
表示 40 次调用,QPS 约 7.9,平均延迟 0.06s,p99 延迟 0.0849s。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务