10 months ago
My NodeJS API responds pretty slow to requests to the public network IP Railway provides.
Anyway to speed this up?
27 Replies
10 months ago
Did you deploy this API in a region near your end user/you?
10 months ago
How are you measuring the latency of the requests?
I got very good ping and internet at my house, so that shouldn't be a big factor.
10 months ago
Are you using the metal edge network? You can check that in your service -> public networking
10 months ago
Can you try disabling it and seeing if the latency lowers or is more consistent?
10 months ago
yes
10 months ago
and yes
Maybe i'm used to quicker cuz of local environment and now everything else feels slow
But there probably isn't much I can do right other than improve my NodeJS code for better performance?
details on what the API is doing?
if the API has to handle a lot of work, then here are some solutions that I can think of.
Do API calls asynchronously.
Do API calls in big batches all at once
Do API calls in parallel instead of concurrent.
ok, so the only thing now is to probably try other regions, or other cloud providers
You could probably to also look into finding out if you could test the latency remotely on a different computer in a different geographical location compared to yours.
So use a service on a different cloud provider, call that api on railway, and log the latency to see if it is a regional thing.
10 months ago
this is likely the case. api calls to a local server will have 0ms rtt, plus the actual processing that the api is doing
10 months ago
more details on what processing is actually being done by your api would be helpful for suggesting optimizations
10 months ago
40ms is not bad
