9 days ago
What are the recommended resource allocations (CPU, RAM) for a standard n8n instance on Railway to ensure good performance?
Are there any specific n8n environment variables or Railway settings that can optimize performance, especially for workflows with high concurrency or long-running tasks?
For horizontal scaling of n8n, what's the recommended approach on Railway (e.g., using multiple instances, load balancing)? How does this impact shared data like credentials and workflows?
2 Replies
9 days ago
Recommended resource allocations:
CPU: 1–2 vCPU
RAM : 2–4 GB
############# n8n Environment Variables ##########
# Enable queue mode for concurrency and scaling
EXECUTIONS_MODE=queue
QUEUE_MODE=redis
EXECUTIONS_PROCESS=queue
# Optional performance tuning
EXECUTIONS_TIMEOUT=3600
EXECUTIONS_CONCURRENCY=10
EXECUTIONS_DATA_SAVE_ON_ERROR=all
# PostgreSQL DB for workflow and credential storage
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=<your_postgres_host>
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=<your_database>
DB_POSTGRESDB_USER=<your_user>
DB_POSTGRESDB_PASSWORD=<your_password>
# Redis for queue
N8N_REDIS_HOST=<your_redis_host>
N8N_REDIS_PORT=6379
N8N_REDIS_PASSWORD=<your_redis_password>
######### Horizontal Scaling ###########
Add PostgreSQL plugin to your project.
Add Redis plugin (or use Upstash).
Set all the env vars above.
Go to:
Railway → Your n8n Service → Settings → ScalingSet to:
Min Replicas: 1Max Replicas: 3 (or more)
CPU Threshold: 70%
Save and redeploy the service.
7 days ago
Railway provides templates and capabilities to deploy these components, enabling n8n to achieve high performance and scalability:
Use Railway's n8n Pro Stack Template: Railway officially offers an "n8n Pro Stack" template, which pre-configures the n8n main application, Worker, Redis, and PostgreSQL. This is the recommended starting point as it's already optimized for scalability.
Pros: One-click deployment, includes all necessary components, simplifies configuration and management.
Separate Services: Ensure you deploy each n8n component (main application, Worker, Redis, PostgreSQL) as a separate service on Railway. This allows each service to be scaled independently.
n8n Main Application: Handles UI and API requests.
n8n Worker: Responsible for actual workflow execution. By increasing the number of Worker instances, you can significantly boost concurrent execution capabilities.
Redis: Provides fast message passing and caching, reducing latency between the main application and Workers.
PostgreSQL: Serves as reliable data storage.
Status changed to Solved chandrika • 7 days ago