pmx
pmx copied to clipboard
Metrics with pm2 cluster
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.
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.
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.
My issue is my mistake - I am not accumulating the metrics from each process when reading the report back from PMX..