Skip to content

Implement rebalance mechanism in Pulsar Functions #7388

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

Merged
merged 1 commit into from
Jul 2, 2020

Conversation

jerrypeng
Copy link
Contributor

Motivation

Currently there no mechanism for rebalancing functions scheduler on workers. Workload for functions may become skewed.

Modifications

  1. Add interface for rebalance strategy.
  2. Allow users to trigger a rebalance on-demand

Will add mechanism to run the rebalance periodically automatically in subsequent PR.

@jerrypeng jerrypeng added this to the 2.7.0 milestone Jun 30, 2020
@jerrypeng jerrypeng self-assigned this Jun 30, 2020
@@ -93,6 +94,8 @@

private final IScheduler scheduler;

private final IRebalance rebalancer;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: IRebalancer?

@jerrypeng jerrypeng changed the title WIP: Implement rebalance mechanism in Pulsar Functions Implement rebalance mechanism in Pulsar Functions Jul 1, 2020
@jerrypeng jerrypeng requested review from srkukarni, merlimat and sijie July 1, 2020 01:03
* @param workers
* @return
*/
List<Function.Assignment> rebalance(List<Function.Assignment> currentAssignments, Set<String> workers);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a default implementation that just returns the current assignment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure we can do it for BC reasons. It would return a empty list because there will be no change

@@ -78,6 +78,7 @@ numHttpServerThreads: 8
# function assignment and scheduler

schedulerClassName: "org.apache.pulsar.functions.worker.scheduler.RoundRobinScheduler"
rebalancerClassName: "org.apache.pulsar.functions.worker.scheduler.RoundRobinScheduler"
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be needed anymore, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will remove

@jerrypeng jerrypeng force-pushed the functions_rebalance branch from 22ee6d6 to 0ac832c Compare July 1, 2020 21:10
@jerrypeng jerrypeng merged commit 8e4906c into apache:master Jul 2, 2020
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants