By Orch8 Engineering · Editorial policy
n8n Out of Memory on Large PDFs and CSVs
Measure where memory rises first: download, decoded input, parser, or execution retention. Keep large bytes in the supported binary storage for your deployment or pass a versioned reference to a worker that can stream the file.
What is the practical answer?
Measure where memory rises first: download, decoded input, parser, or execution retention. Keep large bytes in the supported binary storage for your deployment or pass a versioned reference to a worker that can stream the file. Use a fixed corpus of sample PDFs and CSVs with recorded sizes. Run one file at a time to locate the stage that consumes memory, then repeat at your normal concurrent load. Record peak process memory and container limits alongside latency. A 50 MB compressed document can expand into much more runtime data, and logging large node outputs can obscure which step created the peak. Check n8n’s binary-data documentation for the storage modes supported by your deployment, particularly in queue mode. Moving bytes out of workflow state can reduce retention and serialization overhead, while a parser that builds a full in-memory tree can still exhaust a worker on its own.
Evidence: n8n binary-data storage and scaling · Reddit enterprise n8n and large-file processing discussion
- Receive fileInput
- Store versioned objectProcess
- Measure memory under loadDecision
- Return results by referenceExternal action
Measure peak memory under concurrency#
Check n8n’s binary-data documentation for the storage modes supported by your deployment, particularly in queue mode. Moving bytes out of workflow state can reduce retention and serialization overhead, while a parser that builds a full in-memory tree can still exhaust a worker on its own. Treat those as separate bottlenecks you can measure independently.
| What you find | What to do |
|---|---|
| Process memory jumps during download | verify streaming and temporary storage behavior. |
| Memory climbs during parse at fixed input size | profile the parser and reduce parallelism. |
| Memory grows with retained outputs | remove large intermediate content from execution data where supported. |
Move the work across a clear boundary#
Store the file under an immutable object version and send the worker its identity, expected size, checksum, and job ID. Return only the result fields and a reference to the artifact. Limit concurrent parsing based on measurements. If the worker is idle but the orchestrator still holds copies, inspect intermediate outputs and retention settings before increasing infrastructure limits.
Design a fair file-handling experiment#
Build a matrix with small, typical, and high-percentile file sizes and at least one unusual input such as a PDF with embedded images. Fix the worker and orchestrator limits, parser version, and file count for both implementations. Record peak resident memory for each process and the number of documents successfully consumed. Label measurements with their environment rather than treating them as universal thresholds.
For the reference-based version, measure transfer and temporary storage alongside memory. Streaming reduces some copies, but file reading and decoding can still need a bounded buffer. Confirm garbage collection and completed execution retention do not add unbounded pressure across repeated runs. Verify the same input yields equivalent extracted fields before calling a memory improvement meaningful.
Verify it with a failure drill#
Process the same fixture set through a bytes-in-state path and an object-reference path. Keep input, worker concurrency, and parser versions fixed.
- Compare peak memory and results across both, then restart one worker mid-file and verify the reference can be reopened without yielding a duplicate result.
Sources and further reading
Official references support technical claims; community discussions are used only as problem signals.