Skip to main content

detectGrowth

@forge/monorepo


@forge/monorepo / backend/src / detectGrowth

Function: detectGrowth()

detectGrowth(samples): GrowthVerdict

Defined in: backend/src/loadtest/metrics.ts:162

Least-squares slope of RSS against time, after discarding warm-up, plus a quartile comparison.

Both, because each catches what the other misses. A fit is robust to a single spike; a quartile comparison is robust to a ramp but fooled by one outlier. A verdict of "leaking" needs both.

The warm-up exclusion was not in the first version, and the test for it failed: a 20-second ramp to 500 MiB followed by a flat hour fit at ~420 MiB/h and was reported as a leak. My own comment claimed the quartile check handled it, and it did not — the first quartile was the ramp, so its mean was low and the comparison agreed with the fit. Two checks that share a blind spot are one check.

Parameters

samples

readonly ResourceSample[]

Returns

GrowthVerdict