We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
问题描述: 场景是在大量的定时任务脚本中会初始化北极星实例,定时任务一般是在分钟级别完成。一天大概会有20W的量级,服务发布3天发现 CPU再持续增长。
分析: 通过 pprof 查看发现大部分时间耗费 healthcheck 中,对应的代码为值 https://github.com/polarismesh/polaris/blob/v1.17.5/service/healthcheck/check.go#L147
pprof
healthcheck
instance
CPU
func (c *CheckScheduler) processAdoptEvents( instances map[string]bool, add bool, checker plugin.HealthChecker) map[string]bool { instanceIds := make([]string, 0, len(instances)) // 注释掉下面三行取消遍历会降低 CPU 的使用 //for id := range instances { // instanceIds = append(instanceIds, id) //} log.Debug("[Health Check][Check] adopt event", zap.Any("instances", instanceIds), zap.String("server", server.localHost), zap.Bool("add", add)) return instances }
doAdopt
instancesToRemove
map
size
func (c *CheckScheduler) doAdopt(ctx context.Context) { instancesToAdd := make(map[string]bool) instancesToRemove := make(map[string]bool) var checker plugin.HealthChecker ticker := time.NewTicker(batchAdoptInterval) .... }
1.17.5
The text was updated successfully, but these errors were encountered:
实例没有deregister?
Sorry, something went wrong.
改代码最新的 main 分支中已经移除该逻辑
No branches or pull requests
问题描述:
场景是在大量的定时任务脚本中会初始化北极星实例,定时任务一般是在分钟级别完成。一天大概会有20W的量级,服务发布3天发现 CPU再持续增长。
分析:
通过
pprof
查看发现大部分时间耗费healthcheck
中,对应的代码为值 https://github.com/polarismesh/polaris/blob/v1.17.5/service/healthcheck/check.go#L147instance
的遍历会降低CPU
的使用doAdopt
函数中instancesToRemove
这个map
的size
会一直增大,还是存在内存泄漏的问题1.17.5
The text was updated successfully, but these errors were encountered: