Skip to content

Commit a2c75de

Browse files
committed
tune up methodology section
1 parent 3207b30 commit a2c75de

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

src/blog/tanstack-start-5x-ssr-throughput.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,23 @@ We did not benchmark "a representative app page". We used endpoints that exagger
5656

5757
This is transferable: isolate the subsystem you want to improve, and benchmark that.
5858

59+
### CPU profiling with `@platformatic/flame`
60+
61+
To capture a CPU profile of the server under load, we start the built server with [`@platformatic/flame`](https://github.com/platformatic/flame):
62+
63+
```sh
64+
flame run ./dist/server.mjs
65+
```
66+
67+
This produces:
68+
69+
- a CPU flamegraph
70+
- a memory heap flamegraph
71+
- and markdown summaries of the captured profile data
72+
5973
### Load generation with `autocannon`
6074

61-
We used [`autocannon`](https://github.com/mcollina/autocannon) to generate a 30s sustained load. We tracked:
75+
While `@platformatic/flame` is running in one terminal, we used [`autocannon`](https://github.com/mcollina/autocannon) in another terminal to generate a 30s sustained load. We tracked:
6276

6377
- requests per second (req/s)
6478
- latency distribution (average, p95, p99)
@@ -69,25 +83,13 @@ Example command (adjust concurrency and route):
6983
autocannon -d 30 -c 100 --warmup [ -d 2 -c 20 ] http://localhost:3000/bench/links-100
7084
```
7185

72-
### CPU profiling with `@platformatic/flame`
73-
74-
To record a CPU profile of the server under load, we use [`@platformatic/flame`](https://github.com/platformatic/flame) to start the server:
75-
76-
```sh
77-
flame run ./dist/server.mjs
78-
```
79-
80-
This gives you
81-
82-
- a CPU flamegraph
83-
- a memory histogram
84-
- and even markdown files that can be read by AI agents
86+
### How to interpret the results
8587

86-
To improve SSR performance, we repeated the same steps:
88+
To improve SSR performance, we repeated the same loop:
8789

88-
- Focus on **self time** first. That is where the CPU is actually spent, not just where time is waiting on children.
89-
- Fix one hotspot, re-run, and re-profile.
90-
- Prefer changes that remove work in the steady state, not just shift it.
90+
- Focus on **self time** first. That is where the CPU is actually spent.
91+
- Fix one hotspot, re-run the benchmark, and re-profile.
92+
- Prefer changes that remove work in the steady state.
9193

9294
### Reproducing these benchmarks
9395

0 commit comments

Comments
 (0)