Skip to content

Conversation

@symious
Copy link
Contributor

@symious symious commented Jan 19, 2024

What changes were proposed in this pull request?

HDDS-10160. Cache sort results in ContainerBalancerSelectionCriteria

The sort of all the containers is very time consuming, this patch is to cache the sort result and improve the balancer speed.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-10160

How was this patch tested?

Original balancer tests running successfully would be enough.

@adoroszlai
Copy link
Contributor

@symious It's better to create dev branches in one's own fork instead of in apache/ozone to reduce CI jobs in Apache. In that case push builds run in fork, PR builds in Apache, splitting resource usage.

@ChenSammi
Copy link
Contributor

I guess @symious may accidentally push HDDS-10160 to ozone major repo instead of his own repo.

Hi @guohao-rosicky , could Minyu help to review and verify the patch?

Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

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

@symious Thanks for working over this, given few comments

NavigableSet<ContainerID> containerIDSet =
new TreeSet<>(orderContainersByUsedBytes().reversed());
// Initialize containerSet for node
if (!setMap.containsKey(node)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ContaienrBalancerSelectionCriteria is applicable within one iteration

  1. all filtering can be done before setting to setMap
  2. Next filtering can be basic including selectedContainers and shouldBeExcluded

Suggested to use getCandidateContainers() to update setMap wrapping in another method.

"containers for Container Balancer.", node.toString(), e);
return containerIDSet;
setMap.remove(node);
return new TreeSet<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

can return Collections.emptySet()

new TreeSet<>(orderContainersByUsedBytes().reversed());
// Initialize containerSet for node
if (!setMap.containsKey(node)) {
NavigableSet<ContainerID> newSet =
Copy link
Contributor

Choose a reason for hiding this comment

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

can return Set<> and can change NavigableSet<> to Set in usages, but implementation can refer TreeMap.

NavigableSet<ContainerID> newSet =
new TreeSet<>(orderContainersByUsedBytes().reversed());
try {
newSet.addAll(nodeManager.getContainers(node));
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, sorting can be done on filtered containers only to avoid sorting of containers not meeting criteria.

@symious
Copy link
Contributor Author

symious commented Jan 22, 2024

@adoroszlai @ChenSammi Sorry for mixing the repo, should be using the wrong repo when working on the release.

@symious
Copy link
Contributor Author

symious commented Jan 22, 2024

Will continue this thread on #6050.

@symious symious closed this Jan 22, 2024
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.

4 participants