-
Notifications
You must be signed in to change notification settings - Fork 426
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
Performance | Improve performance of driver by continuously cleaning up ActivityIDs stored in internal Map #1020
Conversation
src/main/java/com/microsoft/sqlserver/jdbc/ActivityCorrelator.java
Outdated
Show resolved
Hide resolved
I like the additional change to not populate the map at all if tracing is off. Other than one optional check in my comment, looks good to me. |
Codecov Report
@@ Coverage Diff @@
## dev #1020 +/- ##
============================================
+ Coverage 50.13% 50.49% +0.36%
- Complexity 2882 2938 +56
============================================
Files 120 120
Lines 27989 27999 +10
Branches 4677 4685 +8
============================================
+ Hits 14032 14139 +107
- Misses 11699 11709 +10
+ Partials 2258 2151 -107
Continue to review full report at Codecov.
|
Attaching the latest jars (zip file contains both JRE8/11 versions) for testing: |
src/main/java/com/microsoft/sqlserver/jdbc/ActivityCorrelator.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ActivityCorrelator.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
Outdated
Show resolved
Hide resolved
src/main/java/com/microsoft/sqlserver/jdbc/ActivityCorrelator.java
Outdated
Show resolved
Hide resolved
a0e37aa
Replaces PR #1018.
Every time
ActivityCorrelator::cleanupActivityId
is called, the driver now iterates through the Activity ID map and removes entries that are no longer needed.To alleviate this change from affecting the driver's performance, I've made changes during the pre-login process to not create an ActivityID if Activity Trace is not on (before, the driver was creating an ActivityID during pre-login regardless of the Activity Trace being on or not), because Activity ID is an optional part of the pre-login header. This means that the Activity ID map will be empty if Activity Trace is turned off, as opposed to before where the Activity ID map was getting populated regardless.
I've also added tests to show that the Activity ID map is no longer leaking memory.