Display Helm Chart Values
1. Improve Resource Allocation
- You can improve the performance of Dify by adjusting the resource allocation for services in the Helm chart values file.
- You can increase these values based on your environment and available resources.
- Recommended configuration for each component:
Notes:
- ① API: Scale replicas horizontally as needed
- ② Worker: Scale replicas horizontally as needed (if there are many files to upload)
- ③ Sandbox: Scale replicas horizontally as needed (if there are many compute tasks)
maxWorkers: 4 (number of worker processes)workerTimeout: 15 (call timeout)
2. Improve External PostgreSQL Performance
2.1 Calculate Database Maximum Connections
When configuring the database, you need to calculate the required maximum connections using the following formula:SQLALCHEMY_POOL_SIZE: Database connection pool size per workerSQLALCHEMY_MAX_OVERFLOW: Maximum additional connections when pool overflowsAPI Workers: API service’sserverWorkerAmountWorker Workers: Worker service’sceleryWorkerAmount
- API: replicas=6, serverWorkerAmount=1
- Worker: replicas=2, celeryWorkerAmount=1
- SQLALCHEMY_POOL_SIZE=100
- SQLALCHEMY_MAX_OVERFLOW=150
2.2 Complete Configuration Example
3. Performance Monitoring Recommendations
3.1 Key Metrics
Monitor the following metrics to ensure the system is running well: Database Connections:- Current active connections
- Connection pool utilization
- Requests waiting for connections
- CPU utilization (recommended to keep below 70%)
- Memory utilization (recommended to keep below 80%)
- Disk I/O
- API response time
- Worker task queue length
- Task execution time