langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
36.06k stars 4.87k forks source link

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

Open liduang opened 6 days ago

liduang commented 6 days ago

Self Checks

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

dosubot[bot] commented 6 days ago

@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.