Open kk-kwok opened 1 month ago
@kk-kwok Hello there! I'm a bot here to help you with any bugs, questions, or contributions you have for the DIFY API. Let's work together to solve the issue you're experiencing.
To resolve the worker timeout issue in the Dify API, you can try the following steps:
Increase Gunicorn Workers and Threads:
GUNICORN_WORKERS
and GUNICORN_THREADS
environment variables to better utilize your CPU cores. The recommended formula for GUNICORN_WORKERS
is:
number of cpu cores x 2 + 1
GUNICORN_THREADS
, you can start with a value like 4 and adjust based on your specific requirements.Example configuration:
GUNICORN_WORKERS=5 # Assuming 2 CPU cores
GUNICORN_THREADS=4
Check for Memory Leaks:
Optimize Celery Worker Configuration:
CELERY_WORKER_AMOUNT
is 1, but you can increase it based on your workload and available resources.Enable Detailed Logging:
Review Resource Allocation:
Update to the Latest Version:
By following these steps, you should be able to mitigate the worker timeout issue and improve the performance of your Dify API deployment [1][2].
To continue talking to Dosu, mention @dosu.
Self Checks
Dify version
0.6.15
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
After the DIFY API is run, the following error log often appears, and the web page cannot be opened.
[2024-07-24 06:33:40 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:35) [2024-07-24 06:33:41 +0000] [1] [ERROR] Worker (pid:35) was sent SIGKILL! Perhaps out of memory? [2024-07-24 06:33:41 +0000] [39] [INFO] Booting worker with pid: 39
cpu and memory requests and limits
api server env
api server cpu and memory monitor
api version
I have tried from 0.6.8 to the latest version 0.6.15 and still have the same problem.
✔️ Expected Behavior
To solve this problem, access diffify normally
❌ Actual Behavior
No response