n8n Production Configuration: Security and Scaling

2026.05.13
Technology
770 Words
n8n Production Configuration: Security and Scaling

n8n Deployment: Production Configuration Guide

Part 3 of 3: Part 1: Docker Compose Setup | Part 2: Kubernetes Manifest Guide

Configuration Deep Dive

Here are the settings I always tune from their defaults.

ParameterDefaultMy Production ValueImpact
EXECUTIONS_MODEregularqueueEnables horizontal scaling
QUEUE_BULL_REDIS_DB01Isolates n8n from other Redis users
N8N_CONCURRENCY_PRODUCTION_LIMIT-150Prevents resource exhaustion
EXECUTIONS_TIMEOUT3600300Kills runaway workflows
N8N_DEFAULT_BINARY_DATA_MODEdefaultfilesystemHandles large files without memory bloat

Verification and Testing

After deployment, run these checks.

Health Check

Terminal window
# Docker
curl -s http://localhost:5678/healthz | jq .
# Expected: {"status":"ok"}
# Kubernetes
kubectl exec -n n8n deployment/n8n-main -- wget -qO- localhost:5678/healthz

Smoke Test: Create a Simple Workflow

  1. Log in to the editor.
  2. Create a workflow with a Schedule Trigger (every minute) and a Code node that returns { "status": "ok" }.
  3. Activate it.
  4. Check Executions: you should see green checkmarks every minute.

Load Test

Use the n8n CLI or a simple shell loop to fire webhooks:

Terminal window
for i in {1..100}; do
curl -X POST https://hooks.yourdomain.com/webhook/test \
-H "Content-Type: application/json" \
-d '{"payload":"test"}' &
done
wait

Monitor worker CPU and Redis memory during the test.

Production Considerations

High Availability

  • Run 2+ n8n-main replicas behind a session-aware load balancer if you need HA for the UI. Note that n8n uses local memory for some state, so sticky sessions or a single replica is simpler.
  • Run 3+ workers minimum. Scale based on queue depth.
  • Use PostgreSQL with backup. I run pg_dump nightly to S3-compatible storage.

Monitoring

I monitor these metrics:

MetricSourceAlert Threshold
Queue depthRedis LLEN bull:jobs> 100 for 5 minutes
Worker CPUKubernetes metrics> 80% for 10 minutes
Failed executionsn8n API /executions> 5% in 10 minutes
Database connectionsPostgreSQL pg_stat_activity> 80% of max

Update Strategy

Pin the n8n image tag to a specific version, never latest. My update flow:

  1. Test the new version in a staging namespace.
  2. Update the image tag in Git.
  3. Roll out with kubectl rollout restart.
  4. Watch executions for 30 minutes.
  5. Rollback with kubectl rollout undo if error rates spike.

Troubleshooting

Error MessageCauseSolution
ECONNREFUSED 127.0.0.1:5432n8n cannot reach PostgreSQLVerify service name and network connectivity
Queue is not enabledWorker started without queue envSet EXECUTIONS_MODE=queue on main and QUEUE_BULL_REDIS_HOST on workers
Encryption key not setN8N_ENCRYPTION_KEY missingAdd it to secrets and restart
Webhook 404Workflow not active or wrong URLActivate the workflow and check the webhook path
Out of memoryWorkers exceeding limitsIncrease memory limit or add more workers

FAQ

What is n8n, and how does it differ from Zapier?

n8n is an open-source workflow automation platform. Unlike Zapier, you self-host it, which means you own your data, your credentials never leave your infrastructure, and you are not bound by usage tiers or rate limits.

Do I need a GPU to run n8n?

No. n8n itself runs on CPU only. You only need a GPU if you connect n8n’s AI Agent node to a self-hosted LLM like Ollama or vLLM running on the same cluster.

What is queue mode, and when do I need it?

Queue mode separates the web UI from workflow execution workers using Redis as a job queue. You need it as soon as you run more than a handful of concurrent workflows or require horizontal scaling.

Can I run n8n without PostgreSQL?

Yes, n8n ships with SQLite by default. However, SQLite does not handle concurrent writes well and will corrupt under load. Use PostgreSQL for any serious deployment.

How do I back up my n8n instance?

Back up two things: the PostgreSQL database (pg_dump) and the ~/.n8n directory (or the mounted volume) which contains encryption keys and local binary data. Without the encryption key, your credentials are unrecoverable.

Is n8n’s AI Agent node production-ready?

It is ready for internal tooling and alert triage. I would not yet trust it with autonomous remediation in production without human approval gates. Always keep a human in the loop for destructive actions.

How do I secure webhooks exposed to the internet?

Use a dedicated subdomain, enable TLS, add header-based authentication, and IP-allowlist where possible. Consider putting webhooks behind a reverse proxy with rate limiting.

Can I use n8n with vLLM instead of Ollama?

Absolutely. Both expose an OpenAI-compatible API. Point the HTTP Request node or the OpenAI Chat Model node at your vLLM service URL and set the model name accordingly.

Next Steps

You now have a production-ready n8n deployment with queue mode, encrypted credentials, and AI Agent capabilities. Here is what to explore next:

If you hit issues not covered here, drop a comment with your setup details and I will help you debug it.


Parts in this series: Part 1: Docker Compose Setup ← | Part 2: Kubernetes Manifest Guide ←

# N8N # ai-automation # workflow # docker # Kubernetes # redis # postgresql # deployment # self-hosted