SignalFx Naming Convention creates too many regex objects #3745
Labels
performance
Issues related to general performance
registry: signalfx
A SignalFX Registry related issue
Milestone
Describe the bug
While exporting metrics (publish()), the SignalFx registry converts the tags into the SignalFx Dimension object. To stick to the SignalFx tag naming convention, it does a lot of the regex (5 to be precise) matching which created too much garbage objects.
Scenario: 10,000 metrics (Note: this is 10,000 metrics and not 10,000 meters. For, one timer we will have 4 metrics generated in case of SignalFx.) exported by application, with an average of 8 tags per metric.
For the above scenario, SignalFx creates the following
Create one Datapoint object for each metric (Since we have histograms as separate data points we end up creating 10,000 of these objects per minute)
Creates one Dimension Object per dimension per metric. (Total = 80,000 per minute)
5 java.util.regex.Matcher objects per dimension. (Total = 400,000)
All the above are garbage collected.
Ref code:
micrometer/implementations/micrometer-registry-signalfx/src/main/java/io/micrometer/signalfx/SignalFxNamingConvention.java
Lines 81 to 99 in b8ad913
To Reproduce
Create a SignalFx Registry and register 10,000 meters with x tags each. Observe the memory increase right at the Step start time (when publishing happens). We will easily see (50,000 * x) number of regex objects created
Expected behavior
Garbage creation during publishing should be optimized to create as little as possible.
The text was updated successfully, but these errors were encountered: