Skip to content
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

HTTP Metrics Performance with MPMetrics #30091

Open
jdmcclur opened this issue Nov 6, 2024 · 0 comments
Open

HTTP Metrics Performance with MPMetrics #30091

jdmcclur opened this issue Nov 6, 2024 · 0 comments

Comments

@jdmcclur
Copy link
Member

jdmcclur commented Nov 6, 2024

I see a performance issue with HTTP Metrics related to recording the metrics when MPMetrics is enabled. This is with a simple primitive test hitting a very simple REST endpoint, so overheads are exaggerated to what someone would see in a "normal" application. This is a follow on to #29396.

There are a few areas to investigate. but most of the overhead is from the LegacyMetricregistryAdapter

  Parent      0   0.10  11.77           5         585    J:io/openliberty/microprofile/metrics50/http/MPMetricsHTTPMetricsAdapterImpl.updateHttpMetrics(Lio/openliberty/http/monitor/HttpStatAttributes;Ljava/time/Duration;)V
 
    Self      0   0.10  11.77           5         585    J:io/smallrye/metrics/legacyapi/LegacyMetricRegistryAdapter.timer(Lorg/eclipse/microprofile/metrics/Metadata;[Lorg/eclipse/microprofile/metrics/Tag;)Lorg/eclipse/microprofile/metrics/Timer;
 
   Child      0   0.22   9.48          11         471    J:io/smallrye/metrics/legacyapi/LegacyMetricRegistryAdapter.internalTimer(Lio/smallrye/metrics/legacyapi/MpMetadata;Lio/smallrye/metrics/legacyapi/MetricDescriptor;)Lio/smallrye/metrics/legacyapi/TimerAdapter;
   Child      0   0.34   2.17          17         108    J:io/smallrye/metrics/legacyapi/LegacyMetricRegistryAdapter.withAppTags([Lorg/eclipse/microprofile/metrics/Tag;)Lio/micrometer/core/instrument/Tags;
   Child      0   0.00   0.02           0           1    J:io/smallrye/metrics/legacyapi/LegacyMetricRegistryAdapter.internalGetMetadataTimers(Lorg/eclipse/microprofile/metrics/Metadata;)Lio/smallrye/metrics/legacyapi/MpMetadata;

Mostly converting the MetricDescriptor (and all the tags I assume) to a MetricID.

  Parent      0   0.00   5.63           0         280    J:io/smallrye/metrics/legacyapi/LegacyMetricRegistryAdapter.addNameToApplicationMap(Lio/smallrye/metrics/legacyapi/MetricDescriptor;)V
 
    Self      0   0.00   5.63           0         280    J:io/smallrye/metrics/legacyapi/MetricDescriptor.toMetricID()Lorg/eclipse/microprofile/metrics/MetricID;
 
   Child      0   0.04   5.63           2         280    J:io/smallrye/metrics/legacyapi/MetricDescriptor$ExtendedMetricID.<init>(Lio/smallrye/metrics/legacyapi/MetricDescriptor;)V

Which eventually gets down to the Tag.<init>

  Parent      0   0.02   4.06           1         202    J:io/smallrye/metrics/legacyapi/MetricDescriptor.lambda$convertTags$0(Ljava/util/List;Lio/micrometer/core/instrument/Tag;)V
 
    Self      0   0.02   4.06           1         202    J:org/eclipse/microprofile/metrics/Tag.<init>(Ljava/lang/String;Ljava/lang/String;)V
 
   Child      0   0.00   3.68           0         183    J:java/util/regex/Matcher.matches()Z
   Child      0   0.00   0.36           0          18    J:java/util/regex/Pattern.matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;

Another area is below. I looked into updating to a newer version of Tags (#29982). It helped maybe 0.5%, but not sure it iss worth the hassle. I'll get back to this when I have time.

  Parent      0   0.34   2.17          17         108    J:io/smallrye/metrics/legacyapi/LegacyMetricRegistryAdapter.timer(Lorg/eclipse/microprofile/metrics/Metadata;[Lorg/eclipse/microprofile/metrics/Tag;)Lorg/eclipse/microprofile/metrics/Timer;
 
    Self      0   0.34   2.17          17         108    J:io/smallrye/metrics/legacyapi/LegacyMetricRegistryAdapter.withAppTags([Lorg/eclipse/microprofile/metrics/Tag;)Lio/micrometer/core/instrument/Tags;
 
   Child      0   0.00   1.59           0          79    J:io/micrometer/core/instrument/Tags.and(Ljava/lang/String;Ljava/lang/String;)Lio/micrometer/core/instrument/Tags;
   Child      0   0.00   0.24           0          12    J:io/smallrye/metrics/legacyapi/LegacyMetricRegistryAdapter.combineApplicationTagsWithMPConfigAppNameTag(Lio/micrometer/core/instrument/Tags;)Lio/micrometer/core/instrument/Tags;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants