Binary Data: Filesystem/S3 Instead of Database
Binary data in memory or in the database slows n8n down. Filesystem and S3 mode solve the problem, with the right variables.
n8n keeps binary data in RAM: 100 PDFs can crash the server. Here's how Filesystem or S3 mode helps prevent memory explosion.
When a workflow suddenly has to process 100 PDFs at once, it looks like a simple task on paper: read files, extract text, pass them on. In practice, this workflow often crashes in the middle of execution, the n8n container is restarted, and the log only shows a sobering "Out of memory". The reason is almost always in the same place: n8n keeps binary data in RAM by default, not on disk.
For individual files or small images, this hardly matters. But once you process dozens or hundreds of PDFs, scans, or attachments in a single run, each individual file adds to the RAM consumption of the process until the server or container reaches its limit. You can avoid this reproducibly without rebuilding the workflow itself if you know which lever to turn. This article shows why the memory explosion happens and how to control it through the right binary data mode.
n8n technically distinguishes between the actual workflow data flow and so-called binary data, that is, files like PDFs, images, or Excel attachments that flow through a workflow. According to the official documentation on binary data, n8n keeps this data in RAM by default, which is unproblematic with small amounts of data, but quickly leads to performance issues with large files or many files at once. There is no built-in brake: n8n neither limits how many files a workflow holds at once, nor does the software automatically reserve memory for a node. A workflow that reads 100 PDFs from a mailbox or folder and processes them with the Extract-from-File node can thus consume more RAM file by file until the container reaches its limit and crashes.
A user in the n8n community forum describes this exact pattern: when migrating around 2,000 records with 150 to 200 attachments each, the workflow regularly broke on an 8-GB VPS after about 50 processed files because the default mode kept all binary data in RAM. The effect is the same with 100 PDFs as with 2,000 attachments, just becomes visible more quickly if your server is thinly provisioned.
n8n offers several storage modes for binary data, controlled via the environment variable N8N_DEFAULT_BINARY_DATA_MODE:
Important for multi-worker setups: According to documentation, n8n does not support Filesystem mode in Queue mode. In that case, database mode must be used instead, unless shared storage is available.
For most single-instance setups, switching the mode to Filesystem is sufficient:
N8N_DEFAULT_BINARY_DATA_MODE to filesystem.The community user from the thread mentioned above describes the effect as follows: the memory curve remained permanently low after the switch and the previous spike completely disappeared. For a workflow that processes 100 PDFs at a time, this is usually already the complete solution, without any code changes to the workflow itself.
If your n8n instance runs in Queue mode with multiple workers on separate machines, local disk storage helps only partially because not every worker automatically has access to the same files. For this case, the documentation on external storage describes the S3 connection. It is configured via several environment variables:
N8N_EXTERNAL_STORAGE_S3_HOST, N8N_EXTERNAL_STORAGE_S3_BUCKET_NAME and N8N_EXTERNAL_STORAGE_S3_BUCKET_REGION for the target infrastructure.N8N_EXTERNAL_STORAGE_S3_ACCESS_KEY and N8N_EXTERNAL_STORAGE_S3_ACCESS_SECRET for the access credentials.N8N_AVAILABLE_BINARY_DATA_MODES=filesystem,s3 and N8N_DEFAULT_BINARY_DATA_MODE=s3 to actually enable the mode.Important to know: According to documentation, S3 connection requires a valid Enterprise license, without which n8n will not start in this mode. Additionally, you should set up a lifecycle policy in the bucket that automatically deletes old binary data, as n8n does not clean up there itself.
Even with Filesystem or S3 mode, your storage needs continue to grow if old executions are never deleted. The documentation on managing execution data describes the following variables for this:
EXECUTIONS_DATA_PRUNE enables automatic cleanup.EXECUTIONS_DATA_MAX_AGE specifies after how many hours a completed execution is considered deletable, default value 336 hours, that is 14 days.EXECUTIONS_DATA_PRUNE_MAX_COUNT additionally limits the maximum number of stored executions, default value 10,000.EXECUTIONS_DATA_HARD_DELETE_BUFFER provides a grace period of one hour by default before data is permanently removed.A detail that is easily overlooked: according to documentation, cleanup always only affects the currently active binary data mode. So if you switch from Filesystem to S3, old files may remain on the local disk and need to be manually removed.
If you're unsure which mode fits your setup, or if an existing n8n workflow regularly crashes with larger PDF quantities, we'd be happy to look at it together as part of our n8n automation services. As digital workers, we set up the configuration cleanly once, document it, and hand it over to you so that afterward you maintain control over your server resources.
Because in the default mode, each individual file occupies additional RAM. With few small files, enough buffer remains, but with each additional PDF in the same run, RAM consumption continues to rise until the available memory of the container or server is exhausted and the process crashes.
Yes, in most single-instance setups, because the files then lie on disk instead of in RAM and RAM consumption per execution drops significantly. If you run in Queue mode with multiple separate workers, you additionally need either shared storage or S3 mode, because n8n does not support Filesystem mode there.
Yes. According to official documentation, S3 connection for binary data is tied to a valid Enterprise license, without which the instance will not start in S3 mode. For smaller setups without multiple worker machines, the free Filesystem mode is usually the simpler and sufficient solution.
n8n does not automatically clean up the folder, but instead ties cleanup to execution data pruning settings like EXECUTIONS_DATA_PRUNE and EXECUTIONS_DATA_MAX_AGE. If pruning is active, old executions including their binary data in active mode are regularly removed. If pruning is disabled, the folder continues to grow indefinitely.
Founder of NordFlux. Spent four years automating processes at enterprise scale at Dräger, and now brings that depth to the mid-market — pragmatic and with full data sovereignty.
Certifications
Binary data in memory or in the database slows n8n down. Filesystem and S3 mode solve the problem, with the right variables.
How n8n uses the MCP Server Trigger and MCP Client to provide workflows as tools for Claude or to use external MCP servers.
How to install n8n with Docker Compose: Postgres instead of SQLite, .env, volumes and updates step by step.
Filesystem or S3 mode for binary data is quick to configure, but someone has to keep an eye on memory usage and execution data permanently so the next batch of PDFs does not block everything again. NordFlux provides managed n8n operations on your infrastructure or in our hosting, including memory monitoring and automatic cleanup of old execution data. In the first conversation we look at your current binary data configuration.