Skip to content

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

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 merlimat, sijie and srkukarni 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

# 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
Co-authored-by: Jerry Peng <jerryp@splunk.com>
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