R
Railway•12mo ago
Wukong

Need help with estimating possible service cost on Railway

We made a nodejs application that sends out emails to a lot of users (like 300k - 400k) using sendgrid api. While I'm excited to keep using Railway as hosting platform for our projects, I'm very concerned how much Railway would charge us for possible network bandwidth/RAM/CPU usage. We don't want to end up in situations like Railway charging us $10k (like crazy AWS bills 😄 ).. so if you can help us estimate the possible cost in the scenario like our application. Thanks in advance!
42 Replies
Percy
Percy•12mo ago
Project ID: 330924c6-f27a-45c6-a607-8a0bb0d88515
Wukong
WukongOP•12mo ago
330924c6-f27a-45c6-a607-8a0bb0d88515 ^ this is the service I'm referring to
Brody
Brody•12mo ago
just visit the account usage page https://railway.app/account/usage
Wukong
WukongOP•12mo ago
yeah i usually check that but can you let me know how to estimate that for some scale of users? e.g. let's say we want to do with 1k users first, then how can I check the usage of bandwidth/cpu/memory?
Adam
Adam•12mo ago
The estimated usage of your app is adaptive according to the usage you put through it. I would incrementally increase the amount of traffic you put through it, fake or real. Increase that every 2 days so you get an accurate representation. Once you have 4 or 5 data points you'll be able to graph a decent estimation
Wukong
WukongOP•12mo ago
Ok makes sense, will do so, thanks @Adam I also have another Q; it's about general usage of internal networks between projects. We have 2 services deployed; one is REST API, and the other is node.js script, api consumer. I believe using internal network IP of REST API would cost less bandwidth, and be faster because using the external host goes through the internet (also DNS requests) etc?
Adam
Adam•12mo ago
I don't believe it would be faster, but using the internal IP eliminates network charges entirely
Brody
Brody•12mo ago
(it is faster) (dont use ips, use the internal domains)
Wukong
WukongOP•12mo ago
No description
Wukong
WukongOP•12mo ago
this one?
Adam
Adam•12mo ago
Yep agreed, missed that part of your question. Railway uses dynamic IPs, so you can't connect to an app through its IP. Use the private networking url Yes
Wukong
WukongOP•12mo ago
ok awesome is it same for connecting to postgres db? and redis?
Adam
Adam•12mo ago
Yes
Wukong
WukongOP•12mo ago
they have private URLs ok awesome
Adam
Adam•12mo ago
As long as the DB is on Railway, yes
Wukong
WukongOP•12mo ago
yes we have everything on Railway
Brody
Brody•12mo ago
and in the same project, and is a database v2 service (has a volume)
Wukong
WukongOP•12mo ago
@Brody btw I started Postgres db migration like 20 mins ago, and it's still going on. I just realized I should've not started this operation when the dashboard is having issues atm 😅 We have data like size of 15mb, so it shouldn't be taking that long. Would you be able to check what could be wrong?
No description
Wukong
WukongOP•12mo ago
cc @Adam
3f75e955-9331-42d7-9712-eb29caa447e2
3f75e955-9331-42d7-9712-eb29caa447e2
this is the uuid of the postgres plugin
Brody
Brody•12mo ago
neither of us work for Railway, so I'll have to tag in @jr
Wukong
WukongOP•12mo ago
Aha okay. Thanks in advance jr for taking a look
jr
jr•12mo ago
migration just completed successfully I just poked it as it was having trouble reading the logs indicating that everything migrated
Brody
Brody•12mo ago
@Wukong can you confirm your data is all in place on the new database?
Wukong
WukongOP•12mo ago
Yeah it worked, thanks jr
Brody
Brody•12mo ago
awsome, be sure to use the private url now!
Wukong
WukongOP•12mo ago
Yeah, I actually have a problem with that. 1 out of 3 services is having trouble connecting to the postgres db through internal URL (2 other services are working fine)
Brody
Brody•12mo ago
yeah there do be some issues sometimes, what is the specific error youre getting?
Wukong
WukongOP•12mo ago
It's typical db connection error
PrismaClientInitializationError: Can't reach database server at `postgres.railway.internal`:`5432`

Please make sure your database server is running at `postgres.railway.internal`:`5432`.
PrismaClientInitializationError: Can't reach database server at `postgres.railway.internal`:`5432`

Please make sure your database server is running at `postgres.railway.internal`:`5432`.
Brody
Brody•12mo ago
and you can access it publically right?
Wukong
WukongOP•12mo ago
yes, using public URL I have 2 other services using this type of internal URL and they just work fine
Brody
Brody•12mo ago
are you using variable references on your railway service? (to referance the private url?)
Adam
Adam•12mo ago
Is the service inside the project? The private URL only works between services in the same project
ThallesComH
ThallesComH•12mo ago
Private networks take sometime to initialize on deploy, you can add a simple sleep 10 in the start of your npm script. Also, private networking isn't available during build phase
Brody
Brody•12mo ago
woah woah 10 is overkill, 3 is sufficient
ThallesComH
ThallesComH•12mo ago
i had a case where 10 seconds was the minimum to start, but yeah try with 3 seconds first
Wukong
WukongOP•12mo ago
I just found that I have the same issue with connecting to Redis through its private URL.
default: getaddrinfo ENOTFOUND redis.railway.internal +2005ms

Error: getaddrinfo ENOTFOUND redis.railway.internal
default: getaddrinfo ENOTFOUND redis.railway.internal +2005ms

Error: getaddrinfo ENOTFOUND redis.railway.internal
Brody
Brody•12mo ago
are you using ioredis?
Wukong
WukongOP•12mo ago
yes
Wukong
WukongOP•12mo ago
and also postgres connection (through internal url) is intermittently working.
No description
Wukong
WukongOP•12mo ago
db connection worked from 00 - 03:05, then at 04:05 it didn't work
Brody
Brody•12mo ago
that I don't know anything about, sorry
Want results from more Discord servers?
Add your server