TencentBlueKing / bk-nodeman

蓝鲸节点管理,可以对蓝鲸体系中的GSE Agent进行管理,包括状态查询、版本更新、配置管理、健康检查、进程管理等。
MIT License
50 stars 54 forks source link

fix: 服务实例并发请求数量过大 #2219

Open ping15 opened 4 months ago

ping15 commented 4 months ago

问题描述

简明扼要地描述bug是什么

截屏

请提供截屏来解释你的问题,当然这也能更好地帮助我们理解问题。

请提供以下信息

重现方法

列出如何重现的方法或操作步骤

  1. 转到 '....'
  2. 点击 '....'
  3. 错误现象 '....'

修复

建议的修复方案

修复方案

功能自测

代码变更覆盖功能点需要自测并截图

功能点 1

描述代码变更涉及功能点及自测截图

功能点 2

描述代码变更涉及功能点及自测截图

...

ZhuoZhuoCrayon commented 4 months ago

@ping15 没有定位到原因前 issue 名称写的宽泛一点:服务实例并发请求数量过大

ZhuoZhuoCrayon commented 4 months ago
  1. limit 统一改成 1000,由于 limit * 2,interval 调整为 0.2
  2. tools 新增 get_instances_by_scope_with_checker 方法,可传入 steps: models.SubscriptionStep,get_instances_by_scope_with_checker 会调用 get_instances_by_scope
  3. 2.step.params 进行检查,如果不存在 cmdb_instance.process,则不需要调用 add_process_info_to_instances
  4. get_instances_by_scope_with_checkerscope 注入 with_info,如果 "process" 信息需要,设置为 with_info: {"process": true}with_info 用于 get_instances_by_scope 判断是否需要调用 add_process_info_to_instances
  5. 代码引用到 get_instances_by_scope 的地方,都改成 get_instances_by_scope_with_checker

@ping15 如何判断 params 是否存在 cmdb_instance.process?把 params 先用 json.dump 转为字符串

image

目前已有的配置模板里,没有用到 process

image

ping15 commented 4 months ago

全部数据(8379)

"list_service_instance_detail" image

带bk_host_list(5917)

"list_service_instance_detail" AND "bk_host_list" image image

带service_instance_ids(7)

"list_service_instance_detail" AND "service_instance_ids" image image

带bk_module_id(1342)

"list_service_instance_detail" NOT "service_instance_ids" NOT "bk_host_list" AND "'with_name': true, 'bk_module_id'" image image

啥都不带(911)

"list_service_instance_detail" NOT "service_instance_ids" NOT "bk_host_list" NOT "'with_name': true, 'bk_module_id'" image image