Dynamic Nodejs cluster sizing by currently allocated vCPUs
u11d-aleksy-bohdziul
PROOP

5 months ago

We’re running a Node.js backend on Railway using cluster mode in order to be able to utilise the vertical autoscaling. Right now, we’re always running 32 Node.js processes per instance (matching our maximum available vCPU allocation).

Our client wanted me to check whether there’s a recommended way to adjust the number of Nodejs worker processes as the amount of vCPUS allocated to the instance changes due to vertical autoscaling.

For example: if an instance initially has 1 vCPU allocated, only 1 worker process would run. As traffic increases and Railway scales the instance to 2 vCPUs, a second worker process would be spawned. At 3 vCPUs, 3 workers would run, and so on.

Then, as traffic decreases and vertical autoscaling reduces the vCPU allocation, worker processes would be terminated accordingly, until the instance scales back down to 1 vCPU and there's only 1 worker process running.

If there's no recommended way, then I'd like to know, whether it's possible on Railway to somehow check how many vCPUs are currently allocated to an instance.

$10 Bounty

1 Replies

Railway
BOT

5 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


Loading...