a month ago
I recently setup a NestJS api to run on railway through github and also deployed a MySQL server next to my API, and the database is extremely slow, even when upgrading to the hobby plan. The API and Database are on the same Railway Project so they can talk to eachother internally. Both regions for my API and Database are the same, just trying to figure this out.
11 Replies
a month ago
are the api and the db in the same region? how are the metrics?
a month ago
and what type of queries are you running? do you have some metrics like total query execution time?
just normal select queries with joins. there's only one row right now that it should be finding in the query (which it does, just takes appx 1-3s for it to), when localhost it takes less than 60, and on another provider takes around 200ms
a month ago
are you using the private network provided by railway or public? also, is your db indexed in your WHERE and JOIN clauses? you can run EXPLAIN ANALYZE on the slow SELECT
Using the private network between the API and MySQL. And yes the database does have proper indexing
Just confused where its hanging if its the connection between the API and the MySQL server, or if its actually just the Client -> API connectivity? Which I am in the US East region and even for me its taking a couple of seconds…
Okay so update. Just had someone try it who is in the central region, and they get request times of less than 50ms for the same routes I am running where mine have now been upwards of 500ms-1.3s. I do believe there is some bottleneck somewhere along the chain, and my network is decent too; I get upwards of 100mbps up and 200mbps down
a month ago
it could be client -> api connectivity if everything else (including someone else who tested it on another region) works fine. a simple potential fix could be redeploying the container to see if it'll solve it
Okay, after doing some more looking through, it works for me just fine when I use a VPN so it's something within my network… Thanks for the help all. I am going to continue to look through my network
a month ago
!s
Status changed to Solved medim • about 1 month ago