Skip to content
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

Refactor operation tracker ctor and introduce custom percentiles #1159

Merged
merged 3 commits into from
May 3, 2019

Conversation

jsjtzyy
Copy link
Contributor

@jsjtzyy jsjtzyy commented Apr 25, 2019

  1. refactor ctor of both simple and adaptive operation tracker by
    passing the router config and operation class. This allows operation
    tracker itself to populate its parameters based on type of operation
    class.
  2. introduce custom percentiles of latency Histogram in adaptive
    operation tracker. The percentiles are configurable and on-demand. User
    can define arbitrary quantile like 91th percentile to better eveluate
    the latency distribution.

1. refactor ctor of both simple and adaptive operation tracker by
passing the router config and operation class. This allows operation
tracker itself to populate its parameters based on type of operation
class.
2. introduce custom percentiles of latency Histogram in adaptive
operation tracker. The percentiles are configurable and on-demand. User
can define arbitrary quantile like 91th percentile to better eveluate
the latency distribution.
@jsjtzyy jsjtzyy self-assigned this Apr 25, 2019
@jsjtzyy jsjtzyy requested a review from zzmao April 25, 2019 20:07
@codecov-io
Copy link

codecov-io commented Apr 25, 2019

Codecov Report

Merging #1159 into master will increase coverage by 0.1%.
The diff coverage is 96.03%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #1159     +/-   ##
===========================================
+ Coverage     69.84%   69.94%   +0.1%     
- Complexity     5316     5344     +28     
===========================================
  Files           420      426      +6     
  Lines         32547    32626     +79     
  Branches       4139     4140      +1     
===========================================
+ Hits          22732    22821     +89     
+ Misses         8695     8667     -28     
- Partials       1120     1138     +18
Impacted Files Coverage Δ Complexity Δ
.../java/com.github.ambry.router/DeleteOperation.java 92.19% <100%> (-1.42%) 47 <0> (-1)
...com.github.ambry.clustermap/ClusterMapMetrics.java 68.88% <100%> (+12.52%) 6 <0> (ø) ⬇️
...b.ambry.network/BlockingChannelConnectionPool.java 74.64% <100%> (+2.71%) 9 <0> (ø) ⬇️
...rc/main/java/com.github.ambry.rest/RestServer.java 98.66% <100%> (+0.65%) 13 <0> (ø) ⬇️
.../java/com.github.ambry.router/RouterOperation.java 100% <100%> (ø) 1 <1> (?)
...ambry.rest/AsyncRequestResponseHandlerFactory.java 100% <100%> (+4.12%) 10 <0> (ø) ⬇️
....github.ambry.router/AdaptiveOperationTracker.java 96.55% <100%> (+0.63%) 9 <0> (+3) ⬆️
.../java/com.github.ambry.network/NetworkMetrics.java 93.81% <100%> (+14.68%) 4 <0> (ø) ⬇️
....github.ambry.router/NonBlockingRouterMetrics.java 93.84% <100%> (+0.95%) 40 <5> (+2) ⬆️
...ain/java/com.github.ambry.router/GetOperation.java 97.05% <100%> (ø) 27 <0> (ø) ⬇️
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19f3c2e...6347c9d. Read the comment docs.

@jsjtzyy jsjtzyy requested a review from cgtz April 25, 2019 21:01
List<String> customPercentiles =
Utils.splitString(verifiableProperties.getString("router.operation.tracker.custom.percentiles", ""), ",");
routerOperationTrackerCustomPercentiles =
Collections.unmodifiableList(customPercentiles.stream().map(Double::valueOf).collect(Collectors.toList()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we convert string to list when it's needed? Previous example: storeCompactionTriggers

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got you. It's OK.

@@ -237,23 +237,19 @@ protected GetRequest createGetRequest(BlobId blobId, MessageFormatFlags flag, Ge
/**
* Gets an {@link OperationTracker} based on the config and {@code partitionId}.
* @param partitionId the {@link PartitionId} for which a tracker is required.
* @param operationClass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment

@jsjtzyy
Copy link
Contributor Author

jsjtzyy commented Apr 29, 2019

./gradlew build && ./gradlew test succeeded. Reminder to review, thanks.

Copy link
Contributor

@zzmao zzmao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return disk.getState() == HardwareState.AVAILABLE ? 1L : 0L;
}
};
Gauge<Long> diskState = () -> disk.getState() == HardwareState.AVAILABLE ? 1L : 0L;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning up this code!

// populate tracker parameters based on operation type
boolean crossColoEnabled = false;
boolean includeNonOriginatingDcReplicas = true;
int replicasRequired = Integer.MAX_VALUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this local variable used?

crossColoEnabled = routerConfig.routerGetCrossDcEnabled;
includeNonOriginatingDcReplicas = routerConfig.routerGetIncludeNonOriginatingDcReplicas;
replicasRequired = routerConfig.routerGetReplicasRequired;
} else if (operationClass == PutOperation.class) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other option is to make an enum to represent the operation tracker types (i.e. GET, PUT, DELETE, TTL_UPDATE). This is a little more explicit and resilient to new classes/name changes.

*/
@Config("router.operation.tracker.custom.percentiles")
@Default("")
public final List<Double> routerOperationTrackerCustomPercentiles;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how will these custom percentiles be used by operation tracker in the future? Right now, they are only registered in the MetricRegistry for viewing.

@lightningrob
Copy link
Contributor

@zzmao or @cgtz Can one of you merge this?

@zzmao
Copy link
Contributor

zzmao commented May 3, 2019

Good to merge? @cgtz

@cgtz cgtz merged commit aaf8d92 into linkedin:master May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants