KEEP LEARNING
Build the bigger picture.
The Workflow Engineer connects individual n8n concepts to testing, deployment and running a complete workflow.
Tips > Reliability & Performance
By default, n8n stores binary data (files, images, PDFs) in memory and in the database.
By default, n8n stores binary data (files, images, PDFs) in memory and in the database. This causes out-of-memory crashes and database bloat when handling files larger than 10-20 MB. Two environment variables fix this immediately.
Real-world example: A workflow downloads vendor invoices as PDFs (5-50 MB each), processes them with an OCR service, and archives them to S3. Without these settings, the workflow crashes after the third file.
# .env or docker-compose.yml environment section
# Increase max payload from default 16MB to 256MB
N8N_PAYLOAD_SIZE_MAX=256
# Store binary data on filesystem instead of in database/memory
N8N_DEFAULT_BINARY_DATA_MODE=filesystem
# Set the directory for binary file storage (default: ~/.n8n/binaryData)
N8N_BINARY_DATA_STORAGE_PATH=/data/n8n-binary
# Also increase Node.js memory if processing very large files
NODE_OPTIONS=--max-old-space-size=4096
```text
```yaml
# docker-compose.yml example
services:
n8n:
image: n8nio/n8n:latest
environment:
- N8N_PAYLOAD_SIZE_MAX=256
- N8N_DEFAULT_BINARY_DATA_MODE=filesystem
- N8N_BINARY_DATA_STORAGE_PATH=/data/n8n-binary
- NODE_OPTIONS=--max-old-space-size=4096
volumes:
- n8n_binary:/data/n8n-binary
# ...
volumes:
n8n_binary:
```text
After enabling filesystem mode, binary data is stored as files on disk and only references are passed between nodes. Memory usage drops dramatically.
**Related:** [Flatten Deeply Nested API Responses](../code-node-mastery/01-flatten-deeply-nested-api-responses.md) | [Use Docker Compose with Health Checks for n8n and PostgreSQL](../self-hosting-operations/01-use-docker-compose-with-health-checks-for-n8n-and-postgresql.md)
KEEP LEARNING
The Workflow Engineer connects individual n8n concepts to testing, deployment and running a complete workflow.
APPLY IT TO YOUR SYSTEM
Bring the process, the tools involved and an example of where the current workflow gets stuck.