Reduce memory usage

falconwingz88
FREE

4 days 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 ?

$10 Bounty

1 Replies

falconwingz88
FREE

4 days ago

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


falconwingz88
FREE

4 days ago

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


falconwingz88
FREE

4 days ago

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


mmuflih
FREE

2 days 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