In version 1.4.1, the overall processing efficiency has decreased. #14334

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

Originally created by @rangerTao on GitHub (May 30, 2025).

Self Checks

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

1. Is this request related to a challenge you're experiencing? Tell me about your story.

In the workflow of the latest version 1.4.1, the overall time from the API request to the model returning the content of the first token is nearly 50% longer than that in version 0.15.x.

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @rangerTao on GitHub (May 30, 2025). ### Self Checks - [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. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. In the workflow of the latest version 1.4.1, the overall time from the API request to the model returning the content of the first token is nearly 50% longer than that in version 0.15.x. ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 19:16:45 -05:00
yindo closed this issue 2026-02-21 19:16:45 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 30, 2025):

Hi @rangerTao! I'm Dosu and I’m helping the dify team.

There are known reports of decreased processing efficiency in recent Dify versions, including 1.4.1, compared to 0.15.x. Several factors may contribute to this:

  • Performance degradation has been linked to the plugin daemon repeatedly sending complete prompt_messages (which can be large, especially with images or files) with every chunk response. This causes excessive network traffic and CPU load, resulting in longer processing times and CPU spikes in newer versions compared to 0.15.x. Even after some fixes, unresolved bottlenecks remain, especially for workflows involving large payloads or chunked responses [source].
  • The Model Runtime module, which handles model invocation and provider management, has become more modular and layered in recent versions. While this improves extensibility, it may introduce additional overhead in some scenarios [source].
  • Tokenization is handled by the GPT2Tokenizer, which uses either the tiktoken library or falls back to the Transformers GPT-2 tokenizer. Comments in the code indicate that tokenization is CPU-intensive, and asynchronous processing was removed due to resource constraints, potentially impacting efficiency for large or complex prompts [source].
  • There have been changes in backend infrastructure, such as switching the API backend service package manager from 'uv' to 'uvicorn' in 1.4.1, which could also affect performance characteristics [source].
  • For self-hosted setups, users have reported sluggish response times and high latency even with low CPU usage, and maintainers have clarified that high-performance optimizations are only available in the enterprise edition. Performance improvements are not currently planned for the community edition [source].

There are related pull requests and discussions about removing unnecessary fields from prompt messages and addressing lock contention and CPU issues, but some bottlenecks remain unresolved in the community edition [source].

If your workflow involves large prompt messages, chunked responses, or heavy tokenization, these factors are likely contributing to the increased latency in 1.4.1. If you are self-hosting, you may also want to review your deployment and database configuration, as some users have found improvements by tuning worker and database settings [source].

If you need further details on specific optimizations or want to track progress on these issues, you can follow the linked discussions and code references above.

To reply, just mention my name @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (May 30, 2025): <!-- Greeting --> Hi @rangerTao! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> There are known reports of decreased processing efficiency in recent Dify versions, including 1.4.1, compared to 0.15.x. Several factors may contribute to this: - Performance degradation has been linked to the plugin daemon repeatedly sending complete prompt_messages (which can be large, especially with images or files) with every chunk response. This causes excessive network traffic and CPU load, resulting in longer processing times and CPU spikes in newer versions compared to 0.15.x. Even after some fixes, unresolved bottlenecks remain, especially for workflows involving large payloads or chunked responses [[source](https://github.com/langgenius/dify/issues/17799)]. - The Model Runtime module, which handles model invocation and provider management, has become more modular and layered in recent versions. While this improves extensibility, it may introduce additional overhead in some scenarios [[source](https://github.com/langgenius/dify/blob/e303417e0470e95eb2ce3740b693b892fa465fc2/api/core/model_runtime/README.md)]. - Tokenization is handled by the GPT2Tokenizer, which uses either the tiktoken library or falls back to the Transformers GPT-2 tokenizer. Comments in the code indicate that tokenization is CPU-intensive, and asynchronous processing was removed due to resource constraints, potentially impacting efficiency for large or complex prompts [[source](https://github.com/langgenius/dify/blob/e303417e0470e95eb2ce3740b693b892fa465fc2/api/core/model_runtime/model_providers/__base/tokenizers/gpt2_tokenzier.py)]. - There have been changes in backend infrastructure, such as switching the API backend service package manager from 'uv' to 'uvicorn' in 1.4.1, which could also affect performance characteristics [[source](https://github.com/langgenius/dify/blob/e303417e0470e95eb2ce3740b693b892fa465fc2/api/README.md)]. - For self-hosted setups, users have reported sluggish response times and high latency even with low CPU usage, and maintainers have clarified that high-performance optimizations are only available in the enterprise edition. Performance improvements are not currently planned for the community edition [[source](https://github.com/langgenius/dify/issues/20395)]. There are related pull requests and discussions about removing unnecessary fields from prompt messages and addressing lock contention and CPU issues, but some bottlenecks remain unresolved in the community edition [[source](https://github.com/langgenius/dify/issues/17799)]. If your workflow involves large prompt messages, chunked responses, or heavy tokenization, these factors are likely contributing to the increased latency in 1.4.1. If you are self-hosting, you may also want to review your deployment and database configuration, as some users have found improvements by tuning worker and database settings [[source](https://github.com/langgenius/dify/issues/17921)]. If you need further details on specific optimizations or want to track progress on these issues, you can follow the linked discussions and code references above. <!-- Dosu Comment Footer --> *To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/e0e75b4b-57be-4a6d-a8b3-a9583e6c6f27?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e0e75b4b-57be-4a6d-a8b3-a9583e6c6f27?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e0e75b4b-57be-4a6d-a8b3-a9583e6c6f27?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e0e75b4b-57be-4a6d-a8b3-a9583e6c6f27?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e0e75b4b-57be-4a6d-a8b3-a9583e6c6f27?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e0e75b4b-57be-4a6d-a8b3-a9583e6c6f27?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e0e75b4b-57be-4a6d-a8b3-a9583e6c6f27?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/20498)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#14334