The results of the API method do not match the results of the single-node test #12023

Closed
opened 2026-02-21 19:05:21 -05:00 by yindo · 1 comment
Owner

Originally created by @Jimmy-L99 on GitHub (Mar 24, 2025).

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).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Using post to send a request to the API, the log shows that the time for classifier 3 is close to 20s, which does not match the time I spent testing classifier 3 separately in chatflow.
Image

A single node test for classifier 3 within workflow takes only 1~2s, and uses the same input as in log.
Image

The API approach causes the overall workflow output to be slow, causing streaming to take a long time to output content.

Is there something I need to set up to improve the classifier latency?

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Jimmy-L99 on GitHub (Mar 24, 2025). ### 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] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Using post to send a request to the API, the log shows that the time for classifier 3 is close to 20s, which does not match the time I spent testing classifier 3 separately in chatflow. ![Image](https://github.com/user-attachments/assets/92a8b4b8-13ad-4902-ab29-bed8709f86e0) A single node test for classifier 3 within workflow takes only 1~2s, and uses the same input as in log. ![Image](https://github.com/user-attachments/assets/2f330d1d-64ae-4023-854c-6d4886e8e7e0) The API approach causes the overall workflow output to be slow, causing streaming to take a long time to output content. Is there something I need to set up to improve the classifier latency? ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 19:05:21 -05:00
yindo closed this issue 2026-02-21 19:05:21 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 24, 2025):

I couldn't find a direct answer to the differences in execution flow between the API method and the single-node test in Dify. However, there are configuration settings that can optimize API request performance, which might help improve classifier latency:

  1. SERVER_WORKER_AMOUNT: Adjust the number of API server workers based on your CPU cores to optimize performance. More details can be found in the Gunicorn documentation: Gunicorn Worker Configuration.

  2. GUNICORN_TIMEOUT: Increase the request handling timeout to 360 to support longer SSE connection times, which can improve performance for long-running requests.

  3. SQLALCHEMY_POOL_SIZE: Increase the size of the database connection pool to handle more concurrent database connections.

Additionally, consider adjusting the following settings from the .env.example file:

  • API_TOOL_DEFAULT_CONNECT_TIMEOUT and API_TOOL_DEFAULT_READ_TIMEOUT: Manage how long the system waits for a connection or read operation.
  • HTTP_REQUEST_MAX_CONNECT_TIMEOUT, HTTP_REQUEST_MAX_READ_TIMEOUT, and HTTP_REQUEST_MAX_WRITE_TIMEOUT: Optimize the handling of HTTP requests.

These adjustments might help reduce latency in your API requests [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 24, 2025): <!-- Answer --> I couldn't find a direct answer to the differences in execution flow between the API method and the single-node test in Dify. However, there are configuration settings that can optimize API request performance, which might help improve classifier latency: 1. **SERVER_WORKER_AMOUNT**: Adjust the number of API server workers based on your CPU cores to optimize performance. More details can be found in the Gunicorn documentation: [Gunicorn Worker Configuration](https://docs.gunicorn.org/en/stable/design.html#how-many-workers). 2. **GUNICORN_TIMEOUT**: Increase the request handling timeout to 360 to support longer SSE connection times, which can improve performance for long-running requests. 3. **SQLALCHEMY_POOL_SIZE**: Increase the size of the database connection pool to handle more concurrent database connections. Additionally, consider adjusting the following settings from the `.env.example` file: - **API_TOOL_DEFAULT_CONNECT_TIMEOUT** and **API_TOOL_DEFAULT_READ_TIMEOUT**: Manage how long the system waits for a connection or read operation. - **HTTP_REQUEST_MAX_CONNECT_TIMEOUT**, **HTTP_REQUEST_MAX_READ_TIMEOUT**, and **HTTP_REQUEST_MAX_WRITE_TIMEOUT**: Optimize the handling of HTTP requests. These adjustments might help reduce latency in your API requests <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/environments.md)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/.env.example)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/8ce980c1-80db-4557-8994-075cb19b31cc?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/8ce980c1-80db-4557-8994-075cb19b31cc?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/8ce980c1-80db-4557-8994-075cb19b31cc?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/8ce980c1-80db-4557-8994-075cb19b31cc?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8ce980c1-80db-4557-8994-075cb19b31cc?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/8ce980c1-80db-4557-8994-075cb19b31cc?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8ce980c1-80db-4557-8994-075cb19b31cc?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12023