Wildly Inaccurate Memory Usage. Doesn't Match Billing.
cura-digital
PROOP

6 months ago

I deployed a Payload CMS NextJs project that seems to hover around 2GB-2.5GB memory usage. That's about 10x the memory used when built and ran locally with me spamming the crap out of it. Locally it sits 180MB idle but like 2.2GB idle on deployed project. When I connect with SSH and check memory usage it says it's using 85GB of memory lol. Billing usage estimation says it'll be about $10/mo. So confused.

$20 Bounty

30 Replies

brody
EMPLOYEE

6 months ago

While I cannot help you debug configuration or application level issues, I can speak to the 85GB number.

That would be the memory in use by the virtual host machine, Railway currently uses a container based orchestrator, the side effects of that is the shared kernel, allowing you to view the memory in use by the parent host VM.


cura-digital
PROOP

6 months ago

Yeah, i figured it was something related to that. I don't suspect it's an application or configuration issue tho, I'm fairly certain it's an actual railway UI/reporting issue. The estimated usage billing is even stating it'll be about 1/10th the cost of what the memory usage says it is.


brody
EMPLOYEE

6 months ago

Link to the service please.


cura-digital
PROOP

6 months ago

the project ID?


brody
EMPLOYEE

6 months ago

A link to the Railway service.


cura-digital
PROOP

6 months ago

pretty new to the platform, not sure what you mean by a link to the railway service


brody
EMPLOYEE

6 months ago

Just open the service and send the URL.



cura-digital
PROOP

6 months ago

that work?


brody
EMPLOYEE

6 months ago

Yep, the UI is correct, here is the raw data points for the memory usage graphed (6hr window).

1407198130050564000


brody
EMPLOYEE

6 months ago

Looks like the UI is even rounding down.


cura-digital
PROOP

6 months ago

isn't it $10/GB for memory usage? i fixed a memory leak I had initially launching and now it shows estimated usage at only $6.50 more than the current usage so far


cura-digital
PROOP

6 months ago

I figured it it was accurate the estimated usage would be a good amount higher


brody
EMPLOYEE

6 months ago

There are only 7 days until you are going to be billed, so you aren't going to see the $20 that I think you are expecting to see in the estimate.


brody
EMPLOYEE

6 months ago

If you used a flat 2GB for the entire billing cycle, sure, but you haven't used a flat 2GB for the billing cycle.


cura-digital
PROOP

6 months ago

yeah I suppose that makes a bit more sense, everything else reduced pretty significantly after fixing the leak as well


cura-digital
PROOP

6 months ago

i know you can't help debug, but is there anything normal about seeing a local nextjs project go from 200mb local to 2GB prod? only a few months into leaping from constant wordpress builds into nextjs land and learning a ton. Haven't seen any of my other projects have anyway near that kind of jump.


cura-digital
PROOP

6 months ago

in the process of migrating ~40 sites to Railway btw, great platform


brody
EMPLOYEE

6 months ago

It looks like this was something you introduced on Aug 14th at 6:39 PM UTC, at that point memory really started to spike, climbing to 2GB+.


brody
EMPLOYEE

6 months ago

Just another day as a JavaScript developer, to be honest, and I'm not even joking.


cura-digital
PROOP

6 months ago

🤣 yeah it's been fun so far. whole other world when you have to figure out how to debug issues only in production lol


cura-digital
PROOP

6 months ago

appreciate the help


brody
EMPLOYEE

6 months ago

No problem. Sorry I couldn't do more for you, but we only have so much information on our end. After all, we are just running your code as is and reporting on its usage.


cura-digital
PROOP

6 months ago

no worries, don't expect you to debug stuff. unrelated question, have any experience getting wp-cli to work? since it's a separate image the only thing I can think of is to detach the volume from the main wordpress image and attach it to the wp-cli image during use.


brody
EMPLOYEE

6 months ago

Never heard of "wp-cli" so I'm going to have to say no.

I can bounty this thread, and then perhaps a community member may be able to assist further?


cura-digital
PROOP

6 months ago

not sure exactly what that entails but anyone wanting to use WP on railway is going to be interested in that question. it's the official way to run search/replace or cli operations on wordpress.


cura-digital
PROOP

6 months ago

sorry for being so green 🤣 thanks man


brody
EMPLOYEE

6 months ago

I shall bounty this thread then.

We (Railway) will post this thread with a credit value. Whoever answers your question will be awarded the credits.



@cura-digital
If you still want to keep your container’s real memory usage lower and more predictable, here are a few tips:

  • Use a lean base image like node:24-alpine instead of the full Node image.

  • Build in stages so your production image only contains what it needs (no dev dependencies or build tools).

  • Set Node.js memory limits with ENV NODE_OPTIONS="--max-old-space-size=1024" (or whatever fits your plan).

  • For Next.js + Payload CMS, you can:

    • Disable unnecessary image optimization if you don’t need it.

    • Use caching or incremental/static rendering to avoid heavy in-memory work.

  • Add a healthcheck in your Dockerfile so Railway restarts the container if memory ever spikes.


Loading...