-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Few minor diagnostics perf improvements #38232
Few minor diagnostics perf improvements #38232
Conversation
…to users/fabianm/NoActualMetricRegistryImprovement
API change check API changes are not detected in this pull request. |
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @FabianMeiswinkel
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsTest.java
Show resolved
Hide resolved
...os/src/main/java/com/azure/cosmos/implementation/clienttelemetry/ClientTelemetryMetrics.java
Show resolved
Hide resolved
...os/src/main/java/com/azure/cosmos/implementation/clienttelemetry/ClientTelemetryMetrics.java
Show resolved
Hide resolved
...os/src/main/java/com/azure/cosmos/implementation/clienttelemetry/ClientTelemetryMetrics.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
* Check for actual meterRegistry * Update ClientTelemetryMetrics.java * Update ClientTelemetryMetrics.java * Update CosmosDiagnosticsTest.java * Removing String.format in metrics * Update ClientTelemetryMetrics.java * Update Uri.java * Update RntbdClientChannelHealthChecker.java * Update RntbdToken.java * Update FaultInjectionRequestContext.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * EnumMap changes * Avoiding ImmutableEnumMaps * Fixing unit tests * Update ClientTelemetryMetrics.java * Update FaultInjectionRequestContext.java
* Few minor diagnostics perf improvements (#38232) * Check for actual meterRegistry * Update ClientTelemetryMetrics.java * Update ClientTelemetryMetrics.java * Update CosmosDiagnosticsTest.java * Removing String.format in metrics * Update ClientTelemetryMetrics.java * Update Uri.java * Update RntbdClientChannelHealthChecker.java * Update RntbdToken.java * Update FaultInjectionRequestContext.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * EnumMap changes * Avoiding ImmutableEnumMaps * Fixing unit tests * Update ClientTelemetryMetrics.java * Update FaultInjectionRequestContext.java * Update CHANGELOG.md * Release preparations * Update CHANGELOG.md * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable (#38388) * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable * Tests * Reacting to code review feedback * remove winutils download steps (#38030) Co-authored-by: annie-mac <xinlian@microsoft.com> * addChannelAcquisitionContextInCosmosDiagnosticsBasedOnLatency (#38416) * add channelAcquisitionContext in cosmosDiagnostics when reaching threshold --------- Co-authored-by: annie-mac <xinlian@microsoft.com> --------- Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac <xinlian@microsoft.com>
* Few minor diagnostics perf improvements (#38232) * Check for actual meterRegistry * Update ClientTelemetryMetrics.java * Update ClientTelemetryMetrics.java * Update CosmosDiagnosticsTest.java * Removing String.format in metrics * Update ClientTelemetryMetrics.java * Update Uri.java * Update RntbdClientChannelHealthChecker.java * Update RntbdToken.java * Update FaultInjectionRequestContext.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * EnumMap changes * Avoiding ImmutableEnumMaps * Fixing unit tests * Update ClientTelemetryMetrics.java * Update FaultInjectionRequestContext.java * Update CHANGELOG.md * Release preparations * Update CHANGELOG.md * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable (#38388) * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable * Tests * Reacting to code review feedback * remove winutils download steps (#38030) Co-authored-by: annie-mac <xinlian@microsoft.com> * addChannelAcquisitionContextInCosmosDiagnosticsBasedOnLatency (#38416) * add channelAcquisitionContext in cosmosDiagnostics when reaching threshold --------- Co-authored-by: annie-mac <xinlian@microsoft.com> * Fixing release break for hotfix --------- Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac <xinlian@microsoft.com>
* Few minor diagnostics perf improvements (#38232) * Check for actual meterRegistry * Update ClientTelemetryMetrics.java * Update ClientTelemetryMetrics.java * Update CosmosDiagnosticsTest.java * Removing String.format in metrics * Update ClientTelemetryMetrics.java * Update Uri.java * Update RntbdClientChannelHealthChecker.java * Update RntbdToken.java * Update FaultInjectionRequestContext.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * EnumMap changes * Avoiding ImmutableEnumMaps * Fixing unit tests * Update ClientTelemetryMetrics.java * Update FaultInjectionRequestContext.java * Update CHANGELOG.md * Release preparations * Update CHANGELOG.md * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable (#38388) * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable * Tests * Reacting to code review feedback * remove winutils download steps (#38030) Co-authored-by: annie-mac <xinlian@microsoft.com> * addChannelAcquisitionContextInCosmosDiagnosticsBasedOnLatency (#38416) * add channelAcquisitionContext in cosmosDiagnostics when reaching threshold --------- Co-authored-by: annie-mac <xinlian@microsoft.com> * Fixing release break for hotfix * Update utils.py --------- Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac <xinlian@microsoft.com>
* Few minor diagnostics perf improvements (#38232) * Check for actual meterRegistry * Update ClientTelemetryMetrics.java * Update ClientTelemetryMetrics.java * Update CosmosDiagnosticsTest.java * Removing String.format in metrics * Update ClientTelemetryMetrics.java * Update Uri.java * Update RntbdClientChannelHealthChecker.java * Update RntbdToken.java * Update FaultInjectionRequestContext.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * EnumMap changes * Avoiding ImmutableEnumMaps * Fixing unit tests * Update ClientTelemetryMetrics.java * Update FaultInjectionRequestContext.java * Update CHANGELOG.md * Release preparations * Update CHANGELOG.md * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable (#38388) * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable * Tests * Reacting to code review feedback * remove winutils download steps (#38030) Co-authored-by: annie-mac <xinlian@microsoft.com> * addChannelAcquisitionContextInCosmosDiagnosticsBasedOnLatency (#38416) * add channelAcquisitionContext in cosmosDiagnostics when reaching threshold --------- Co-authored-by: annie-mac <xinlian@microsoft.com> * Fixing release break for hotfix * Update utils.py * Update set_versions.py --------- Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac <xinlian@microsoft.com>
* Few minor diagnostics perf improvements (#38232) * Check for actual meterRegistry * Update ClientTelemetryMetrics.java * Update ClientTelemetryMetrics.java * Update CosmosDiagnosticsTest.java * Removing String.format in metrics * Update ClientTelemetryMetrics.java * Update Uri.java * Update RntbdClientChannelHealthChecker.java * Update RntbdToken.java * Update FaultInjectionRequestContext.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * EnumMap changes * Avoiding ImmutableEnumMaps * Fixing unit tests * Update ClientTelemetryMetrics.java * Update FaultInjectionRequestContext.java * Update CHANGELOG.md * Release preparations * Update CHANGELOG.md * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable (#38388) * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable * Tests * Reacting to code review feedback * remove winutils download steps (#38030) Co-authored-by: annie-mac <xinlian@microsoft.com> * addChannelAcquisitionContextInCosmosDiagnosticsBasedOnLatency (#38416) * add channelAcquisitionContext in cosmosDiagnostics when reaching threshold --------- Co-authored-by: annie-mac <xinlian@microsoft.com> * Fixing release break for hotfix * Update utils.py * Update set_versions.py * Update set_versions.py --------- Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac <xinlian@microsoft.com>
* Few minor diagnostics perf improvements (#38232) * Check for actual meterRegistry * Update ClientTelemetryMetrics.java * Update ClientTelemetryMetrics.java * Update CosmosDiagnosticsTest.java * Removing String.format in metrics * Update ClientTelemetryMetrics.java * Update Uri.java * Update RntbdClientChannelHealthChecker.java * Update RntbdToken.java * Update FaultInjectionRequestContext.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * EnumMap changes * Avoiding ImmutableEnumMaps * Fixing unit tests * Update ClientTelemetryMetrics.java * Update FaultInjectionRequestContext.java * Update CHANGELOG.md * Release preparations * Update CHANGELOG.md * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable (#38388) * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable * Tests * Reacting to code review feedback * remove winutils download steps (#38030) Co-authored-by: annie-mac <xinlian@microsoft.com> * addChannelAcquisitionContextInCosmosDiagnosticsBasedOnLatency (#38416) * add channelAcquisitionContext in cosmosDiagnostics when reaching threshold --------- Co-authored-by: annie-mac <xinlian@microsoft.com> * Fixing release break for hotfix * Update utils.py * Update set_versions.py * Update set_versions.py * Update set_versions.py --------- Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac <xinlian@microsoft.com>
…se (#38626) * Few minor diagnostics perf improvements (#38232) * Check for actual meterRegistry * Update ClientTelemetryMetrics.java * Update ClientTelemetryMetrics.java * Update CosmosDiagnosticsTest.java * Removing String.format in metrics * Update ClientTelemetryMetrics.java * Update Uri.java * Update RntbdClientChannelHealthChecker.java * Update RntbdToken.java * Update FaultInjectionRequestContext.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * Update RntbdTokenStream.java * EnumMap changes * Avoiding ImmutableEnumMaps * Fixing unit tests * Update ClientTelemetryMetrics.java * Update FaultInjectionRequestContext.java * Update CHANGELOG.md * Release preparations * Update CHANGELOG.md * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable (#38388) * Allowing to opt-out of E2E timeout for non-point operations via system property or environment variable * Tests * Reacting to code review feedback * remove winutils download steps (#38030) Co-authored-by: annie-mac <xinlian@microsoft.com> * addChannelAcquisitionContextInCosmosDiagnosticsBasedOnLatency (#38416) * add channelAcquisitionContext in cosmosDiagnostics when reaching threshold --------- Co-authored-by: annie-mac <xinlian@microsoft.com> * Fixing release break for hotfix * Update utils.py * Update set_versions.py * Update set_versions.py * Update set_versions.py * Update set_versions.py --------- Co-authored-by: Annie Liang <64233642+xinlian12@users.noreply.github.com> Co-authored-by: annie-mac <xinlian@microsoft.com>
Description
Few minor perf improvements with diagnostics enabled that were identified when going through CPU profiles.
No monitoring, no Java Agent
About 5 percent throughput improvement with the changes in this PR - primarily by avoiding to use ImmutableEnumMap (which has allocation overhead in iterators)
Metrics only (tracing disabled) via Java-Agent (but with Reactor disabled)
Even the other micro-optimizations (avoiding string.format etc.) helped to increase throughput slightly. The throughput improvement was relatively small, but continuously better than the main-branch. With the change to avoid ImmutableEnumMap the improvement across the board increased.
Metrics only (tracing disabled) but No Java Agent (or other MeterRegistry subscriber - so, Global MicroMeterRegistry is actually empty)
Before this PR even when no actual meter registry existed, the SDK code to populate metrics was stille xecuted - the actual Micro meter APIs to register values are no-ops in this case, but the overhead was still visible.
Tracing only (metrics disabled) with Java agent - but Reactor instrumentation disabled
About 3 percent improvement with this PR. When looking at CPU profiles I identified one issue in the AppInsights Java-Agent. It looks like a fix will be available with the next version of the Java Agent.
CPU Profile showing potential improvement in the Java Agent
![image](https://private-user-images.githubusercontent.com/19165014/295361566-f2d77f9a-8add-45b2-bfb1-5601cc029358.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ4NzgyNDgsIm5iZiI6MTcyNDg3Nzk0OCwicGF0aCI6Ii8xOTE2NTAxNC8yOTUzNjE1NjYtZjJkNzdmOWEtOGFkZC00NWIyLWJmYjEtNTYwMWNjMDI5MzU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI4VDIwNDU0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThhNTNiYmE5YzliNjUxNDM2NDE0ODliNDcwNTVmYjQ3NTllOTFkZTY0NzI0ZjE2M2I5YzgwMmM3YWM5NWI3YTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cgOlQ-jWrmWiq0ZikfXi9Si8xX_MB7Xp_PNjbnwj6oY)
Throughput improvement with this PR
![image](https://private-user-images.githubusercontent.com/19165014/295361307-bcfdf3be-be8a-4c5a-8452-851e6c51e3e0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ4NzgyNDgsIm5iZiI6MTcyNDg3Nzk0OCwicGF0aCI6Ii8xOTE2NTAxNC8yOTUzNjEzMDctYmNmZGYzYmUtYmU4YS00YzVhLTg0NTItODUxZTZjNTFlM2UwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI4VDIwNDU0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE4ODJhNzAyZDc5NTM2MjUyZTc1YmVhZDMzNWM5YTY4MmE1NGZmMDIxMzNhYzIyMzg2MTQ3Y2M4MGJiMTllMDMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.qhSDobPma-R_fwc0RFQD-nzoDHi4IlHwB2sXBuDoEfQ)
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines