high network cost
Anonymous
HOBBYOP

5 months ago

Hello,

I am unsure why do i see a lot on network egress cost. I am building the app, its not even having customers now. Its just me testing, how can it show me 5GB of egress happening all time.

$10 Bounty

5 Replies

5 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 5 months ago


dardameiz
PRO

5 months ago

You’re almost certainly using public URLs to connect to your database instead of private networking.

This is the number one cause of unexpected egress costs on Railway. Even though you’re just testing, every database query goes out to the internet and back, racking up egress fees.

Fix:

1. Go to your database service and click the Variables tab

2. Find the RAILWAY_PRIVATE_DOMAIN (looks like postgres.railway.internal)

3. Update your DATABASE_URL or DATABASE_HOST to use this private domain instead of the public URL

Example:

• Instead of: DATABASE_HOST=containers-us-west-XXX.railway.app

• Use: DATABASE_HOST=postgres.railway.internal

Make sure your database and app are in the same Railway project - private networking only works within one project.

After this change, your egress should drop from GBs to basically nothing. People have reported going from 350MB/min to 10KB after this fix.


Anonymous
HOBBYOP

5 months ago

I am using mongodb atlas not hosted in postgres railway. mongodb atlas dont show any network graphs that would say that database calls are such high.


dardameiz
PRO

5 months ago

Ah yeah, external MongoDB makes sense why the private network thing won’t help.

5GB is still weird for just testing though. Have you set up connection pooling? maybe you pull back way data more than you need? you could check when the spikes happen in the metrics for egress


dardameiz
PRO

5 months ago

could you solve it? 🙂


fra
HOBBYTop 5% Contributor

5 months ago

Do you upload media on external services? Like S3,R2,gap buckets?


Welcome!

Sign in to your Railway account to join the conversation.

Loading...