Skip to content

Improve performance of merging two Tags/KeyValues instances #5140

@mstyura

Description

@mstyura

Please describe the feature request.
This is enhancement request to speed up common operations on set of Tags. Depending on scenario application may use some of the operations on tags very often causing micrometer to be non-negligible consumer of CPU of service relying on it.
The following operations are proposed to be optimised:

  1. Initialisation of Tags from already sorted array of unique tags;
  2. Merging two Tags objects in optimal way taking into account that tags are stored as sorted arrays.

Rationale
I've observed unexpectedly high CPU time spent in micrometer library in several production services I have access to. Here is screenshots from DataDog profiler:
image
with most of the time is actually spent on two things: creating Tags object and merging two Tags objects:
image

Additional context
I've already did initial PR #4959 which seems to be already lost among many of bot-generated PRs. So I've decided to created dedicated issue to keep track of progress towards making optimisations on Tags happen and be accepted.

Metadata

Metadata

Assignees

Labels

enhancementA general enhancementmodule: 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