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

Find tradeoff for number of goroutines during Gather #369

Closed
beorn7 opened this issue Jan 25, 2018 · 2 comments · Fixed by #370
Closed

Find tradeoff for number of goroutines during Gather #369

beorn7 opened this issue Jan 25, 2018 · 2 comments · Fixed by #370
Assignees
Milestone

Comments

@beorn7
Copy link
Member

beorn7 commented Jan 25, 2018

https://github.com/prometheus/client_golang/blob/master/prometheus/registry.go#L381 starts one goroutine per registered Collector. Cases of 1M registered collectors have been reported. With fast collections, the overhead of starting a goroutine isn't really worth it, and there is a notable memory peak caused by it. Let's come up with a way to adaptively find a tradeoff. With fast collectors, one goroutine is fine. Even with slow ones, starting thousands of goroutine will have diminishing returns.

@brian-brazil
Copy link
Contributor

I'd try using only one goroutine for the standard gauge/counter/summary/histogram metrics.

@beorn7
Copy link
Member Author

beorn7 commented Jan 25, 2018

Then we needed to treat Collectors differently depending on their implementation. It would make the abstraction leaky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants