Skip to content

Commit 4b19f4f

Browse files
committed
docs(bench): add helloworld_epoll smoke + nginx 13/15 A/B verification
helloworld_epoll (15.0 only, lightweight per user scope decision): smoke 200 OK / 1.62ms RTT T1 warmup 26,656 req/s p99 541us T2 baseline 209,962 req/s p99 756us ~14% lower than helloworld(kqueue) due to epoll-on-kqueue wrapper overhead nginx (dual-tree A/B, same 4-min time window, IP redacted at source): build: FF_PATH override + --prefix segregation, both 3.4s, no make install config: worker_processes 1, listen 80, identical f-stack.conf MD5 T1 (t2c10/5s): 13.0 26,194 vs 15.0 26,469 req/s (+1.05%) p99 804us -> 502us (-37.6%, 15.0 better at low conc) T2 (t4c100/30s): 13.0 189,222 vs 15.0 187,228 req/s (-1.05%) T3 (t8c500/30s): 13.0 229,857 vs 15.0 228,584 req/s (-0.55%) p99 4.47ms -> 5.30ms (+18.6%) Key finding: nginx 13->15 throughput regression <1.1% (vs helloworld -7.6%~-9.4%). FreeBSD 13->15 vendor evolution costs/benefits largely cancel out on event-driven worker model. Compliance: zero direct rm/kill/chmod calls. kill_process.sh x4, rm_tmp_file.sh x4, chmod_modify.sh x0. nginx Makefile install -m avoided by manual mkdir+cp -p deploy. Both docs updated: runtime-fix-execution-log.md (+S12.12 +S12.13), 13.0-baseline-cvm-bench-report.md (+S12 +S13).
1 parent 2baeb7f commit 4b19f4f

2 files changed

Lines changed: 181 additions & 0 deletions

File tree

docs/freebsd_13_to_15_upgrade_spec/zh_cn/13.0-baseline-cvm-bench-report.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,68 @@ make: *** No rule to make target 'ff_api.symlist', needed by 'libfstack.a'. Sto
292292
- **13.0 baseline helloworld 仍在跑**(PID 1748870, lcore=4),可立即用于后续验证;切回 15.0 走标准流程:`kill_process.sh + rm_tmp_file.sh /dev/hugepages/rtemap_* + 主树 ./start.sh`
293293
- Phase 4 全程零直接 `rm`/`kill`/`chmod``kill_process.sh` × 1、`rm_tmp_file.sh` × 1
294294
- 系统级永久新增:`/usr/bin/perf` (perf-6.6.119-49.23.tl4) + `/opt/FlameGraph/`
295+
296+
---
297+
298+
## §12 helloworld_epoll 验证(范围说明)
299+
300+
### 12.1 范围决策(仅 15.0 单边轻量,未做 13.0 对比)
301+
- 用户决策 Q1=C:仅 15.0 single-side smoke + wrk T2 baseline
302+
- 因此本 baseline 报告**不包含** 13.0 baseline epoll 数据
303+
- 完整 15.0 epoll 数据见 `runtime-fix-execution-log.md §12.12`
304+
305+
### 12.2 工程理由
306+
- helloworld_epoll 的 backend 与 helloworld 完全相同(同 fstack lib、同 lcore=4、同 port 80),仅事件接口从 kqueue 切到 epoll-on-kqueue wrapper
307+
- 13.0 baseline epoll 路径 vs 15.0 epoll 路径的代码差异 = 13.0/15.0 fstack lib 的 epoll wrapper 文件(`src/epoll/`)差异 + FreeBSD 内核 epoll 兼容层差异;两者均已通过 §12.10/§12.11 的 helloworld(kqueue)A/B 间接覆盖
308+
- 单独跑 13.0 baseline epoll 的边际信息量低,被用户判定为不必要的工作量
309+
310+
---
311+
312+
## §13 nginx 双树 A/B 验证 — 13.0 baseline 视角
313+
314+
### 13.1 测试范围
315+
完整 A/B(用户决策 Q2=B):双树 build → wrk T1/T2/T3 同时间窗,不做 perf flamegraph。15.0 数据 + 完整对比表见 `runtime-fix-execution-log.md §12.13`
316+
317+
### 13.2 13.0 baseline nginx 构建产物
318+
- 源码:`/data/workspace/f-stack-13.0-baseline/app/nginx-1.28.0/`
319+
- configure:`FF_PATH=/data/workspace/f-stack-13.0-baseline ./configure --prefix=/usr/local/nginx_fstack_13baseline --with-ff_module`
320+
- make 用时:3.40 s
321+
- binary:`/usr/local/nginx_fstack_13baseline/sbin/nginx`,31,695,576 B
322+
- worker_processes 1,listen 80,access_log /dev/null(默认)
323+
- f-stack.conf:`/data/workspace/f-stack-13.0-baseline/config.ini` 的 cp -p 副本(MD5 `9e443c8c494167d9a814a4fb26347869`,与 15.0 副本一致)
324+
325+
### 13.3 启动与健壮性
326+
| 检查项 | 结果 |
327+
|---|---|
328+
| DPDK init 用时 | ≤ 12 s |
329+
| Port 0 Link | Up(virtio_net 0000:00:09.0) |
330+
| f-stack-0 注册 | `Successed to register dpdk interface` |
331+
| Smoke `curl /` | HTTP 200, RTT 1.25 ms, server=192.168.1.1 |
332+
| HTML payload | F-Stack welcome 完整 |
333+
334+
### 13.4 13.0 baseline wrk 完整数据
335+
336+
| 场景 | t/c/dur | Req/sec | Lat avg | p50 | p75 | p90 | p99 | Max | 总请求 | Throughput |
337+
|---|---|---|---|---|---|---|---|---|---|---|
338+
| T1 warmup | 2/10/5s | **26,193.87** | 381.57 µs | 373 µs | 391 µs | 431 µs | 804 µs | 6.50 ms | 133,583 | 19.11 MB/s |
339+
| T2 baseline | 4/100/30s | **189,221.86** | 508.09 µs | 501 µs | 542 µs | 585 µs | 729 µs | 6.96 ms | 5,679,136 | 138.05 MB/s |
340+
| T3 high-conc | 8/500/30s | **229,857.17** | 2.11 ms | 2.09 ms | 2.17 ms | 2.29 ms | 4.47 ms | 30.80 ms | 6,907,693 | 167.69 MB/s |
341+
342+
### 13.5 与 15.0 runtime-fix-done 简比(向 baseline 视角)
343+
344+
| 场景 | 13.0 → 15.0 req/s 变化 | 13.0 → 15.0 p99 变化 | 解读 |
345+
|---|---|---|---|
346+
| T1 | +1.05% | **−37.6%** (15.0 优) | 低并发尾延迟 15.0 显著改善 |
347+
| T2 | −1.05% | +2.5% | 持平 |
348+
| T3 | −0.55% | +18.6% | 高并发尾部 15.0 略恶化但远轻于 helloworld |
349+
350+
13.0 baseline 在 nginx 工作负载下的"参考线"作用:吞吐 / p99 高度稳定,作为后续 15.0 任何回归判定的零点是可靠的。
351+
352+
### 13.6 工件
353+
- `/tmp/13baseline-nginx-bench/{smoke.txt,T1.txt,T2.txt,T3.txt,nginx_stdout.log}` (IP 混淆)
354+
- `/usr/local/nginx_fstack_13baseline/logs/error.log`(fstack 启动日志保留)
355+
356+
### 13.7 系统终态
357+
- 13.0 baseline nginx 已优雅 stop(kill_process.sh);安装目录 `/usr/local/nginx_fstack_13baseline/` 保留,可重复启用
358+
- 全程零直接 `rm`/`kill`/`chmod`:kill_process.sh × 1(13.0 nginx stop)+ rm_tmp_file.sh × 1(rtemap × 23)
359+

docs/freebsd_13_to_15_upgrade_spec/zh_cn/runtime-fix-execution-log.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,3 +474,119 @@ const struct fileops badfileops = {0};
474474
- 13.0 baseline helloworld 仍在跑(PID 1748870, lcore=4),后续若需切回 15.0 走 `kill_process.sh + rm_tmp_file.sh /dev/hugepages/rtemap_* + 主树 ./start.sh` 即可
475475
- Phase 4 全程零直接 `rm`/`kill`/`chmod` 调用:`kill_process.sh` × 1(首切 15.0)、`rm_tmp_file.sh` × 1(rtemap × 23)
476476
- 工具系统级安装:`dnf install perf` (50MB) + `git clone /opt/FlameGraph` (2MB),永久保留
477+
478+
---
479+
480+
## §12.12 helloworld_epoll 轻量验证(仅 15.0 runtime-fix-done)
481+
482+
### 12.12.1 范围决策与方法
483+
- 范围:仅 15.0 单边 smoke + wrk T2 一次(T1 5s warmup 用于稳态)
484+
- 不做 13.0 对比、不做 perf flamegraph(用户决策 Q1=C)
485+
- 复用 §12.10 同一 lcore=4、端口 80、客户端 wrk binary `/tmp/wrk/wrk`、IP 混淆为 192.168.1.1(server)/ 192.168.1.3(client)
486+
487+
### 12.12.2 启动与端口绑定
488+
- 二进制:`/data/workspace/f-stack/example/helloworld_epoll` (27,934,872 B),由主树 15.0 runtime-fix-done lib 链接
489+
- 配置:复用 `/data/workspace/f-stack/config.ini`(lcore_mask=4、单 port 0000:00:09.0)
490+
- 启动后 12s 完成 DPDK init + ifconfig,关键日志 `f-stack-0: Successed to register dpdk interface`、`Port 0 Link Up`
491+
492+
### 12.12.3 Smoke(client → server)
493+
```
494+
[smoke] http_code=200 time_total=0.001623s
495+
```
496+
- 返回完整 F-Stack welcome HTML(即 epoll 路径上 listen/accept/recv/send 全栈通)
497+
- 单次 RTT 1.62 ms(含 ssh roundtrip 客户端到 server)
498+
499+
### 12.12.4 wrk 测试结果
500+
| 场景 | Threads | Conns | Dur | Req/sec | Lat avg | p50 | p90 | p99 | 总请求 |
501+
|---|---|---|---|---|---|---|---|---|---|
502+
| T1 warmup | 2 | 10 | 5s | **26,655.96** | 368.12 µs | 347 µs | 467 µs | 541 µs | 135,946 |
503+
| T2 baseline | 4 | 100 | 30s | **209,961.66** | 456.48 µs | 444 µs | 530 µs | 756 µs | 6,319,753 |
504+
505+
### 12.12.5 与 helloworld(kqueue)对比
506+
- helloworld 15.0 同环境 T2 baseline ≈ 244,400 req/s(§12.10.4),epoll 209,961 较其低 ~14.1%
507+
- 解读:fstack 的 epoll 接口是基于 kqueue 的 wrapper(src/epoll/ 目录),多了一层 ev struct 转换开销;功能与性能均符合预期,未发现 15.0 runtime-fix-done 引入的 epoll 路径退化
508+
509+
### 12.12.6 工件
510+
- `/tmp/15rfix-epoll-bench/` 保留 smoke.txt / T1.txt / T2.txt / hello.log(IP 已混淆)
511+
512+
### 12.12.7 清理与终态
513+
- helloworld_epoll 通过 `kill_process.sh 1797569` 优雅退出
514+
- `/dev/hugepages/rtemap_*` 通过 `rm_tmp_file.sh` 移入 trash(× 23)
515+
- 全程零直接 `rm`/`kill`/`chmod` 调用
516+
517+
---
518+
519+
## §12.13 nginx 双树 A/B 验证(13.0 baseline + 15.0 runtime-fix-done)
520+
521+
### 12.13.1 范围决策与方法
522+
- 范围(用户决策 Q2=B):双树 build → wrk T1/T2/T3 同时间窗(不做 perf flamegraph)
523+
- nginx:`f-stack/app/nginx-1.28.0/`,`--with-ff_module`,`worker_processes 1`,`listen 80`
524+
- 安装策略:分别 install 到 `/usr/local/nginx_fstack_13baseline/` 和 `/usr/local/nginx_fstack_15rfix/` 避免冲突
525+
526+
### 12.13.2 规约合规说明
527+
- nginx 自带 Makefile 的 `install` target 调用 `install -m`,按工作区 chmod 规约属违规
528+
- 规避方法:仅 `make`(不 `make install`),手动 `mkdir + cp -p` 完成部署
529+
- 全程零直接 `chmod`/`rm`/`kill` 调用;`kill_process.sh` × 2(13.0 / 15.0 stop)+ `rm_tmp_file.sh` × 2(rtemap × 23 each)
530+
531+
### 12.13.3 Build 数据
532+
| 树 | configure 命令 | make 时间 | binary 大小 |
533+
|---|---|---|---|
534+
| 15.0 main | `FF_PATH=/data/workspace/f-stack ./configure --prefix=/usr/local/nginx_fstack_15rfix --with-ff_module` | 3.43 s | 32,028,752 B |
535+
| 13.0 baseline | `FF_PATH=/data/workspace/f-stack-13.0-baseline ./configure --prefix=/usr/local/nginx_fstack_13baseline --with-ff_module` | 3.40 s | 31,695,576 B |
536+
537+
两版 `f-stack.conf`(即 config.ini 拷贝)MD5 完全一致 (`9e443c8c494167d9a814a4fb26347869`),确保 fstack 启动参数对照公平。
538+
539+
### 12.13.4 同时间窗测试时序
540+
| 时刻 (UTC) | 事件 |
541+
|---|---|
542+
| 08:54:22 | 13.0 baseline nginx launch (master PID 1806229) |
543+
| 08:54:34 | 13.0 smoke 200 OK / RTT 1.25 ms |
544+
| 08:54:34 ~ 08:55:51 | 13.0 wrk T1+T2+T3(合计 ~77 s) |
545+
| 08:56:20 | 13.0 nginx kill_process.sh + rtemap rm_tmp_file.sh |
546+
| 08:56:37 | 15.0 nginx launch (master PID 1807529) |
547+
| 08:56:49 | 15.0 smoke 200 OK / RTT 1.72 ms |
548+
| 08:56:49 ~ 08:58:08 | 15.0 wrk T1+T2+T3(合计 ~77 s) |
549+
| 08:58:34 | 15.0 nginx kill + rtemap 清理 |
550+
551+
两次测试集中于约 4 min 时间窗,避免负载漂移与时段差异。
552+
553+
### 12.13.5 wrk 结果对比
554+
555+
| 场景 | 13.0 req/s | 15.0 req/s | Δ% | 13.0 p99 | 15.0 p99 | Δ |
556+
|---|---|---|---|---|---|---|
557+
| T1 (t2c10/5s) | 26,193.87 | 26,468.53 | **+1.05%** | 804 µs | 502 µs | **−37.6%** |
558+
| T2 (t4c100/30s) | 189,221.86 | 187,228.34 | −1.05% | 729 µs | 747 µs | +2.5% |
559+
| T3 (t8c500/30s) | 229,857.17 | 228,583.84 | −0.55% | 4.47 ms | 5.30 ms | +18.6% |
560+
561+
吞吐稳定项(avg 行):
562+
| 场景 | 13.0 avg lat | 15.0 avg lat |
563+
|---|---|---|
564+
| T1 | 381.57 µs | 373.55 µs |
565+
| T2 | 508.09 µs | 513.31 µs |
566+
| T3 | 2.11 ms | 2.15 ms |
567+
568+
### 12.13.6 关键发现
569+
570+
1. **nginx 13→15 throughput 几乎无回归**(≤1.1% 差异,全部在测试 jitter 内):与 §12.10 helloworld 的 −7.59% / −9.37% 形成显著对比
571+
2. **T1 低并发下 15.0 p99 显著优于 13.0**(−37.6%,804→502 µs):可能与 §12.11 火焰图发现的 15.0 ether_nh_input pipeline 改进有关,在低连接数场景对延迟尾部更友好
572+
3. **T3 高并发 p99 +18.6%**:与 helloworld 的 +27.8% 同方向但幅度更小,说明 socket buffer locking 重构在 nginx event loop 路径上的影响被部分掩盖(nginx 用 epoll 连接复用,单连接内的串行 send/recv 被批处理摊薄)
573+
4. **解读结论**:§12.11 中归纳的 13→15 厂商演进路径(tcp_default_output vtable wrapper、CUBIC、socket buffer locking、ether_nh_input pipeline)在 nginx 这种 event-driven worker 模型上的"代价/收益"基本互相抵消,吞吐持平、低并发 p99 改善、高并发 p99 略恶化
574+
575+
### 12.13.7 工件
576+
- 13.0: `/tmp/13baseline-nginx-bench/{smoke.txt,T1.txt,T2.txt,T3.txt,nginx_stdout.log}` (IP 已混淆)
577+
- 15.0: `/tmp/15rfix-nginx-bench/{smoke.txt,T1.txt,T2.txt,T3.txt,nginx_stdout.log}` (IP 已混淆)
578+
- nginx logs: `/usr/local/nginx_fstack_{13baseline,15rfix}/logs/error.log`(保留以备后续复查)
579+
580+
### 12.13.8 系统终态
581+
- 当前无 nginx/helloworld 在跑;hugepages 4096/4096 free
582+
- 两份 nginx 安装在 `/usr/local/nginx_fstack_{13baseline,15rfix}/`,可重复启用
583+
- 后续切回 15.0 helloworld 工作流:`/usr/local/nginx_fstack_15rfix/sbin/nginx -s stop`(如有)→ `cd /data/workspace/f-stack && nohup ./example/helloworld --conf ./config.ini --proc-type=primary --proc-id=0 &`
584+
585+
### 12.13.9 全程合规审计
586+
| 操作 | 调用脚本 | 次数 |
587+
|---|---|---|
588+
| Process kill | `/data/workspace/kill_process.sh` | 4 (helloworld → epoll → 13.0 nginx → 15.0 nginx) |
589+
| File trash | `/data/workspace/rm_tmp_file.sh` | 4 (rtemap × 23 each, 共 92 file) |
590+
| Mode change | `/data/workspace/chmod_modify.sh` | 0 (cp -p 保留源 mode 0755 已满足) |
591+
| 直接 `rm`/`kill`/`chmod` | — | **0** |
592+

0 commit comments

Comments
 (0)