-
Notifications
You must be signed in to change notification settings - Fork 275
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
Misc changes for adaptive operation tracker #1218
Conversation
jsjtzyy
commented
Jul 16, 2019
- add log info to record which type of adaptive tracker is used
- enforce max number of inlight requests for adaptive tracker
- make excluding timedout request configurable
- support periodically dumping resource-level histogram to log file
1. add log info to record which type of adaptive tracker is used 2. enforce max number of inlight requests for adaptive tracker 3. make excluding timedout request configurable 4. support periodically dumping resource-level histogram to log file
will keep adding java docs |
Codecov Report
@@ Coverage Diff @@
## master #1218 +/- ##
============================================
- Coverage 69.73% 69.61% -0.12%
- Complexity 5480 5484 +4
============================================
Files 431 431
Lines 33554 33613 +59
Branches 4258 4267 +9
============================================
+ Hits 23398 23399 +1
- Misses 8990 9036 +46
- Partials 1166 1178 +12
Continue to review full report at Codecov.
|
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.
Thanks for making the changes quickly. It looks good after addressing these comments
@@ -84,6 +84,10 @@ | |||
localDcResourceToHistogram = getResourceToLatencyMap(routerOperation, true); | |||
crossDcResourceToHistogram = getResourceToLatencyMap(routerOperation, false); | |||
} | |||
if (parallelism > routerConfig.routerAdaptiveTrackerMaxInflightRequests) { |
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 think it would be good to also enforce this in RouterConfig
constructor so that startup will fail if it is set improperly instead of failing continuously at runtime.
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.
Good point. Will make the change.
@@ -298,6 +298,35 @@ | |||
@Default("1000") | |||
public final long routerOperationTrackerMinDataPointsRequired; | |||
|
|||
/** | |||
* The maximum number of inflight requests that allowed for adaptive tracker. If current number of inflight requests | |||
* is larger than or equal to this threshold, tracker shouldn't send out any request even though the oldest is past due. |
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.
minor: Seems like all the other adaptive configs start with router.operation.tracker, even if they are only relevant to AdaptiveOperationTracker
. Could we keep this the same?
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.
Could you also document the difference between parallelism and max.inflight.requests?
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.
sure, will do
@@ -219,7 +224,8 @@ private Counter getWholeDcPastDueCounter(RouterOperation routerOperation) { | |||
|
|||
@Override | |||
public boolean hasNext() { | |||
return replicaIterator.hasNext() && (inflightCount < parallelism || isOldestRequestPastDue()); | |||
return replicaIterator.hasNext() && (inflightCount < parallelism || ( |
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.
It might be more readable to break this into multiple if statements:
if (replicaIterator.hasNext()) {
if (inflightCount < parallelism) {
return true;
}
if (inflightCount < routerConfig.routerAdaptiveTrackerMaxInflightRequests && isOldestRequestPastDue()) {
return true;
}
}
return false;
Up to your personal preference, though
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.
True, your code is more readable. I will take your advice.
@Override | ||
public void run() { | ||
double quantile = routerConfig.routerLatencyToleranceQuantile; | ||
for (Map.Entry<Resource, Histogram> resourceToHistogram : getBlobLocalDcResourceToLatency.entrySet()) { |
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 think all of these maps can be null.
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.
Good catch! Will add check here.
@@ -400,13 +406,17 @@ public RouterConfig(VerifiableProperties verifiableProperties) { | |||
verifiableProperties.getDouble("router.operation.tracker.reservoir.decay.factor", 0.015); | |||
routerOperationTrackerMinDataPointsRequired = | |||
verifiableProperties.getLong("router.operation.tracker.min.data.points.required", 1000L); | |||
routerAdaptiveTrackerMaxInflightRequests = | |||
routerOperationTrackerMaxInflightRequests = | |||
verifiableProperties.getIntInRange("router.adaptive.tracker.max.inflight.requests", 2, 1, Integer.MAX_VALUE); |
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.
change adaptive to operation here
@@ -652,6 +701,8 @@ private RouterConfig createRouterConfig(boolean crossColoEnabled, int successTar | |||
props.setProperty("router.get.replicas.required", Integer.toString(Integer.MAX_VALUE)); | |||
props.setProperty("router.latency.tolerance.quantile", Double.toString(QUANTILE)); | |||
props.setProperty("router.operation.tracker.metric.scope", trackerScope.toString()); | |||
props.setProperty("router.adaptive.tracker.max.inflight.requests", Integer.toString(maxInflightNum)); |
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.
also change here after changing config key
@@ -555,6 +555,7 @@ private OperationTracker getOperationTracker(boolean crossColoEnabled, int succe | |||
Boolean.toString(includeNonOriginatingDcReplicas)); | |||
props.setProperty("router.get.replicas.required", Integer.toString(replicasRequired)); | |||
props.setProperty("router.latency.tolerance.quantile", Double.toString(QUANTILE)); | |||
props.setProperty("router.adaptive.tracker.max.inflight.requests", Integer.toString(parallelism)); |
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.
and here
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.
sorry, will fix soon
quantile * 100, histogram.getSnapshot().getValue(quantile)); | ||
} | ||
for (Map.Entry<Resource, Histogram> resourceToHistogram : getBlobInfoLocalDcResourceToLatency.entrySet()) { | ||
Resource resource = resourceToHistogram.getKey(); |
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.
Create a function, method or class to make a general histgram dumper?
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.
Sure but I need to think about this. Will make the change in future PR.