-
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: Direct code path performance improvements (both memory and CPU) #14147
Conversation
- O(n) headers iteration in StoreResult for ReqeustCharge (DirectConnectivity header names are always populated inside SDK) - O(n) Map headers to arrays and then reverse conversion overhead (including memory) StoreResponse - Extra map materialization in StoreClient - Avoid intermediate List<Entry> materializations in RntbdResponseHeaders - O(n) -O(1) handling for OWNER_FULL_NAME_VALUE header value
Yet to run the performance benchmark |
- O(n) headers iteration in StoreResult for ReqeustCharge (DirectConnectivity header names are always populated inside SDK) - O(n) Map headers to arrays and then reverse conversion overhead (including memory) StoreResponse - Extra map materialization in StoreClient - Avoid intermediate List<Entry> materializations in RntbdResponseHeaders - O(n) -O(1) handling for OWNER_FULL_NAME_VALUE header value
….com/Azure/azure-sdk-for-java into users/kirankk/store_response_headers
result.add(entry); | ||
public static void unescape(Map<String, String> headers) { | ||
if (headers != null) { | ||
headers.computeIfPresent(HttpConstants.HttpHeaders.OWNER_FULL_NAME, |
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.
very good change. thanks.
@@ -19,7 +19,7 @@ public void stringContent() { | |||
headerMap.put("key1", "value1"); | |||
headerMap.put("key2", "value2"); | |||
|
|||
StoreResponse sp = new StoreResponse(200, new ArrayList<>(headerMap.entrySet()), getUTF8BytesOrNull(content)); | |||
StoreResponse sp = new StoreResponse(200,headerMap, getUTF8BytesOrNull(content)); |
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.
code style space after comma
StoreResponse sp = new StoreResponse(200,headerMap, getUTF8BytesOrNull(content)); | |
StoreResponse sp = new StoreResponse(200, headerMap, getUTF8BytesOrNull(content)); |
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.*; |
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.
code style, no wildcard import:
https://peterdev.pl/2019/10/18/why-you-should-avoid-star-imports-in-intellij-idea/
} | ||
} | ||
else if (response.getResponseHeaders() != null) { | ||
response.getResponseHeaders().put(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(totalRequestCharge)); |
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.
Rntbd generated response headerMap is ImmutableMap.
now that the intermediate copied version is removed are we modifying the rntbd header map directly? if so this may not work.
Could you please check.
toBooleanEntry(BackendHeaders.OFFER_REPLACE_PENDING, token) | ||
); | ||
private Map<String, String> collectEntries(final RntbdContext context, final UUID activityId) { | ||
Map<String, String> responseHeaders = new HashMap<>(this.computeCount() + 2); |
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.
I remember I tested this a few months back and I found out that guava ImmutableMap construction is more performant than HashMap construction.
in my old perf testing replacing ImmutableMap with HashMap resulted in perf drop.
Could you please do a fully e2e perf testing to compare the perf difference of this PR?
AKS: Review request for Microsoft.ContainerService to add version stable/2021-05-01 (Azure#14147) * Adds base for updating Microsoft.ContainerService from version stable/2021-03-01 to version 2021-05-01 * Updates readme * Updates API version in new specs and examples * add APIServerAccessProfile.enablePrivateClusterPublicFQDN in 2021-05-01 (Azure#14149) * add APIServerAccessProfile.enablePrivateClusterPublicFQDN in 2021-05-01 api * ref example Co-authored-by: Li Ma <[email protected]> * Add swagger for OutboundNetworkDependenciesEndpoints for AKS (Azure#14332) * Add swagger for OutboundNetworkDependenciesEndpoints for AKS * fix * lint * update operationId * aks: add enableUltraSSD in v20210501 api-version (Azure#14354) * update doc for agentpool max count from 100 to 1000 (Azure#14553) Co-authored-by: Li Ma <[email protected]> * add readme for new version (Azure#14611) Co-authored-by: Li Ma <[email protected]> * fix conflict (Azure#14614) Co-authored-by: Li Ma <[email protected]> Co-authored-by: Li Ma <[email protected]> Co-authored-by: gossion <[email protected]> Co-authored-by: Andy Zhang <[email protected]>
Hi @kirankumarkolli. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
Hi @kirankumarkolli. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing "/reopen" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the "no-recent-activity" label; otherwise, this is likely to be closed again with the next cleanup pass. |
DO_NOT_MERGE