Strapi API and MySQL Performance Issue
kirillpd
HOBBYOP

a year ago

Strapi and MySQL Performance Issue After Upgrading to Pro Plan

Hello Railway team,

I recently upgraded from the Hobby plan to Pro specifically to set up the same regions for my Strapi CMS and MySQL database (EU West). On the Hobby plan, there wasn't an option to change the DB region to EU West, which I believed was causing performance issues.

I expected that my Strapi REST API (which I use in my Next.js application) would work much faster after this change. However, I've observed some unexpected results:

What I'm Seeing

  1. Local Strapi + Remote DB: When I run Strapi locally and connect to the remote DB hosted on EU West, API calls are extremely fast (~50-150ms) for retrieving 5 articles.

  2. Deployed Strapi + Remote DB: When I use the deployed Strapi URL with the remote DB on EU West region, API calls are still slow (~1.2-1.3 seconds) for the same operation.

Before the region change, a simple request to get 5 articles took around 1.5-2 seconds, so there's been minimal improvement despite both services now being in the same region.

Important Details

  • I use Public Networking to connect to the DB

My Analysis

This performance difference makes me think that the Strapi instance itself is the bottleneck, not the database, since requests are very fast when Strapi runs locally but connected to the same remote DB.

Any suggestions on how to improve or troubleshoot this scenario would be greatly appreciated.

Thank you for your help!

Solved

4 Replies

a year ago

You're using the public URL. You need to use the private URL

https://docs.railway.com/guides/private-networking


Status changed to Awaiting User Response Railway 11 months ago


jake

You're using the public URL. You need to use the private URLhttps://docs.railway.com/guides/private-networking

kirillpd
HOBBYOP

a year ago

Hey Jake, thanks for your response! The private URL really improved the speed. Are there any docs I can check out to understand why performance is so much better with internal URLs? It makes sense logically, but I’d love to understand the full picture slightly_smiling_face emoji

Thanks again!


Status changed to Awaiting Railway Response Railway 11 months ago


a year ago


Status changed to Awaiting User Response Railway 11 months ago


brody

Hello,You can find our docs on private networking here -https://docs.railway.com/guides/private-networkinghttps://docs.railway.com/reference/private-networkingBest,Brody

kirillpd
HOBBYOP

a year ago

Hello,

Thanks for the links. I couldn't find any information about performance benefits of private networking there.
Logically, I understand why it works this way ;)

Thanks


Status changed to Awaiting Railway Response Railway 11 months ago


Status changed to Solved kirillpd 11 months ago


Loading...