MySQL Server Performance
tigergamer134
HOBBYOP

4 months 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.

Solved$10 Bounty

11 Replies

fra
HOBBYTop 10% Contributor

4 months ago

are the api and the db in the same region? how are the metrics?


4 months ago

and what type of queries are you running? do you have some metrics like total query execution time?


tigergamer134
HOBBYOP

4 months ago

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


tigergamer134
HOBBYOP

4 months ago

And yes they are in the same region US East (Virginia)


4 months 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


tigergamer134
HOBBYOP

4 months ago

Using the private network between the API and MySQL. And yes the database does have proper indexing


tigergamer134
HOBBYOP

4 months ago

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…


tigergamer134
HOBBYOP

4 months ago

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


4 months 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


tigergamer134
HOBBYOP

4 months ago

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


4 months ago

!s


Status changed to Solved medim 4 months ago


Loading...