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

additional improve MetricSnapshots.Builder performance #985

Merged

Conversation

burov4j
Copy link
Contributor

@burov4j burov4j commented Sep 13, 2024

The function io.prometheus.metrics.model.registry.PrometheusRegistry.scrape has O(n^2) complexity: higher size of the list multiCollectors generates higher amount of snapshots in the io.prometheus.metrics.model.snapshots.MetricSnapshots.Builder class on each loop iteration.

Because of this we have x100 times slower metrics scrape in our project on production.

This PR gave us good performance improvement: #963
But it's not enough, because the complexity is still O(n^2). The current PR resolves the performance issue.

@burov4j burov4j force-pushed the metrics-snapshots-performance-improvement branch from 607fe0c to a1b9506 Compare September 13, 2024 09:34
@dhoard dhoard merged commit 4ce0d15 into prometheus:main Sep 19, 2024
2 checks passed
@dhoard
Copy link
Collaborator

dhoard commented Sep 19, 2024

@burov4j thanks for the PR!

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

Successfully merging this pull request may close these issues.

2 participants