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

x/tools/gopls: x/telemetry counter rotation consuming significant CPU #63425

Closed
findleyr opened this issue Oct 6, 2023 · 2 comments
Closed
Assignees
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented Oct 6, 2023

Just noticed while looking at CPU consumption: an idle gopls was consuming significant CPU. Fortunately I had a debug port open, and took the following profile:
image

It looks like file rotation is spending a lot of CPU rotating counter file(s). I'm not sure why; still investigating.

CC @hyangah @pjweinb

@findleyr findleyr added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Oct 6, 2023
@findleyr findleyr added this to the gopls/v0.14.0 milestone Oct 6, 2023
@findleyr findleyr self-assigned this Oct 6, 2023
@findleyr
Copy link
Contributor Author

findleyr commented Oct 6, 2023

The expiration of the counter file depends only on a global timestamp, which is initialized when the process starts:
https://github.com/golang/telemetry/blob/3f9d20a1609c705735ee44bd324547b038a107c3/internal/counter/file.go#L257

My gopls started 2 days ago, and the file expired yesterday. Therefore, counter files are immediately expired after they are rotated. (Related: #63218).

@gopherbot
Copy link

Change https://go.dev/cl/533756 mentions this issue: internal/counter: fix counterTime to be non-constant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants