pmx icon indicating copy to clipboard operation
pmx copied to clipboard

Metrics with pm2 cluster

Open mrspartak opened this issue 7 years ago • 3 comments

So after switching from fork to cluster metrics works incorrectly (rps for example gone from 10 to 1.4 in 8 clusters), how to solve that? It's inccorect just to multiply by 8 I think.

mrspartak avatar May 08 '17 09:05 mrspartak

Each worker in the cluster mode behave like a standalone process so there are no reason switching to fork -> cluster change something, i guess you had more requests when you checked the probe.

vmarchaud avatar May 08 '17 10:05 vmarchaud

I have exactly the same issue - I'm running a stable load test using jMeter, and the reported RPS drops by almost the number of processes:

1 Process:
PMX: 450-500 RPS
jMeter 450-510 responses per second

4 Processes
PMX: 150-160 RPS
jMeter: 500-600 responses per second

Average request time is ~30-40ms - so I don;t think this should affect that I'm comparing requests per second (PMX) against responses received per second (jMeter)

My custom metric code:

const meter = probe.meter ( {
	name     : 'RPS',
	samples  : 1,
	timeframe: 1
} );
module.exports = ( req, res, next ) => {
	meter.mark ();
	next ();
};

It is almost like the metrics are being aggregated per process.. although I have no idea which process's metric is being reported back by PMX.

TheFoot avatar Mar 28 '19 16:03 TheFoot

My issue is my mistake - I am not accumulating the metrics from each process when reading the report back from PMX..

TheFoot avatar Mar 29 '19 07:03 TheFoot