WORKER_COUNT/pm2 instance count hasn't changed significantly since 4ea0822 (apart from #2169).
As an example, consider a server with 2GB RAM and 2 logical CPU cores.
- will run 4 NodeJS instances
- each NodeJS instance will assume it has 4GB of RAM available:
const v8 = require('node:v8');
const stats = v8.getHeapStatistics();
console.log(`Max Heap Limit: ${(stats.heap_size_limit / 1024 / 1024).toFixed(2)} MB`);
console.log(`Total Physical Available: ${(stats.total_available_size / 1024 / 1024).toFixed(2)} MB`);
Recommended count
NodeJS
TODO
pm2
TODO
Taking other services into consideration
TODO: keep 1 CPU clear?
WORKER_COUNT/pm2 instance count hasn't changed significantly since 4ea0822 (apart from #2169).As an example, consider a server with 2GB RAM and 2 logical CPU cores.
Recommended count
NodeJS
TODO
pm2TODO
Taking other services into consideration
TODO: keep 1 CPU clear?