2 months ago
Hi, I would like to receive information about my costs - i want to know why i pay around 15$, when our usage is not big, i see 99% of cost is RAM: When i go to network flow logs that i see something like this:
Maybe its something like we are getting pinging all the time? Can you please tell me why we haev billings and RAM like this and maybe its the problem from the Railway side?
Greetings
Kornel
Pinned Solution
2 months ago
Screenshots are of 1 hour. Graph for last 7 days will help more. Although below can be issue and fixes:-
- If RAM graphs always goes up and never come down, there can be memory leaks(see failed requests) or unhandled errors on application level which can be fixed from application.
- A quick fix can be to restart application after specific duration or memory limit which will reduce cost. You can use this template to do this https://railway.com/deploy/1FHSG9
6 Replies
Status changed to Awaiting Railway Response Railway • 2 months ago
2 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 • 2 months ago
2 months ago
What kind of service is this and how much RAM does it consume on average if you look at the usage charts? Memory being 99% of the cost is fairly normal.
2 months ago
It looks like you have cpu & ram heavy application. Can you take screenshot of ram usage of last 7 days and network logs to get exact issue. Possible issue can be:
- High RAM is used from the application but memory not freed even when process finished. (Check by restarting deployment if RAM goes down). This can be fixed.
- Your application is using something related to AI which can be deployed to GPU. Railway don't have GPU, so these AI related stuff loads in RAM and use higher cpu which increases cost too much.
2 months ago
I have 2 envoirments with one spring boot BE, and PG database:
this is memory, numbers of requests and Public Network Traffic
2 months ago
First things first, Railway is a good serverless platform. If you are using RAM every second, I thing you should reconsider. But also if it make sense for your service to only use the memory when a call is made to your service, there is an option to make it serverless in the settings.
Also, it can further help if you can make this a lambda function that could work using Hono / Bun
2 months ago
That kind of cost is expected with memory usage that high, I would look into ways to decrease your memory usage such as:
- Java args with custom start command: -XX:+UseSerialGC -Xss512k -XX:MaxRAM=72m
- Editing the application.properties file: server.tomcat.max-threads = 1 (or any other value you want)
- Any other args/config that you may find to decrease memory
This will very likely decrease the performance of your app so change stuff around as you see fit
cornyy
I have 2 envoirments with one spring boot BE, and PG database:  this is memory, numbers of requests and Public Network Traffic 
2 months ago
Screenshots are of 1 hour. Graph for last 7 days will help more. Although below can be issue and fixes:-
- If RAM graphs always goes up and never come down, there can be memory leaks(see failed requests) or unhandled errors on application level which can be fixed from application.
- A quick fix can be to restart application after specific duration or memory limit which will reduce cost. You can use this template to do this https://railway.com/deploy/1FHSG9
Status changed to Solved brody • 13 days ago