When performing recall tests, docker-api-1 caused the system CPU usage to reach 100%. #4287

Closed
opened 2026-02-21 18:05:34 -05:00 by yindo · 2 comments
Owner

Originally created by @liduang on GitHub (Jun 27, 2024).

Originally assigned to: @takatost on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.8

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When performing recall tests, docker-api-1 caused the system CPU usage to reach 100%.

image

image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @liduang on GitHub (Jun 27, 2024). Originally assigned to: @takatost on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.8 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When performing recall tests, docker-api-1 caused the system CPU usage to reach 100%. ![image](https://github.com/langgenius/dify/assets/37337756/c176825f-75a2-4bf8-b1d2-3bdbcadddaea) ![image](https://github.com/langgenius/dify/assets/37337756/9fa27fb4-1764-44f5-ae07-fdc7a1532eb3) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:05:34 -05:00
yindo closed this issue 2026-02-21 18:05:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 27, 2024):

@liduang Hello there! I'm here to help you with any issues or questions you have regarding the repository. I can assist you in solving bugs, answering questions, or becoming a contributor.

To address the issue of the docker-api-1 container causing the system CPU usage to reach 100% during recall tests, you can try the following steps:

  1. Check Resource Limits: Ensure that the docker-api-1 container has appropriate resource limits set in the docker-compose.yml file. You can limit the CPU usage by adding the cpus option.

    services:
      docker-api-1:
        image: your-image
        deploy:
          resources:
            limits:
              cpus: '0.50'
    
  2. Optimize the Application: Investigate the application running inside the docker-api-1 container to identify any performance bottlenecks or inefficient code that could be causing high CPU usage.

  3. Monitor and Debug: Use Docker's built-in tools to monitor the container's resource usage and debug the issue.

    docker stats docker-api-1
    
  4. Check Logs: Review the logs of the docker-api-1 container to identify any errors or warnings that might indicate the cause of the high CPU usage.

    docker logs docker-api-1
    
  5. Scale the Service: If the high CPU usage is due to high load, consider scaling the service to distribute the load across multiple instances.

    docker-compose up --scale docker-api-1=3 -d
    

Additionally, during recall tests, specific functionalities such as choosing retrieval strategies, debugging TopK and recall score thresholds, and calculating similarity scores can be CPU-intensive. Adjusting these parameters might help reduce CPU usage [1][2].

By following these steps, you should be able to identify and mitigate the issue causing the docker-api-1 container to use excessive CPU resources.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jun 27, 2024): <!-- Greeting --> @liduang Hello there! I'm here to help you with any issues or questions you have regarding the repository. I can assist you in solving bugs, answering questions, or becoming a contributor. <!-- Answer --> To address the issue of the `docker-api-1` container causing the system CPU usage to reach 100% during recall tests, you can try the following steps: 1. **Check Resource Limits**: Ensure that the `docker-api-1` container has appropriate resource limits set in the `docker-compose.yml` file. You can limit the CPU usage by adding the `cpus` option. ```yaml services: docker-api-1: image: your-image deploy: resources: limits: cpus: '0.50' ``` 2. **Optimize the Application**: Investigate the application running inside the `docker-api-1` container to identify any performance bottlenecks or inefficient code that could be causing high CPU usage. 3. **Monitor and Debug**: Use Docker's built-in tools to monitor the container's resource usage and debug the issue. ```bash docker stats docker-api-1 ``` 4. **Check Logs**: Review the logs of the `docker-api-1` container to identify any errors or warnings that might indicate the cause of the high CPU usage. ```bash docker logs docker-api-1 ``` 5. **Scale the Service**: If the high CPU usage is due to high load, consider scaling the service to distribute the load across multiple instances. ```bash docker-compose up --scale docker-api-1=3 -d ``` Additionally, during recall tests, specific functionalities such as choosing retrieval strategies, debugging TopK and recall score thresholds, and calculating similarity scores can be CPU-intensive. Adjusting these parameters might help reduce CPU usage <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/learn-more/use-cases/practical-implementation-of-building-llm-applications-using-a-full-set-of-open-source-tools.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/en/guides/knowledge-base/retrieval-test-and-citation.md)</sup>. By following these steps, you should be able to identify and mitigate the issue causing the `docker-api-1` container to use excessive CPU resources. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Aug 2, 2024):

LInk #6832 https://github.com/langgenius/dify/issues/5683 and close this one

@crazywoola commented on GitHub (Aug 2, 2024): LInk #6832 https://github.com/langgenius/dify/issues/5683 and close this one
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4287