a year ago
Railway metrics says we have a max of 8 vCPUs. The max we're using is only 2.6 vCPUs. But we're still seeing degraded API performance
0 Replies
a year ago
is your app a nodejs app?
a year ago
then there's your answer, nodejs is single threaded so most of the time it can't reach max CPU utilization
a year ago
you should take a look at replicas
there is an endpoint that has a lot of external network calls. i tried disabling that and that seems to have fixed it for now.
a year ago
i am assuming the degradation was because there were several requests to that endpoint that were still pending so the newer ones were delayed to get response
i tried using throng: https://www.npmjs.com/package/throng
with a concurrency worker count of 4, but didnt help
a year ago
yeah, if you want to handle those requests you'll need to scale because nodejs won't magically work just by throwing more resources at it
a year ago
my guess is that your worker count is too low and you're doing a lot of resource intensive tasks
a year ago
if you need something more advanced, see https://github.com/taskforcesh/bullmq
a year ago
then you can have multiple instances of your nodejs app processing a queue
yeah we use bullmq for something else. we just had huge traffic last few hrs that was not anticipated
a year ago
well get your current service usage times your amount of replicas
a year ago
replicas is just another instance of your application running
a year ago
replicas is the way if you're planning on scaling more than 8vCPUs (or buy the pro plan for 32vCPUs)
throng will only take you to the max of one service resources (8vCPUS or 32vCPUs)
a year ago
each
got it. thanks! i suppose using more throng workers might help use the max of all resources currently available
a year ago
yeah, for now it might fix but you might want to take a look at replicas soon or later
gonna try that out first as the max being used is just 2.5 vCPUs without throng and around 5 vCPUs with 4 throng workers
a year ago
yeah launch 7 throng workers and see how it goes