When the document is indexed, it will cause service lag #5217

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

Originally created by @Lxx-c on GitHub (Aug 26, 2024).

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

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When uploading documents for indexing, the entire Dify service will freeze during the indexing process, especially when the document content is large. Is there any better solution? I have tried to increase the number of processes, but there is no obvious effect. If the freeze is caused by indexing, since the woker service is related to document indexing, can it be deployed separately on other machines? All my services are deployed on one server, and the server configuration is 8c32G.I hope to get a reply!

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Lxx-c on GitHub (Aug 26, 2024). ### 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.7.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When uploading documents for indexing, the entire Dify service will freeze during the indexing process, especially when the document content is large. Is there any better solution? I have tried to increase the number of processes, but there is no obvious effect. If the freeze is caused by indexing, since the woker service is related to document indexing, can it be deployed separately on other machines? All my services are deployed on one server, and the server configuration is 8c32G.I hope to get a reply! ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:09:54 -05:00
yindo closed this issue 2026-02-21 18:09:54 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 26, 2024):

I found a similar issue where uploading large documents for indexing causes the entire service to freeze. Deploying the worker service related to document indexing separately on other machines is a viable solution. Here is how you can start the Worker service on a different machine:

For Linux or macOS:

celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace

For Windows:

celery -A app.celery worker -P solo --without-gossip --without-mingle -Q dataset,generation,mail,ops_trace --loglevel INFO

This will help distribute the load and prevent the main service from freezing when uploading large documents.

Additionally, ensure that your Docker setup meets the necessary requirements. For instance, on macOS, Docker Desktop should be configured to use at least 2 virtual CPUs and 8 GB of initial memory. For Linux, ensure Docker 19.03 or later and Docker Compose 1.25.1 or later are installed. On Windows with WSL 2 enabled, it is recommended to store source code and other data in the Linux filesystem rather than the Windows filesystem.

For more detailed setup instructions, you can refer to the Dify documentation [1][2][3].

Additionally, the duplicate_document_indexing_task function in api/tasks/duplicate_document_indexing_task.py is designed to handle document indexing asynchronously. This function processes documents in batches and checks for limits such as batch upload limits and subscription limits. If any errors occur, it updates the document's status to 'error' and logs the error message. This asynchronous processing helps in managing large document uploads efficiently without freezing the main service [4].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 26, 2024): <!-- Answer --> I found a similar issue where uploading large documents for indexing causes the entire service to freeze. Deploying the worker service related to document indexing separately on other machines is a viable solution. Here is how you can start the Worker service on a different machine: For Linux or macOS: ```bash celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace ``` For Windows: ```bash celery -A app.celery worker -P solo --without-gossip --without-mingle -Q dataset,generation,mail,ops_trace --loglevel INFO ``` This will help distribute the load and prevent the main service from freezing when uploading large documents. Additionally, ensure that your Docker setup meets the necessary requirements. For instance, on macOS, Docker Desktop should be configured to use at least 2 virtual CPUs and 8 GB of initial memory. For Linux, ensure Docker 19.03 or later and Docker Compose 1.25.1 or later are installed. On Windows with WSL 2 enabled, it is recommended to store source code and other data in the Linux filesystem rather than the Windows filesystem. For more detailed setup instructions, you can refer to the Dify documentation <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/local-source-code.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/getting-started/install-self-hosted/local-source-code.md)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/jp/getting-started/install-self-hosted/local-source-code.md)</sup>. Additionally, the `duplicate_document_indexing_task` function in `api/tasks/duplicate_document_indexing_task.py` is designed to handle document indexing asynchronously. This function processes documents in batches and checks for limits such as batch upload limits and subscription limits. If any errors occur, it updates the document's status to 'error' and logs the error message. This asynchronous processing helps in managing large document uploads efficiently without freezing the main service <sup>[[4]](https://github.com/langgenius/dify/blob/main/api/tasks/duplicate_document_indexing_task.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

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

Duplicated. Please search the existing issues. We are already working on this. https://github.com/langgenius/dify/issues/6998

@crazywoola commented on GitHub (Aug 26, 2024): Duplicated. Please search the existing issues. We are already working on this. https://github.com/langgenius/dify/issues/6998
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5217