Railway Metal Slow Latency with US Oregon Database Service and Cannot Rollback
codelover
PROOP

10 months ago

Hello. I have just deployed my project to railway Metal Server (EU Amsterdam) and realized extremely slow requests (increased latency) probably because my Database is deployed in US Oregon (non-metal) server. Before the migration, the app was very very fast. Now I would like to revert back the non-metal server is no longer visible in the Regions section of the project settings. I can't also migrate the database to metal because it has a volume attached. You help will be really appreciated. Thanks

6 Replies

brody
EMPLOYEE

10 months ago

Hello,

Be sure to enable the Metal Volumes feature flag here -

https://railway.com/account/feature-flags

Then you will be able to move the volume.

Additionally, please make sure you are using the private network for service to database communications.

Best,
Brody


Status changed to Awaiting User Response Railway 10 months ago


codelover
PROOP

10 months ago

OK. Thanks. I just enabled volume migration. I'll try that. I hope I won't lose any data while migrating the database


Status changed to Awaiting Railway Response Railway 10 months ago


codelover
PROOP

10 months ago

I have migrated the volume to METAL too but I still experience slow requests. I also migrated my domain to metal edge but that didn't help neither. I am also not sure if I get what you mean by using "Private Network for service to database communication." In my project, I point to the database using variable reference. Is that not the same? Is it about using *.railway.internal as db host? Could this also be due to my using Nickpacks builder or my procfile?

This is my procfile content to start the celery worker and the gunicorn server (it was working all fine before migrating to metal):
web: celery -A config worker --loglevel=info --concurrency=6 & python manage.py migrate && gunicorn config.wsgi:application --bind [::]:$PORT

After reading the Internal Network Docs, I changed:
MySQL SERVICE
Mysqlhost to = ${{RAILWAY_PRIVATE_DOMAIN}}
In Mysql url I changed the RAILWAY_TCP_DOMAIN_PROXY... to {{RAILWAY_PRIVATE_DOMAIN}} and ...TCP_PORT... to {{ MYSQLPORT }}
I also changed MYSQLPORT to 3306

Thank you in advance for your help.


codelover
PROOP

10 months ago

I've been able to solve it now. It had to do with the private network setup. Thank you


Status changed to Solved codelover 10 months ago


codelover

I've been able to solve it now. It had to do with the private network setup. Thank you

therealbryanho
PRO

10 months ago

Hey, can you please share how did you solved it?


Status changed to Awaiting Railway Response Railway 10 months ago


therealbryanho

Hey, can you please share how did you solved it?

codelover
PROOP

10 months ago

Sure. Here is what I did (it was in the database service). In the RAW Variables Editor, I changed :

DATABASE HOST Variable Value to = ${ RAILWAY_PRIVATE_DOMAIN } (It was RAILWAY_TCP_PROXY_DOMAIN)
DB PORT Value to = 3306 (That's the default for MySql databases)

the RAILWAY_TCP_DOMAIN_PROXY... to ${ RAILWAY_PRIVATE_DOMAIN } and RAILWAY_TCP_PROXY_PORT to -> {{ MYSQLPORT }}

If you find other instances of RAILWAY_TCP_PROXY_DOMAIN in your project service variables you should change it to RAILWAY_PRIVATE_DOMAIN

After those changes the warning icons disappeared and everything was working fine. My requests became as fast as they were (if not faster).

Note: In the documentation, I read that "Since the private network is an IPv6 only network, applications that will receive requests over the private network must be configured to listen on IPv6. On most web frameworks, you can do this by binding to the host ::"

For example if you are using a procfile : gunicorn app:app --bind [::]:$PORT


Loading...