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

[pulsar-broker] add uniform load shedder strategy to distribute traffic uniformly across brokers #12902

Merged
merged 3 commits into from
Dec 1, 2021

Conversation

rdhabalia
Copy link
Contributor

Motivation

Pulsar Broker provides a configurable way to configure various load shedding strategies based on usecases. It already has strategies to load balance based on broker resource utilization (ThresholdShedder) or based on bundle usage threshold (OverloadShedder).
We need another strategy to distribute load uniformly across all brokers. So, we are adding UniformLoadShedder strategy to achieve goal for uniform load in cluster.

NOTE

UniformLoadShedder also requires isolation and broker weight mechanism to also use strategy in heterogeneous hardware. I will create another PR for this enhancement.

@github-actions
Copy link

@rdhabalia:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

1 similar comment
@github-actions
Copy link

@rdhabalia:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1
But I am not expert of this kind of algorithms.
So it is better to wait for some other review

@codelipenghui
Copy link
Contributor

@hangc0276 Please help review the PR.

Copy link
Contributor

@Jason918 Jason918 left a comment

Choose a reason for hiding this comment

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

And we need to update the doc of loadBalancerLoadSheddingStrategy about this new strategy.

# uniform load shedding. (eg: broker1 with 50K msgRate and broker2 with 30K msgRate
# will have 66% msgRate difference and load balancer can unload bundles from broker-1
# to broker-2)
loadBalancerMsgRateDifferenceShedderThreshold=50
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO, It's better to add a notice about how to enable uniform load shedding, like set loadBalancerLoadSheddingStrategy="org.apache.pulsar.broker.loadbalance.impl.UniformLoadShedder"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added into documentation

@Anonymitaet Anonymitaet added doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. and removed doc-label-missing labels Nov 22, 2021
+ "will have 4.5 times msgThroughout difference and load balancer can unload bundles "
+ "from broker-1 to broker-2)"
)
private int loadBalancerMsgThroughputMultiplierDifferenceShedderThreshold = 4;
Copy link
Member

Choose a reason for hiding this comment

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

just wondering whether there would there need to be support for fractions like 1.5 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, value is double and it supports fractions.

Copy link
Member

@Anonymitaet Anonymitaet left a comment

Choose a reason for hiding this comment

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

@rdhabalia For the doc side, how about adding docs like below:

  • Add a section Load shedder strategy to load balance chapter
  • Explain 3 strategies (ThresholdShedder, OverloadShedder, and UniformLoadShedder), including "when to use" and "how to use" for each strategy

If so, can you add them? Thanks!

@rdhabalia
Copy link
Contributor Author

@Anonymitaet I have added documentation, if needed then we can always add more documentations in future.

@codelipenghui
Copy link
Contributor

I think we'd better use the batch rate instead of the msg rate? the batch rate consumes the broker CPU resource and throughput consumes the network bandwidth.

Copy link
Member

@Anonymitaet Anonymitaet left a comment

Choose a reason for hiding this comment

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

Hi @rdhabalia thanks for adding docs, but users may not have enough patience to wade through “chunks" of information, so I re-organize them here and left some comments.

Can you help review and answer the questions? If the content makes sense, you can implement it into your .md files, thanks.

@rdhabalia
Copy link
Contributor Author

@codelipenghui

I think we'd better use the batch rate instead of the msg rate?

LoadBalancer only captures MsgRate and not batch msg, and that's because batch message is an abstraction for the client. Broker still considers batch message a single message in terms of processing and storage. batch-message size which something matters and that can be covered by msgThroughput threshold.

@Anonymitaet

Please don't block the PR due to the documentation format. yes, I agree, the better format helps but the reorganization of the content can be handled in separate PR as well because every individual has a different idea about the formation.

@rdhabalia
Copy link
Contributor Author

@Anonymitaet fixed typo about loadBalancerMsgRateDifferenceShedderThreshold config based on your feedback in the doc

@Anonymitaet
Copy link
Member

@Anonymitaet

Please don't block the PR due to the documentation format. yes, I agree, the better format helps but the reorganization of the content can be handled in separate PR as well because every individual has a different idea about the formation.

Hi @rdhabalia,

  • I did not mean to block anything, I just want to improve the user experience since no one would like to read "a mountain of" information at a glance. Technical information should be easy to find/understand/use.
  • Agree that documentation can be submitted in a separate PR.
  • Everyone has a different opinion on everything but there are some general rules/standards accepted by the majority. In technical writing, often, text that is difficult to understand in paragraph form becomes clear in a table format. Tables help highlight relationships among similar pieces of information and are easily scanned for quick reference.

@rdhabalia
Copy link
Contributor Author

@Anonymitaet sure, I agree. let me create a separate PR with detailed info because we still have to add support of namespace isolation. so, can we unblock this PR and merge it for now and we can enhance with better user experience.

@Anonymitaet
Copy link
Member

@rdhabalia yes, it makes sense. Separate doc PR is more convenient for cutting a release (cherry-pick changes) as well.

@rdhabalia
Copy link
Contributor Author

@Anonymitaet I still see blocker for this PR. Please avoid creating blocker for DOC.

@Anonymitaet Anonymitaet dismissed their stale review December 1, 2021 08:11

submit doc in another pr

@Anonymitaet Anonymitaet added doc-required Your PR changes impact docs and you will update later. and removed doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. labels Dec 1, 2021
@Anonymitaet
Copy link
Member

@rdhabalia I label this PR with doc-required. Do not forget to revert doc changes in this PR and submit them in a separate PR, thanks.

@rdhabalia rdhabalia merged commit f965fb8 into apache:master Dec 1, 2021
lordcheng10 added a commit to lordcheng10/pulsar that referenced this pull request Dec 5, 2021
…te traffic uniformly across brokers (apache#12902)"

This reverts commit f965fb8.
@Anonymitaet Anonymitaet added doc-complete Your PR changes impact docs and the related docs have been already added. and removed doc-required Your PR changes impact docs and you will update later. labels Dec 10, 2021
fxbing pushed a commit to fxbing/pulsar that referenced this pull request Dec 19, 2021
…ic uniformly across brokers (apache#12902)

* [pulsar-broker] add uniform load shedder strategy to distribute traffic uniformly across brokers

* add documentation

* fixed typo in documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker doc-complete Your PR changes impact docs and the related docs have been already added.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants