Slow queries from Railway to AWS RDS
Question 1 - Running application via railway.app, but with db on aws (rds) the connection between the application and the database is very slow...
Is there any way to resolve it?
The same query that I run in the terminal and I was answered by the database in 200ms, via application the time of the same query is more than 3.5 seconds.
Question 2 - I have another application that is running with db via railway and the connection is much faster... But I would like to improve the response time a little more....
If I understand correctly, if I buy one more seat I gain more computing power, is that it?
22 Replies
Oh... now I think I understand.. I need to evolve the account from developer to team, then I gain more computational power....
But would this help with the questions mentioned above?
Co-locating helps here (railway app, railway db) and it can kill performance. Railway is US-West, too. which is maybe what you're seeing here )
team plan probably will not reduce your db latency, is the query really complex or just like
SELECT * FROM table
I thought about the location (US-west) this morning....
And that's definitely one of the things that's influencing it....
In my next projects, I already do it with internal DB (railway.app DB)...
I had plans to migrate a large application, but I'll wait until new regions are released on railway.app
where is your AWS db hosted btw?
sa-east-1
that should not cause the query to take 3 seconds
how are you measuring query time btw
also what client library are you using
Simple query...
But it definitely has to do with latency....
Running locally, the time is much better, but I still believe there is room for improvement.... I'm still going to stop to revalidate the DB indexing, but I wanted to know whether to upgrade the hardware.
okay, lets refocus this thread specifically on question 1, can you open a new thread for question 2?
If I run the query in the workbench like: SELECT * FROM establishments LIMIT 30
the response arrives in less than 300ms
But when I run this query via insomnia (request to back-end), the response time is 2.5 seconds on average for more...
I created a route without connection to the DB and the response time was back in ms....
the only slow endpoints are the ones hitting db
what language is the backend written in, and what client library does it use
and i am in sao paulo (closer to the rds server than the railway server)
nodejs
prisma and sequelize, i tested both
and I have an application running on aws itself and an instance of the same application on railway.app...
There is a 2 second difference in requests for more
Obs: same app in both cases
yeahh thats pretty bad
cc @wyzlle any clue as to whats up here?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I've been testing for some time... it's not today...
But I think it's the issue of distances between servers...
Today I'm making the request in BR, it goes to US-wes (raillway.app) that connects to DB in sa-west (closest to BR), which returns to US-west that returns to BR....
I'll check if I can use my applications that are 100% hosted on the railway, and wait for the launch of new regions....
Do you have a deadline for this?
Have any other suggestions?
3 seconds is well over the maximum latency caused by distance
I understand...
I did a test here....
Listing 200 sales.
Hosted on AWS = 1.07 seconds
- 1,20
- 1,27
- 1,27
- 1,51
Hosted on railway.app using DB aws
3.91 seconds
- 5.98
- 5,43
- 3,48
- 2,30
- 2,87
Yep, this is going to be an issue with region. May I have your upvote here -> https://railway.canny.io/feature-requests/p/configurable-deployment-region
Of course
3 seconds seems
excessive
It is but network bounces add up and our network performance isn’t refined to begin with. That’s what Charity is here to help with.
More on that soon.
CHARITH
I hope he doesn’t hate me for autocorrect haha
i think the correct region will increase network performance...
i am looking forward to the sa-west region...
until then, projects that need more performance will be hosted at aws... sa-west...
thanks for the support...