-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
YARN-11250. Capture the Performance Metrics of ZookeeperFederationStateStore. #4738
Conversation
🎊 +1 overall
This message was automatically generated. |
@goiri Can you help review this pr? I think some metrics should be added to ZookeeperFederationStateStore. Thank you very much! |
🎊 +1 overall
This message was automatically generated. |
@@ -54,25 +54,25 @@ public final class ZKFederationStateStoreOpDurations implements MetricsSource { | |||
private MutableRate registerSubClusterCall; | |||
|
|||
@Metric("Duration for a deregister subCluster call") | |||
private MutableRate deregisterSubCluster; | |||
private MutableRate deregisterSubClusterCall; |
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.
Do we need to add the Call at the end?
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 your suggestion, there is no need to add the word Call after the variable, I will modify the code.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -104,29 +107,39 @@ | |||
public class ZookeeperFederationStateStore implements FederationStateStore { | |||
|
|||
private static final Logger LOG = | |||
LoggerFactory.getLogger(ZookeeperFederationStateStore.class); | |||
LoggerFactory.getLogger(ZookeeperFederationStateStore.class); |
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.
Avoid
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 your help reviewing the code, I will fix it.
|
||
private final static String ROOT_ZNODE_NAME_MEMBERSHIP = "memberships"; | ||
private final static String ROOT_ZNODE_NAME_APPLICATION = "applications"; | ||
private final static String ROOT_ZNODE_NAME_POLICY = "policies"; | ||
|
||
/** Interface to Zookeeper. */ | ||
/** | ||
* Interface to Zookeeper. |
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.
The old format is common; I would leave it as is
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 will fix it.
@Override | ||
public void init(Configuration conf) throws YarnException { | ||
LOG.info("Initializing ZooKeeper connection"); | ||
|
||
baseZNode = conf.get( | ||
YarnConfiguration.FEDERATION_STATESTORE_ZK_PARENT_PATH, | ||
YarnConfiguration.DEFAULT_FEDERATION_STATESTORE_ZK_PARENT_PATH); | ||
YarnConfiguration.FEDERATION_STATESTORE_ZK_PARENT_PATH, |
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.
This was fine before
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 will fix it.
@@ -203,53 +217,58 @@ public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( | |||
FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); | |||
} | |||
SubClusterId newSubClusterId = | |||
request.getApplicationHomeSubCluster().getHomeSubCluster(); | |||
request.getApplicationHomeSubCluster().getHomeSubCluster(); |
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.
This new spacing is wrong.
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 will fix it.
🎊 +1 overall
This message was automatically generated. |
@@ -161,8 +169,9 @@ public void close() throws Exception { | |||
|
|||
@Override | |||
public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( | |||
AddApplicationHomeSubClusterRequest request) throws YarnException { | |||
AddApplicationHomeSubClusterRequest request) throws YarnException { |
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.
The old indentation was correct.
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 will fix the indentation problem.
@@ -184,16 +193,17 @@ public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster( | |||
FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); | |||
} | |||
|
|||
return AddApplicationHomeSubClusterResponse | |||
.newInstance(homeSubCluster); | |||
opDurations.addAppHomeSubClusterDuration(clock.getTime() - start); |
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 need to do this but one thing I was thinking about is the fact that we keep doing the substraction in the call.
Would it look better to pass the start and the end time and do the substraction inside?
.../java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java
Show resolved
Hide resolved
return GetApplicationHomeSubClusterResponse.newInstance( | ||
ApplicationHomeSubCluster.newInstance(appId, homeSubCluster)); | ||
ApplicationHomeSubCluster.newInstance(appId, homeSubCluster)); |
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.
Indentation
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 will fix it.
} | ||
|
||
@Override | ||
public GetApplicationsHomeSubClusterResponse getApplicationsHomeSubCluster( | ||
GetApplicationsHomeSubClusterRequest request) throws YarnException { | ||
GetApplicationsHomeSubClusterRequest request) throws YarnException { |
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.
Indetation
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 will fix it.
FederationApplicationHomeSubClusterStoreInputValidator.validate(request); | ||
ApplicationId appId = request.getApplicationId(); | ||
SubClusterId homeSubCluster = getApp(appId); | ||
if (homeSubCluster == null) { | ||
String errMsg = "Application " + appId + " does not exist"; | ||
FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg); | ||
} | ||
opDurations.addGetAppHomeSubClusterDuration(clock.getTime() - start); | ||
return GetApplicationHomeSubClusterResponse.newInstance( |
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.
As this is all we do, would it make sense to have a:
GetApplicationHomeSubClusterResponse.newInstance(appId, homeSubCluster);
?
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.
Your suggestion is reasonable, I will modify the code.
return SubClusterHeartbeatResponse.newInstance(); | ||
} | ||
|
||
@Override | ||
public GetSubClusterInfoResponse getSubCluster( | ||
GetSubClusterInfoRequest request) throws YarnException { | ||
|
||
GetSubClusterInfoRequest request) throws YarnException { |
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.
Indentation all over.
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 will fix it.
@goiri Please help to review the code again, thank you very much! |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
registerSubCluster.add(endTime - startTime); | ||
} | ||
|
||
public void addDeregisterSubClusterDuration(long endTime, long startTime) { |
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.
Can we do long startTime, long endTime?
It looks a little more intuitive.
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 your suggestion, I will modify the code.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@goiri Thank you very much for helping to review the code! |
JIRA: YARN-11250. Capture the Performance Metrics of ZookeeperFederationStateStore.