KAG icon indicating copy to clipboard operation
KAG copied to clipboard

[Feature][rest_client] io交互应该使用 asyncio 模式提高性能,thread 模式 会导致频繁上下文切换

Open zxrneu opened this issue 11 months ago • 2 comments

Search before asking

  • [X] I had searched in the issues and found no similar feature requirement.

Description

io交互应该使用 asyncio 模式提高性能,thread 模式 会导致频繁上下文切换

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

zxrneu avatar Jan 09 '25 07:01 zxrneu

Search before asking

  • [x] I had searched in the issues and found no similar feature requirement.

Description

io交互应该使用 asyncio 模式提高性能,thread 模式 会导致频繁上下文切换

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Thanks for your feedback. Could you modify the corresponding code and submit PR to us?

caszkgui avatar Jan 09 '25 08:01 caszkgui

Since the codebase was not designed with asyncio in mind, I don't think this task can be accomplished easily. Using asyncio may introduce some challenges, particularly because the Python code needs to interact with Java. In terms of performance, the context-switching overhead is negligible compared to the latency of LLM invocations, which typically take several seconds. Let me know if you'd like further adjustments!

xionghuaidong avatar Jan 13 '25 04:01 xionghuaidong

KAG v0.7 has been update to take advantange of asyncio.

xionghuaidong avatar Apr 23 '25 08:04 xionghuaidong