Skip to content

Reduce backend instance count in resource constrained environments #2170

Description

@alxndrsn

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    opsDocker, nginx, ops to deploy Central

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions