Commit dc293df0 authored by Jimmy Lai's avatar Jimmy Lai

bench(render-pipeline): default full runs to capture cpu profiles

parent 7c60a8ae
...@@ -18,6 +18,7 @@ pnpm --filter=next build ...@@ -18,6 +18,7 @@ pnpm --filter=next build
## 2. End-to-end benchmark (full app render path) ## 2. End-to-end benchmark (full app render path)
This measures the full request path (`renderToHTMLOrFlight`) through `bench/next-minimal-server`. This measures the full request path (`renderToHTMLOrFlight`) through `bench/next-minimal-server`.
In `scenario=full` and `scenario=all`, `--capture-cpu` defaults to `true`.
Node streams only: Node streams only:
...@@ -117,7 +118,6 @@ pnpm bench:render-pipeline \ ...@@ -117,7 +118,6 @@ pnpm bench:render-pipeline \
--scenario=full \ --scenario=full \
--stream-mode=node \ --stream-mode=node \
--build-full=true \ --build-full=true \
--capture-cpu=true \
--capture-trace=true \ --capture-trace=true \
--capture-next-trace=true \ --capture-next-trace=true \
--json-out=bench/render-pipeline/artifacts/<run>/results.json \ --json-out=bench/render-pipeline/artifacts/<run>/results.json \
......
...@@ -16,6 +16,9 @@ Run end-to-end benchmark (default stress routes): ...@@ -16,6 +16,9 @@ Run end-to-end benchmark (default stress routes):
pnpm bench:render-pipeline --scenario=full --stream-mode=both pnpm bench:render-pipeline --scenario=full --stream-mode=both
``` ```
For `scenario=full` and `scenario=all`, CPU profiles are captured by default.
Disable with `--capture-cpu=false` if you want lower-overhead runs.
Skip rebuild for faster iteration (after you already built once): Skip rebuild for faster iteration (after you already built once):
```bash ```bash
...@@ -39,7 +42,6 @@ Capture CPU profiles + Node trace events + Next trace logs: ...@@ -39,7 +42,6 @@ Capture CPU profiles + Node trace events + Next trace logs:
pnpm bench:render-pipeline \ pnpm bench:render-pipeline \
--scenario=full \ --scenario=full \
--stream-mode=both \ --stream-mode=both \
--capture-cpu=true \
--capture-trace=true \ --capture-trace=true \
--capture-next-trace=true --capture-next-trace=true
``` ```
......
...@@ -378,7 +378,12 @@ async function main() { ...@@ -378,7 +378,12 @@ async function main() {
if (!webAnalysis && !nodeAnalysis) { if (!webAnalysis && !nodeAnalysis) {
console.log('\nNo CPU profiles found in this artifact run.') console.log('\nNo CPU profiles found in this artifact run.')
console.log('Run benchmark with --capture-cpu=true first.') console.log(
'This analyzer reads only <mode>/<mode>.cpuprofile artifacts (not trace-event JSON or next-runtime-trace.log).'
)
console.log(
'Run benchmark with --capture-cpu=true, e.g. pnpm bench:render-pipeline --scenario=full --stream-mode=node --capture-cpu=true'
)
return return
} }
......
...@@ -174,7 +174,7 @@ Full benchmark options: ...@@ -174,7 +174,7 @@ Full benchmark options:
--timeout-ms=<number> (default: 30000) --timeout-ms=<number> (default: 30000)
Profiling and trace options: Profiling and trace options:
--capture-cpu=true|false (default: false) --capture-cpu=true|false (default: true for scenario=full|all, false for scenario=micro)
--capture-heap=true|false (default: false) --capture-heap=true|false (default: false)
--capture-trace=true|false (default: false) --capture-trace=true|false (default: false)
--capture-next-trace=true|false (default: true) --capture-next-trace=true|false (default: true)
...@@ -247,6 +247,8 @@ function parseCli(): CliOptions { ...@@ -247,6 +247,8 @@ function parseCli(): CliOptions {
const routes = parseRoutes(args.get('routes')) const routes = parseRoutes(args.get('routes'))
const buildFull = parseBoolean(args.get('build-full') ?? 'true') const buildFull = parseBoolean(args.get('build-full') ?? 'true')
const defaultCaptureCpu =
scenarioRaw === 'full' || scenarioRaw === 'all' ? 'true' : 'false'
const shouldForceBuildFull = const shouldForceBuildFull =
(scenarioRaw === 'full' || scenarioRaw === 'all') && (scenarioRaw === 'full' || scenarioRaw === 'all') &&
streamModeRaw === 'both' && streamModeRaw === 'both' &&
...@@ -273,7 +275,7 @@ function parseCli(): CliOptions { ...@@ -273,7 +275,7 @@ function parseCli(): CliOptions {
timeoutMs: parseNumberArg(args, 'timeout-ms', 30_000), timeoutMs: parseNumberArg(args, 'timeout-ms', 30_000),
port: parseNumberArg(args, 'port', 3199), port: parseNumberArg(args, 'port', 3199),
captureCpu: parseBoolean(args.get('capture-cpu') ?? 'false'), captureCpu: parseBoolean(args.get('capture-cpu') ?? defaultCaptureCpu),
captureHeap: parseBoolean(args.get('capture-heap') ?? 'false'), captureHeap: parseBoolean(args.get('capture-heap') ?? 'false'),
captureTrace: parseBoolean(args.get('capture-trace') ?? 'false'), captureTrace: parseBoolean(args.get('capture-trace') ?? 'false'),
captureNextTrace: parseBoolean(args.get('capture-next-trace') ?? 'true'), captureNextTrace: parseBoolean(args.get('capture-next-trace') ?? 'true'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment