a year ago
I'm developing a distributed Node.js application on Railway with a master node and multiple worker nodes. The application uses BullMQ for task distribution. I want to implement autoscaling for the worker nodes based on custom metrics, specifically the number of tasks each worker is processing.
1. Does Railway support autoscaling based on custom metrics?
2. If so, how can I configure autoscaling rules using the number of active tasks per worker as the scaling metric?
3. If custom metric scaling isn't directly supported, are there any workarounds or alternative approaches to achieve similar functionality?
My current setup:
- Master node: Distributes tasks using BullMQ
- Worker nodes: Process tasks from BullMQ queues
- Desired scaling behavior: Increase worker count when tasks per worker exceeds a threshold, decrease when it falls below another threshold
Any insights on implementing this type of custom scaling on Railway would be greatly appreciated. Thank you.
4 Replies
a year ago
Your services can autoscale vertically up to the max allowable resource for the Pro plan, no metrics involved in that since it would be up to the app to use the resources or not.
As touched on in the last point, that would need to be configured with the app itself.
It would only be up to the app to scale vertically.
I can't see this not being something BullMQ supports, or at least some similar software, check out their docs for more info on the technologies you are using.
a year ago
Hey Sam,
Adding on to what Brody said, Railway can't yet do automatic horizontal scaling based on load. However, you could do something via the API to make this work via the usage endpoints. You could have a service that polls against that and scale the replicaCount. However, Railway services scale all the way up to 32 GB and 32 Cores in a single instance.
Hopefully this helps,
Angelo
Status changed to Awaiting User Response railway[bot] • 11 months ago
4 months ago
Hey Angelo - is there roadmap to allow for rule based horizontal scaling? Aka, 70% capacity, spool up another instance, below 40% spool down an instance? Our environment team is asking this as well....we have a lot of load volatility.
Status changed to Awaiting Railway Response railway[bot] • 4 months ago
4 months ago
Great idea! But not currently supported, and won't be implemented in the near term.
Status changed to Awaiting User Response railway[bot] • 4 months ago