Skip to content

additional improve MetricSnapshots.Builder performance#985

Merged
dhoard merged 1 commit intoprometheus:mainfrom
burov4j:metrics-snapshots-performance-improvement
Sep 19, 2024
Merged

additional improve MetricSnapshots.Builder performance#985
dhoard merged 1 commit intoprometheus:mainfrom
burov4j:metrics-snapshots-performance-improvement

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.

Signed-off-by: Andrey Burov <burov4j@yandex.ru>
@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
@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