Reduce memory usage
falconwingz88
FREEOP

8 months ago

hi, i'm using railway for N8N workflows
right now i have 4 workflows which none of them is active right now, just unfinished projects. not much nodes.
but my memory is very high, i have tried to upload / download some images accidentaly to local. it seems it stores in railway, how do i clear the disk / memory ?

Solved$10 Bounty

74 Replies

falconwingz88
FREEOP

8 months ago

28e8d793-9a34-4f99-a7c7-43a05daa4f69


falconwingz88
FREEOP

8 months ago

I've tried installing Railway CLI, to my postgres, but no luck


falconwingz88
FREEOP

8 months ago

28e8d793-9a34-4f99-a7c7-43a05daa4f69


mmuflih
FREE

8 months ago

1. Understand What’s Using Memory/Disk

• Memory (RAM): Used for currently running processes. If no workflows are active, memory usage should be minimal.

• Disk (Storage): N8N can save files (like images) in temporary folders (e.g., /tmp or a volume you configured).

Since you mentioned accidentally uploading/downloading images, this likely contributes to disk, not memory, unless you’re processing huge data in-memory.

2. Clear Temporary Files

If N8N is storing files locally inside the container (e.g., image files, temp exports), here’s what to do:

Option A: Redeploy / Restart the Service

• Railway containers are ephemeral. Restarting your service or redeploying it will usually reset the file system.

• On Railway:

• Go to your N8N service

• Click the three dots (⋮) → Redeploy

• This will kill the current instance and start a new one with a clean state (unless you’re using persistent storage volumes).

Option B: Add a Custom Cleanup Node in a Workflow

• You can create a temporary N8N workflow to:

• Use the Execute Command node

• Run: rm -rf /tmp/* or rm -rf ./files/* depending on where files are stored.

• Then disable/delete the workflow afterward.

3. Check If You’re Using Persistent Volumes

Railway allows Persistent Storage:

• If you’re using a volume, files remain across restarts.

• Go to your Railway service settings → Check if persistent volumes are mounted.

• You may:

• Go into the terminal (Railway > Service > Shell) and manually delete files

• Or delete the volume if you don’t need the files.

4. Monitor Resource Usage

• Use Railway’s built-in Metrics tab to see CPU, memory, and disk trends.

• Check for:

• Memory leaks (e.g., improperly handled large JSON blobs, looping workflows)

• Or workflows storing too much to disk


falconwingz88
FREEOP

8 months ago

hello, can anyone help ? my workflow isn't running much things


falconwingz88
FREEOP

8 months ago

but its high


falconwingz88
FREEOP

8 months ago

update

1392130228695994400


falconwingz88
FREEOP

8 months ago

1392130331389329400


falconwingz88
FREEOP

8 months ago

how to reduce disk usage ?


8 months ago

There's not much you can do about optimizing n8n resource usage besides enabling serverless, it all depends on what workflows you are running and according to the metrics you showed just the disk usage seems a bit high.

You have two ways of clearing your volume

  1. If you wanna prevent data loss: Using the FileBrowser template and deleting your uploaded files (remember to follow the template instructions)

  2. If you don't care about the volume data: You can wipe it by right-clicking on the volume -> disconnect volume -> click on it -> settings -> scroll down -> wipe volume -> reattach volume to the service -> redeploy service


falconwingz88
FREEOP

8 months ago

Thanks ! I'll try no.1
Well if i do no.2 i need to relogin and retype all of my API keys gin which is not really a big deal, but i'll try no.1
Thanks for the info. I'll get back to you !


falconwingz88
FREEOP

8 months ago

i think i'm very noob, since i cant find the template instructions to follow to

1392393802786017300


falconwingz88
FREEOP

8 months ago

can't seem to find it


falconwingz88
FREEOP

8 months ago

i tried using pgadmin instead, but i dont understand how to remove files hahaha, helpp

1392402599680016400


falconwingz88
FREEOP

8 months ago

i think i'm wrong, pgadmin and filebrowser is a different kind of browser :/
help


falconwingz88
FREEOP

8 months ago

would love the help


8 months ago

PG Admin is a database client, you can't access files through that.


8 months ago

As you stated, you uploaded files so you need a filebrowser.


8 months ago

You see the disciplined-volume? did you add that? where that volume came from?


8 months ago

You need to disconnect the n8n volume (I think it's the 'Worker' volume, not 100% sure about it though), you can do so by right clicking the volume -> disconnect volume.

Then you need to attach the disconnected volume into the Filebrowser service, you can do so by clicking the Mount button, selecting the Filebrowser service and set the path to /data


8 months ago

Redeploy the Filebrowser service, access it and the files should be visible.


8 months ago

If your uploaded files aren't in the Worker service volume then try the same with the Primary service


8 months ago

If you are still having trouble I can record a video on how to do it by the end of the day (just arrived at my office)


falconwingz88
FREEOP

8 months ago

It s created by the template


falconwingz88
FREEOP

8 months ago

Wow would love to see the video tutorial !


falconwingz88
FREEOP

8 months ago

Because i cant disconnect the volume from my n8n


falconwingz88
FREEOP

8 months ago

The disconnect button isnt there


8 months ago

Yep we had disabled that, had too many users that disconnected or deleted their volume and lost data.


falconwingz88
FREEOP

8 months ago

I see, then how do i clean up my n8n volume ?


8 months ago

Why does it need to be cleaned?


falconwingz88
FREEOP

8 months ago

High usage, i want to cut costs


8 months ago

He uploaded some files to that volume through n8n


falconwingz88
FREEOP

8 months ago

As i stated, Because i only have 3 workflows which all of them are idle. But somehow its taking almost 1 gigs


8 months ago

I would advise against trying anything here, you would be putting yourself at a high risk of data loss


falconwingz88
FREEOP

8 months ago

So, is the solution only to wipe the volume ?


8 months ago

My advise would be simply to leave it as is


falconwingz88
FREEOP

8 months ago

The cost that i pay would pile up, to something i didnt use that much


8 months ago

The database's volume has ~600mb used?


falconwingz88
FREEOP

8 months ago

I believe it will only add up, and no way of cleaning it. And it might be even bigger cost later on if i dont know how to clean the files


falconwingz88
FREEOP

8 months ago

Right now is 1gb


8 months ago

Where do you see that?


falconwingz88
FREEOP

8 months ago

Here


8 months ago

None of those graphs display 1GB?


falconwingz88
FREEOP

8 months ago

Its outdated


falconwingz88
FREEOP

8 months ago

It should be daring-volume, the green one


8 months ago

Maybe so, but they still do not display 1GB as of right now


8 months ago

632MB


falconwingz88
FREEOP

8 months ago

Yes and still it should be cleaned up


falconwingz88
FREEOP

8 months ago

Since i only store 3 n8n workflows there, and alot of API keys which would be a huge hassle of i need to input everything again


falconwingz88
FREEOP

8 months ago

And if i dont know how to clean that up, in the future the price might pile up and gets very expensive monthly


8 months ago

My advise stands, I think medim would agree here


falconwingz88
FREEOP

8 months ago

So there are no solution to cleanup my n8n volume, to cut costs ?


8 months ago

Its at 632MB, we are not at the point to worry about cleaning it up


falconwingz88
FREEOP

8 months ago

Only wiping and re-do everything again


falconwingz88
FREEOP

8 months ago

Yes, i told you that its for future purposes


8 months ago

If you can't access and delete those uploaded files directly through your n8n dashboard it's better to leave it that way than messing with volumes and overcomplicating solutions


falconwingz88
FREEOP

8 months ago

Okay so the solution is when it piles up too much, i need to wipe the volume and re-do everything from scratch


8 months ago

$5GB of data will cost 75 cents


8 months ago

You can do what I suggested but it's complex and can cause a data loss, If you gonna do that to every file you upload then it will become tiresome.


8 months ago

I took a look at n8n forums and seems like you can send delete commands as actions in n8n and delete those files


falconwingz88
FREEOP

8 months ago

As i stated this is for future knowledge if the data has piled up so much. Since i need to know if i can use railway longterm or not


falconwingz88
FREEOP

8 months ago

Yes i want to risk that, but the disconnect volume button isnt there



falconwingz88
FREEOP

8 months ago

Maybe i mis read the bill, but it surprises me to see $13.21

1392577211755925500


8 months ago

There are more costs than just disk


falconwingz88
FREEOP

8 months ago

Oh yea, the highest cost is the memory
Seems i got mixed up from memory and volume while trouble shooting


falconwingz88
FREEOP

8 months ago

Sorry to get distracted, since the title is already memory usage. Its my mistake i searched disk and drag you guys along


falconwingz88
FREEOP

8 months ago

Can i know how to reduce memory usage ?


falconwingz88
FREEOP

8 months ago

I hope that would be easier


8 months ago

The software simply uses the memory it needs, it out of your hands unfortunately


falconwingz88
FREEOP

8 months ago

Ahh 😖 😢 i see


falconwingz88
FREEOP

8 months ago

Is enabling serverless a good idea for my usecase ?


8 months ago

Yes, it's the best you can do, just test it thoroughly to see that it doesn't interrupt any workflows.


8 months ago

!s


Status changed to Solved medim 8 months ago


Loading...