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

[Log Improvement] Output the registering/lost/exclude nodes in log #148

Merged
merged 4 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public class CoordinatorConf extends RssBaseConf {
.longType()
.defaultValue(30 * 1000L)
.withDescription("timeout if can't get heartbeat from shuffle server");
public static final ConfigOption<Long> COORDINATOR_NODES_PERIODIC_OUTPUT_INTERVAL_TIMES = ConfigOptions
.key("rss.coordinator.server.periodic.output.interval.times")
.longType()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add checkValue?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I will add check.

Copy link
Contributor

@jerqi jerqi Aug 10, 2022

Choose a reason for hiding this comment

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

Could we add some document?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's OK. But currently the file of doc/coordinator_guide.md is empty and the README about coordinator conf is missing lots of params.

So do i add this conf into README?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you migrate the cooridinator's document from README to doc/coordinator_guide.md and add the document of this config option in the doc/coordinator_guide.md in a new pr?

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it. I'm glad to do this.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, let's merge this pr first.

.checkValue(ConfigUtils.POSITIVE_LONG_VALIDATOR, "output server list interval times must be positive")
.defaultValue(30L)
.withDescription("The periodic interval times of output alive nodes. The interval sec can be calculated by ("
+ COORDINATOR_HEARTBEAT_TIMEOUT.key() + "/3 * rss.coordinator.server.periodic.output.interval.times)");
public static final ConfigOption<String> COORDINATOR_ASSIGNMENT_STRATEGY = ConfigOptions
.key("rss.coordinator.assignment.strategy")
.stringType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -60,12 +61,17 @@ public class SimpleClusterManager implements ClusterManager {
private ScheduledExecutorService checkNodesExecutorService;
private FileSystem hadoopFileSystem;

private long outputAliveServerCount = 0;
private final long periodicOutputIntervalTimes;

public SimpleClusterManager(CoordinatorConf conf, Configuration hadoopConf) throws IOException {
this.shuffleNodesMax = conf.getInteger(CoordinatorConf.COORDINATOR_SHUFFLE_NODES_MAX);
this.heartbeatTimeout = conf.getLong(CoordinatorConf.COORDINATOR_HEARTBEAT_TIMEOUT);
// the thread for checking if shuffle server report heartbeat in time
scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(
ThreadUtils.getThreadFactory("SimpleClusterManager-%d"));

periodicOutputIntervalTimes = conf.get(CoordinatorConf.COORDINATOR_NODES_PERIODIC_OUTPUT_INTERVAL_TIMES);
scheduledExecutorService.scheduleAtFixedRate(
() -> nodesCheck(), heartbeatTimeout / 3,
heartbeatTimeout / 3, TimeUnit.MILLISECONDS);
Expand Down Expand Up @@ -99,6 +105,13 @@ void nodesCheck() {
}
}
}
if (!deleteIds.isEmpty() || outputAliveServerCount % periodicOutputIntervalTimes == 0) {
LOG.info("Alive servers number: {}, ids: {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this? We have metrics tell us how many there are alive servers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Number is not enough. I want to know which servers are lost from the coordinator side.

And the number shown in log will be easy to find.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I got it. Could 30 be configOption?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.
Changelog

  1. Introduce rss.coordinator.server.periodic.output.interval.times, default value = 30, this means it will output every 5min.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you judge deleteIds.isEmpty()?

Copy link
Member Author

Choose a reason for hiding this comment

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

when deleteIds is not empty, it means the server list changed, we should output the latest alive servers.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok.

servers.size(),
servers.keySet().stream().collect(Collectors.toList())
);
}
outputAliveServerCount++;

CoordinatorMetrics.gaugeTotalServerNum.set(servers.size());
} catch (Exception e) {
Expand All @@ -107,6 +120,7 @@ void nodesCheck() {
}

private void updateExcludeNodes(String path) {
int originalExcludeNodesNumber = excludeNodes.size();
try {
Path hadoopPath = new Path(path);
FileStatus fileStatus = hadoopFileSystem.getFileStatus(hadoopPath);
Expand All @@ -118,12 +132,16 @@ private void updateExcludeNodes(String path) {
} else {
excludeNodes = Sets.newConcurrentHashSet();
}
CoordinatorMetrics.gaugeExcludeServerNum.set(excludeNodes.size());
} catch (FileNotFoundException fileNotFoundException) {
excludeNodes = Sets.newConcurrentHashSet();
} catch (Exception e) {
LOG.warn("Error when updating exclude nodes, the exclude nodes file path: " + path, e);
}
int newlyExcludeNodesNumber = excludeNodes.size();
if (newlyExcludeNodesNumber != originalExcludeNodesNumber) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto.

LOG.info("Exclude nodes number: {}, nodes list: {}", newlyExcludeNodesNumber, excludeNodes);
}
CoordinatorMetrics.gaugeExcludeServerNum.set(excludeNodes.size());
}

private void parseExcludeNodesFile(DataInputStream fsDataInputStream) throws IOException {
Expand All @@ -143,6 +161,9 @@ private void parseExcludeNodesFile(DataInputStream fsDataInputStream) throws IOE

@Override
public void add(ServerNode node) {
if (!servers.containsKey(node.getId())) {
LOG.info("Newly registering node: {}", node.getId());
}
servers.put(node.getId(), node);
Set<String> tags = node.getTags();
// remove node with all tags to deal with the situation of tag change
Expand Down