Hello n8n community,
I’m currently facing an issue.
I’m building and using n8n, started with Docker. n8n Version: 1.99.1 Server: 8 cores CPUs, 16 GB RAM
My workflow is very light. In my Docker Compose file, I’ve set cpus: '4.0'
, but I’m seeing 100% CPU usage for the Docker container (checked via docker stats
), and one of my server’s CPU cores is also at 100%.
How can I avoid this situation?
Any help would be greatly appreciated.
Thank you!
Hey @tuanqn123qn ,
Would you mind sharing your docker-compose and embedding your Workflow please
Jm
Thank you for taking the time to read my topic.
- Below is the content of my docker-compose.yml file used to deploy n8n:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "127.0.0.1:5678:5678"
cpus: '4.0'
labels:
- traefik.enable=true
- traefik.http.routers.n8n.rule=Host(<MyHost>)
- traefik.http.routers.n8n.tls=true
- traefik.http.routers.n8n.entrypoints=web,websecure
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
- traefik.http.middlewares.n8n.headers.SSLRedirect=true
- traefik.http.middlewares.n8n.headers.STSSeconds=315360000
- traefik.http.middlewares.n8n.headers.browserXSSFilter=true
- traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
- traefik.http.middlewares.n8n.headers.forceSTSHeader=true
- traefik.http.middlewares.n8n.headers.SSLHost=<myhost>
- traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
- traefik.http.middlewares.n8n.headers.STSPreload=true
- traefik.http.routers.n8n.middlewares=n8n@docker
environment:
- N8N_PORT=5678
- N8N_SECURE_COOKIE=false
- NODE_ENV=production
- WEBHOOK_URL=<MyHost>
- GENERIC_TIMEZONE=<>
- EXECUTIONS_DATA_SAVE_ON_ERROR=all
- EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
- EXECUTIONS_DATA_SAVE_ON_PROGRESS=true
- EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false
- EXECUTIONS_DATA_PRUNE=true
- EXECUTIONS_DATA_MAX_AGE=168
- EXECUTIONS_DATA_PRUNE_MAX_COUNT=50000
- QUEUE_MODE=redis
- QUEUE_REDIS_HOST=redis
- QUEUE_REDIS_PORT=6379
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
- N8N_PROXY_HOPS=1
- N8N_RUNNERS_ENABLED=true
- N8N_RUNNER_THREADS=6
- QUEUE_WORKERS=6
- QUEUE_BULL_REDIS_MAX_RETRIES=2
- QUEUE_HEALTH_CHECK_ACTIVE=true
volumes:
- n8n_data:/home/node/.n8n
- /root/n8n-docker/local-files:/files
depends_on:
- redis
redis:
image: redis:7
restart: always
volumes:
- redis_data:/data
command: redis-server --appendonly yes
volumes:
traefik_data:
driver: local
n8n_data:
driver: local
redis_data:
driver: local
If you have any suggestions or improvements, I’d really appreciate your feedback. Thank you once again!
Hey @tuanqn123qn ,
Thanks for posting i believe that yhe high CPU usage is likely caused by the combination of frequent execution (every minute) and multiple resource-intensive operations (3 Gemini API calls + Google Sheets operations)
I’m not sure what can you try can you set it like every 10min once and see if there’s any spike ?
Another thing you can try is give your docker-compose.yml to chatgpt it will refine it for you
Let me know what helps as there are many things to check