clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.67k stars 125 forks source link

heapprofiler: how to get around initial boot noise? #460

Open lassic opened 1 year ago

lassic commented 1 year ago

when a large server starts, there are usually tons of allocations on boot, which are often less interesting than the baseline that follows. we need some sort of option to filter out that noise. as I see it there are a few ways to go about this:

  1. allow filtering in the UI by time (probably not easy as flamegraph format has no time axis, maybe flamescope style?)
  2. allow collecting and stopping programmatically on the current process (not by spawning a new process, since then we're back at the same problem)
  3. add a delay option to the profiler so we can at least set some large delay until we're sure the server started.

Thanks!

RafaelGSS commented 1 year ago

I think we could go with the option 3. We already have

  --stop-delay               Add a delay to close the process when a job is done through either `autocannon` or `on-port` flag (milliseconds)

So adding a --start-delay seems reasonable.