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.
30 Replies
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.
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.
6 months ago
Link to the service please.
6 months ago
A link to the Railway service.
pretty new to the platform, not sure what you mean by a link to the railway service
6 months ago
Just open the service and send the URL.
6 months ago
Yep, the UI is correct, here is the raw data points for the memory usage graphed (6hr window).

6 months ago
Looks like the UI is even rounding down.
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
I figured it it was accurate the estimated usage would be a good amount higher
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.
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.
yeah I suppose that makes a bit more sense, everything else reduced pretty significantly after fixing the leak as well
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.
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+.
6 months ago
Just another day as a JavaScript developer, to be honest, and I'm not even joking.
🤣 yeah it's been fun so far. whole other world when you have to figure out how to debug issues only in production lol
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.
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.
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?
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.
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.
6 months ago
@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-alpineinstead 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.
