服务端 Profiling

SkillDev tools

Capture torch.profiler traces on a running FlashRec server. Use when the user asks to profile, trace, Chrome trace, start_profile, stop_profile, sglang.bench_serving --profile, or 性能剖析.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the 服务端 Profiling skill

What this skill tells your AI

The instructions your AI receives, as published by sohu-mptc/flashrec in .claude/skills/profile-serving/SKILL.md and read by ahel’s review.

接口与 SGLang 对齐,可直接给 sglang.bench_serving --profile 用。start/stop 在 GPU worker 线程上生效——不要在 HTTP 线程上包 torch.profiler

采集

默认输出目录:FLASHREC_TORCH_PROFILER_DIRSGLANG_TORCH_PROFILER_DIR/tmpscripts/serve.sh 会设成仓库下 profiles/

curl -s -X POST http://127.0.0.1:8000/start_profile \
  -H 'Content-Type: application/json' \
  -d '{"output_dir":"./profiles","num_steps":20,"activities":["CPU","GPU"],"with_stack":true}'

curl -s -X POST http://127.0.0.1:8000/stop_profile

num_steps 会自动停。Body:output_dirnum_stepsstart_stepactivitiesCPU/GPU)、profile_by_stagewith_stackrecord_shapesprofile_prefix

Chrome trace 区间名:flashrec.batch.wait / prefill / decode_fwd / expand / finalize

解读

  • 窄 beam + 低并发:batch.wait 或单请求开销主导,不要据此调 graph
  • 宽 beam:看 expand 是否在 CUDA graph 内;eager expand 说明 bs % n != 0 或捕获宽度不够
  • finalize 过重:检查 FLASHREC_DENSE_FINALIZE(默认 1
  • 对照 SGLang 时两侧都要用 FlashInfer,并关掉 SGLang overlap schedule

Signals

GitHub stars
104
Forks
4
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
profile-serving
Source
github.com/sohu-mptc/flashrec