๐ŸŽ“Iris Courses
โ† AI Automation Mastery
Day 20 of 21

Scaling and Operations

Scaling n8n for Production

The default n8n deployment runs in a single process and uses SQLite for its database. This works fine up to ~100 workflow executions per day. Beyond that, you need a more robust setup. Scaling from SQLite to Postgres: n8n's production configuration replaces SQLite with Postgres for its internal database. This enables multiple n8n instances running simultaneously (horizontal scaling) and supports much higher execution volume. The n8n documentation covers this configuration โ€” it requires setting database environment variables and running a Postgres instance. Queue mode: n8n's queue mode separates the main process (which handles the UI and workflow management) from worker processes (which actually execute workflows). You can run 1-10 workers depending on your volume needs. Workers pull jobs from a Redis queue. This architecture scales to thousands of executions per day. High availability: for automation workflows that your business depends on (payment processing, customer communications), you need redundancy. Run at least two n8n worker instances. Use a load balancer in front of your webhook endpoints. Use managed Postgres (not self-managed) to ensure database uptime. Monitoring at scale: the n8n UI is sufficient for small deployments but inadequate for production monitoring. Integrate n8n's execution data with a monitoring tool. Export execution metrics to Grafana or Datadog. Set alerts on: execution error rate exceeding 5%, queue depth exceeding 100 pending jobs, and workflow execution time exceeding 2x the normal duration.

Operational Disciplines

Running automation infrastructure in production requires engineering discipline that goes beyond building the initial workflows. Documentation: every production workflow needs documentation describing its purpose, trigger, expected inputs and outputs, external dependencies (which APIs and credentials it needs), and known edge cases and limitations. Store this in a README file in your n8n workflow notes or in a shared Notion document. Change management: treat automation workflows like production code. Test changes in a staging environment before deploying to production. Use n8n's workflow versioning to track changes. Never modify a running production workflow without a rollback plan. Staging environment: run a separate n8n instance pointing to test API credentials (Stripe test mode, staging database, sandbox webhook endpoints). All new workflows are built and validated in staging before deploying to production. On-call procedure: define who is responsible for automation failures and how they'll be notified. The Error Workflow from Day 7 handles alerting. The on-call person needs access to n8n, the database, and the deployment infrastructure to investigate and fix issues. Cost management: track your automation costs explicitly. API costs (AI model calls, third-party data APIs), infrastructure costs (n8n hosting, database, Redis), and labor costs (developer time to build and maintain). Review costs monthly and eliminate underused workflows. Automation that no longer provides value is just a cost center.

โšก Today's Action

Calculate the total cost of your current automation stack: hosting + API fees + time to build and maintain. Then calculate the time saved across all workflows. If the ROI isn't at least 5:1, identify and cut the underperforming workflows.

๐Ÿ’ก Pro Tip

Set up n8n's built-in execution pruning (delete executions older than 30 days) but also export execution metadata to your own database before pruning. This gives you long-term visibility into automation performance trends without unbounded storage growth.