Skip to content
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

偶发情况下revertWorker内time.Now()占用CPU较高 #163

Closed
chiselX opened this issue May 31, 2021 · 3 comments
Closed

偶发情况下revertWorker内time.Now()占用CPU较高 #163

chiselX opened this issue May 31, 2021 · 3 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@chiselX
Copy link

chiselX commented May 31, 2021

hi,你好,pprof性能分析时, 偶尔会出现revertWorker内time.Now()占用CPU较高的情况,想请教一下,如果把获取当前时间换成另一种性能更好但可能有误差(误差5ms)的方法,会对整体有较大影响吗?我自己的理解,默认1s过期的情况下,可能会导致有些worker的回收时间延迟1s,但是不太清楚这个对ants整体的影响

@chiselX chiselX added help wanted Extra attention is needed question Further information is requested labels May 31, 2021
@panjf2000
Copy link
Owner

我自己的理解,默认1s过期的情况下,可能会导致有些worker的回收时间延迟1s

这个结论你是怎么得出来的?

@panjf2000
Copy link
Owner

5ms 的误差看起来不算很大(不过如果你的 worker 数量很大就另当别论了),但是要保证队列里的时间是单调递增的,不然就可能有潜在问题。

@panjf2000
Copy link
Owner

Fixed by #261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants