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
Dayglor
DayglorOP3y ago
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?
SENTRY
SENTRY3y ago
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 )
nebula
nebula3y ago
team plan probably will not reduce your db latency, is the query really complex or just like SELECT * FROM table
Dayglor
DayglorOP3y ago
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
nebula
nebula3y ago
where is your AWS db hosted btw?
Dayglor
DayglorOP3y ago
sa-east-1
nebula
nebula3y ago
that should not cause the query to take 3 seconds how are you measuring query time btw also what client library are you using
Dayglor
DayglorOP3y ago
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.
nebula
nebula3y ago
okay, lets refocus this thread specifically on question 1, can you open a new thread for question 2?
Dayglor
DayglorOP3y ago
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
nebula
nebula3y ago
what language is the backend written in, and what client library does it use
Dayglor
DayglorOP3y ago
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
nebula
nebula3y ago
yeahh thats pretty bad cc @wyzlle any clue as to whats up here?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Dayglor
DayglorOP3y ago
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?
nebula
nebula3y ago
3 seconds is well over the maximum latency caused by distance
Dayglor
DayglorOP3y ago
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
angelo
angelo3y ago
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
Dayglor
DayglorOP3y ago
Of course
nebula
nebula3y ago
3 seconds seems excessive
angelo
angelo3y ago
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
Dayglor
DayglorOP3y ago
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...
Want results from more Discord servers?
Add your server