-
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
Performance: Optimization for master-key authentication #14163
Conversation
...ure-cosmos/src/main/java/com/azure/cosmos/implementation/BaseAuthorizationTokenProvider.java
Show resolved
Hide resolved
…om/Azure/azure-sdk-for-java into users/kirankk/base_auth_perf_fixes
…/base_auth_perf_fixes # Conflicts: # sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/BaseAuthorizationTokenProvider.java
|
||
class MacPool { | ||
final Mac macInstance; | ||
final ConcurrentLinkedQueue<Mac> pool; |
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.
Using MacPool is a very nice change.
however now mac.clone() overhead is replaced by a ConcurrentLinkedQueue synchrnozation lock overhead. most likely better perf.
on the perf comparison do we know how much of perf gain we have from this?
You can do micro-benchmarking using jmh (just for the authorization part) I have the jmh project template here:
https://github.com/moderakh/azure-cosmosdb-benchmark/tree/master/jmh
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.
Won't this benchmark needs package to be published?
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.
no, you don't need to publish the package. There are two options:
first option)
on the java SDK repo install the package in your local maven repo using following command:
mvn -e -Dgpg.skip -Dmaven.javadoc.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -Drevapi.skip=true -DskipTests -pl ,com.azure:azure-cosmos -am clean install
and in the jmh project just update the pom to use the latest version installed in your local maven repo.
example for this option in jmh project:
https://github.com/moderakh/azure-cosmosdb-benchmark/blob/master/jmh/src/main/java/com/azure/cosmos/implementation/directconnectivity/rntbd/RntbdTokenStreamJMH.java
second option)
if the area to be tested is small (just copy that code (e.g, MacPool) to jmh project itself and micro benchmark just the copied code.
example for this option:
copied code:
https://github.com/moderakh/azure-cosmosdb-benchmark/blob/master/jmh/src/main/java/moderakh/ConsistencyLevel.java
micro-benchmark test:
https://github.com/moderakh/azure-cosmosdb-benchmark/blob/master/jmh/src/main/java/moderakh/ExpandableStringEnumJMH.java
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.
Based on offline discussion resolving this comment.
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.
Looks good to me.
on the perf comparison do we know how much of perf gain we have from this?
Using MacPool is a very nice change.
however now mac.clone() overhead is replaced by a synchrnozation lock. most likely better perf. but do we know how much perf gain?
You can do micro-benchmarking using jmh (just for the authorization part) I have the jmh project template here:
https://github.com/moderakh/azure-cosmosdb-benchmark/tree/master/jmh
# Conflicts: # sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/BaseAuthorizationTokenProvider.java
machinelearningcompute wave4 modification (Azure#14163) * machinelearningcompute wave4 modification * machinelearningcompute wave4 * only track2 * 1.0.0b1 Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) <[email protected]>
Key optimizations cover yields 0.3% CPU
Baseline:
With optimization: