-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
主动发言的性能问题 #21
Comments
还好吧,几万条数据也都不到0.5秒就获取完,如果要搞缓存,那就是内存换cpu了,我觉得暂时不必 |
但我这服务器如果开着主动发言的话cpu一直爆满( |
是内存爆还是cpu爆啊,我的服务器2核4g,cpu占用长期不到15%,我觉得不是这个的问题,内存占用大倒是真的,因为用到了jieba库,本插件会有200m左右的内存占用 |
没 就是cpu 我服务器是单核2.5g的 |
我只要把定时任务关了就没问题了 肯定不是jieba库的问题 |
这样的话建议试试用原版牛牛吧,它是把消息存内存里定期做持久化的,我在复刻它的时候就是想去掉缓存以优化内存占用 |
好吧 找到问题了 nonebot-plugin-learning-chat/nonebot_plugin_learning_chat/handler.py Lines 409 to 450 in 1c9d2ed
|
就是在其他群里面学到了很多,但就是有个群里没有学到什么,这时候就一直在这个for里面循环了 |
现在每三分钟都要从数据库获取一天群内所有消息(
这部分能不能做成缓存,搞个缓存记录一下最近的消息,不然太吃cpu了
nonebot-plugin-learning-chat/nonebot_plugin_learning_chat/handler.py
Lines 348 to 350 in 1c9d2ed
The text was updated successfully, but these errors were encountered: