Skip to content

Performance regression in MeterRegistry#remove with many meters #5466

@joshb1050

Description

@joshb1050

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

  • Micrometer version [e.g. 1.7.1]
  • Micrometer registry [e.g. prometheus]
  • OS: [e.g. macOS]
  • Java version: [e.g. output of java -version]

Micrometer 1.13.2, able to produce on macOS Sonoma 14.2.

This was discovered after it was bumped in ActiveMQ Artemis.

openjdk 17.0.11 2024-04-16 LTS
OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA general bugmodule: micrometer-coreAn issue that is related to our core moduleperformanceIssues related to general performance

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions