-
Notifications
You must be signed in to change notification settings - Fork 993
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
Performance regression in MeterRegistry#remove
with many meters
#5466
Comments
Thank you for the report and sorry about the performance regression. I'm not sure what will be the best solution for this. I think we were somewhat aware this would not be very performant for |
MeterRegistry#remove
with many meters
Could you please share your use case? Especially why you have hundreds of thousands meters that you remove? |
ActiveMQ Artemis is a message broker and we register & remove meters as part of a queue's lifecycle (among other things). Currently each & every queue has 17 corresponding meters. In certain use-cases (e.g. heavy publish/subscribe) queues can come and go a lot and there can be a lot of them. In order to maintain consistency for internal data structures we have some concurrency controls for these processes and registering & removing meters is part of that. This means that slow meter removal is impacting performance (e.g. blocking other threads from removing or adding new queues and meters). We can certainly investigate moving meter removal outside of these concurrency controls, but it would be awesome if performance was improved within Micrometer so that wasn't necessary. |
I just wanted to confirm no further explanation is needed in terms of the use-case. |
The use case makes sense. Thank you for the explanation. We have a similar thing happening with Kafka metrics as well. We'll have to see what we can do to improve this. |
Describe the bug
A clear and concise description of what the bug is.
We noticed a performance regression related to #4857. Specifically, with a lot of meters, this
preFilterIdToMeterMap
map could be hundreds of thousands of elements or more, and we linearly iterate through them.Environment
java -version
]Micrometer 1.13.2, able to produce on macOS Sonoma 14.2.
This was discovered after it was bumped in ActiveMQ Artemis.
To Reproduce
How to reproduce the bug:
Unfortunately don't have a MRE to share, however this can likely be seen if creating many meters and gauges and then trying to delete them.
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
Add any other context about the problem here, e.g. related issues.
The text was updated successfully, but these errors were encountered: