Skip to content

Conversation

@johnou
Copy link
Contributor

@johnou johnou commented Nov 12, 2024

Summary

While testing our application for regressions in performance after adopting aws-advanced-jdbc-wrapper we found a lot of useless allocations from the NullTelemetryFactory [1].

[1] Screenshot 2024-11-12 131311

Description

Refactored NullTelemetryFactory to use a singleton instance for NullTelemetryContext, TelemetryCounter, and TelemetryGauge, eliminating repeated object creation and reducing memory allocations.

I also considered using a caching approach but opted for the singleton pattern to further simplify the code and minimize memory churn. I verified software.amazon.jdbc.util.telemetry.NullTelemetryContext#getName is not used in any code paths.

Additional Reviewers

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sergiyvamz
Copy link
Contributor

Hi @johnou

Thank you for looking into that!

@sergiyvamz sergiyvamz merged commit 7016110 into aws:main Nov 13, 2024
5 checks passed
@johnou johnou deleted the singleton-null-telemetry branch November 14, 2024 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants