perf: Simplify process data handling and improve performance#11236
perf: Simplify process data handling and improve performance#11236zhengkunwang223 merged 3 commits into1Panel-dev:dev-v2from
Conversation
- Replaced goroutine-based processing with a direct loop for handling process data. - Introduced context support for process and connection retrieval. - Enhanced error handling and data structuring for process information. - Improved SSH session retrieval by mapping users by host for better efficiency.
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/LGTM |
What this PR does / why we need it?
查找进程为了不必要的逻辑分配了更多的性能开销,本身每次proc.process 就会遍历一次链接,为了消化这么多遍历又用多线程来解决, 再加上锁和排序的开销,导致整体函数比较臃肿。
Summary of your change
单线程的新方案执行速度是原本多线程遍历的一倍,并且内存开支更低,gc 更稳定。

测试返回内容没有变化

Please indicate you've done the following: