Unexpected High Billing – Please Review Memory & Database Usage
fares-sghaier
PROOP

12 days ago

Hello Railway team,

I am contacting you because my monthly usage and charges have increased significantly, and I need clarification about what is causing these costs.

Here is my current situation:

Total Usage (Oct 31 – Dec 1):

Current Usage: $29.01

Pro Plan Fee: $20.00

Estimated Next Bill: $32.20

Main concern:
My memory usage shows 121,871.49 minutely GB, which is generating $28.21 in charges — this seems extremely high for my workload.

Additionally, my database project (DataBase_Etafakna) is costing $13.05 by itself, and I need to understand what is driving this consumption (memory, CPU, or internal overhead).

Here is what I need help understanding:

Why is my memory usage so high?

I want a precise breakdown per service.

Are any services stuck, restarting, or leaking memory?

Is there any runaway process or container staying up unnecessarily?

Database pricing details:

What is causing most of the cost (memory, CPU, storage, queries, background load)?

Is my database over-provisioned by default?

Are there optimizations or configurations recommended to significantly reduce this cost?

Are there any misconfigurations on my side that could be generating unnecessary consumption?

For example:

services running even when idle

processes not sleeping

logs or workers running constantly

containers not scaling down

I need a full detailed breakdown of usage per project and per resource, especially memory and database.

I want to understand clearly why my bill is already at this level and how I can reduce it effectively.

Thank you for your assistance — I’m waiting for your clarification so I can optimize my setup and avoid unnecessary charges.

Best regards,

Solved$20 Bounty

42 Replies

Expand the "DataBase" project, and press on "view cost by service" in the bottom right


dev
MODERATOR

12 days ago

My memory usage shows 121,871.49 minutely GB, which is generating $28.21 in charges — this seems extremely high for my workload.

121,871gb minutely seems like a lot but its only a total of 2.8gb over the span of a month, that's about how much 6 databases would run you for


fares-sghaier
PROOP

12 days ago

i dont have 6 databases


fares-sghaier
PROOP

12 days ago

its only 1 database


dev
MODERATOR

12 days ago

I didn't mean to imply that you have 6 databases, I'm just putting it into perspective


fares-sghaier
PROOP

12 days ago

I understand the perspective you’re giving, but I still need a precise explanation because something doesn’t add up on my end.


fares-sghaier
PROOP

12 days ago

1443613229380014000


dev
MODERATOR

12 days ago

I did 3 calculations:

  1. Pricing calculated based on your minutely memory usage (54400*60*0.00000386 = $12.59)

  2. Pricing calculated based on the RAM usage visible on the graph (~1.4gb) (1.4*27*24*60*60*0.00000386 = $12.6)

  3. Average ram usage based on minutely gb (54400/(60*24*27) = 1.4gb)

and it's all checking out fine for me, based on my math you used about 1.4gb average memory for 27 days, which if you calculate the cost of that comes out to 12.6usd

What's not adding up on your end?


fares-sghaier
PROOP

12 days ago

Thanks for taking the time to calculate everything — I appreciate that.

What’s not adding up for me is why the average RAM usage is around 1.4 GB for a single database that should normally be extremely lightweight.

My actual workload on that database is very small


services can have memory leaks or generally high base memory usage


dev
MODERATOR

12 days ago

what database did you run?


fares-sghaier
PROOP

12 days ago

Mysql


dev
MODERATOR

12 days ago

MySQL is anything but lightweight


dev
MODERATOR

12 days ago

MySQL is the biggest memory hog database I know


dev
MODERATOR

12 days ago

I'd highly suggest using MariaDB instead, it's a drop in replacement and is actually lightweight


fares-sghaier
PROOP

12 days ago

so the issue is from Mysql itself ?


dev
MODERATOR

12 days ago

most likely yea


dev
MODERATOR

12 days ago

or rather, definitely, yea


dev
MODERATOR

12 days ago

Railway's job is to provide the hardware and resources for apps running in Railway to function
if MySQL tells Railway that it needs 1.4gb of memory to function, then Railway provides that memory


dev
MODERATOR

12 days ago

meaning to say, if resource usage is ever a problem, it's 99.999% of the time an issue with the app and not with any sort of Railway configuration


dev
MODERATOR

12 days ago

the only configuration that could help you here is restricting the resources allowed to the container but that would only result in MySQL crashing or performing poorly if it doesn't get the resources it needs


dev
MODERATOR

12 days ago

but I'd recommend using MariaDB instead, it's much better in terms of resource usage


fares-sghaier
PROOP

12 days ago

i cant change to MariaDB it will take a lot of time


fares-sghaier
PROOP

12 days ago

but please i wanna share something


fares-sghaier
PROOP

12 days ago

one second


fares-sghaier
PROOP

12 days ago

look this month

1443622387999445000


fares-sghaier
PROOP

12 days ago

look how it was before


dev
MODERATOR

12 days ago

Yea that checks out for MySQL, its memory usage only increases over time from what I've seen


dev
MODERATOR

12 days ago

likely case is that back then it wasn't using as much memory as it does now


dev
MODERATOR

12 days ago

Unfortunately if you want to use MySQL on Railway, you'd need to face the resource consumption, that's just how MySQL runs


fares-sghaier
PROOP

12 days ago

okay and sry for taking fron ur time


fares-sghaier
PROOP

12 days ago

one last question


fares-sghaier
PROOP

12 days ago

is there any approach that i can use to limit this high bill for the database ?


dev
MODERATOR

12 days ago

no worries


dev
MODERATOR

12 days ago

and yes

Railway Side:

  • You can put account-wide usage limits which will stop all services when reached

  • You can configure service-scoped resource restrictions, this should be visible in the service settings

  • You can (and this is the recommended solution here) use MariaDB instead, which is in most situations a drop-in replacement

There's nothing much you can do on the MySQL side of things, Railway's MySQL already comes with all the optimisations I can think of like disabling log files and disabling performance monitors that uses a lot of resources


fares-sghaier
PROOP

12 days ago

Here’s what I’d like to know:

Are there recommended MySQL configuration tweaks (timeouts, buffer sizes, background task settings) that Railway supports on shared or paid plans?

Are there known patterns with Prisma + Railway MySQL that can trigger histogram update lock waits?

Is there a way to inspect slow queries, locks, or I/O throttling on Railway’s side to confirm the root cause?

Can I perform specific tests or measurements (connection pooling, concurrency limits, read/write patterns) to better understand why histogram updates are timing out?

Is this behavior expected under certain workloads, or is it a sign that the database is approaching its operational limits?

I understand the suggestion to switch to MariaDB, but before making such a major change I want to be sure this is not something that can be solved by:

optimizing my ORM configuration,

adjusting query patterns,

or modifying some MySQL settings that Railway allows.

Any deeper guidance or recommended tests would be appreciated so I can confirm the real source of the issue. Thanks!


dev
MODERATOR

12 days ago

I can't answer many of these because I don't use MySQL and therefore wouldn't know, but I'll answer what I can

Are there recommended MySQL configuration tweaks (timeouts, buffer sizes, background task settings) that Railway supports on shared or paid plans?
I only know of 2, but they're enabled by default now: disabling binary logging and disabling performance monitors

Is this behavior expected under certain workloads, or is it a sign that the database is approaching its operational limits?
That's just the expected behaviour for any MySQL database running on Railway


fares-sghaier
PROOP

12 days ago

okay thanks a lot


dev
MODERATOR

12 days ago

no problem at all


dev
MODERATOR

12 days ago

all clear to mark this as solved? @Fares


fares-sghaier
PROOP

12 days ago

yes


dev
MODERATOR

12 days ago

awesome!


Status changed to Solved dev 12 days ago


Loading...