Model Invocation is there a non-blocking Socket? #428

Closed
opened 2026-02-22 17:28:57 -05:00 by yindo · 2 comments
Owner

Originally created by @SugarFatFree on GitHub (Dec 22, 2025).

Although this code is a streaming request, the internal implementation is a blocking Socket. If many large model requests are initiated at the same time, the performance will be very poor. Is there any request that supports non-blocking Socket? Aiohttp, for example

self.session.model.llm.invoke(
                model_config=LLMModelConfig(
                    provider=llm_info.get('provider'),
                    model=llm_info.get('model'),
                    mode=llm_info.get('mode'),
                    completion_params=llm_info.get('completion_params')
                ),
                prompt_messages=[
                    SystemPromptMessage(content=user_prompt),
                ],
                stream=True
            )
Originally created by @SugarFatFree on GitHub (Dec 22, 2025). Although this code is a streaming request, the internal implementation is a blocking Socket. If many large model requests are initiated at the same time, the performance will be very poor. Is there any request that supports non-blocking Socket? Aiohttp, for example ``` self.session.model.llm.invoke( model_config=LLMModelConfig( provider=llm_info.get('provider'), model=llm_info.get('model'), mode=llm_info.get('mode'), completion_params=llm_info.get('completion_params') ), prompt_messages=[ SystemPromptMessage(content=user_prompt), ], stream=True ) ```
yindo closed this issue 2026-02-22 17:28:57 -05:00
Author
Owner

@SugarFatFree commented on GitHub (Dec 22, 2025):

I found that httpx.Client() is used, can I use httpx.AsyncClient instead?

@SugarFatFree commented on GitHub (Dec 22, 2025): I found that httpx.Client() is used, can I use httpx.AsyncClient instead?
Author
Owner

@crazywoola commented on GitHub (Feb 3, 2026):

Hi @SugarFatFree, thanks for opening this issue.

Why this is being closed

This issue tracker is reserved for actionable bugs/tasks. This report looks like a usage question.

Next steps

Please use the community channels instead:

If this is actually a bug/task, please open a new issue with clear reproducible details.

Thanks for understanding and for supporting Dify.

@crazywoola commented on GitHub (Feb 3, 2026): Hi @SugarFatFree, thanks for opening this issue. ### Why this is being closed This issue tracker is reserved for actionable bugs/tasks. This report looks like a usage question. ### Next steps Please use the community channels instead: - https://forum.dify.ai/ - https://discord.com/invite/FngNHpbcY7 If this is actually a bug/task, please open a new issue with clear reproducible details. Thanks for understanding and for supporting Dify.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugins#428