> For the complete documentation index, see [llms.txt](https://tumbleds-library.gitbook.io/thetumbleds-library/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tumbleds-library.gitbook.io/thetumbleds-library/chapter-5-load-balancing-algorithm-avgshedder.md).

# Chapter 5 Load Balancing Algorithm - AvgShedder

In the previous chapters, we have conducted an in-depth analysis of [shedding algorithms](/thetumbleds-library/chapter-2-load-balancing-algorithm-principles-and-analysis-load-shedding-strategy.md) and [placement algorithms](https://github.com/thetumbled/Practical-Optimization-of-Apache-Pulsar/blob/main/doc/english/chapter-3-load-balancing-algorithm-principles-and-analysis-placement-strategy/README/README.md), explaining their mechanisms, exploring their combinations, and identifying the [two most suitable combinations](/thetumbleds-library/chapter-3-load-balancing-algorithm-principles-and-analysis-placement-strategy/3.-strategy-selection.md).

However, these two combinations still have significant defects. These flaws spurred me to design and develop a novel algorithm. In this chapter, we shall explore in depth the design of the new load-balancing algorithm `AvgShedder`.

The design document is included in the following PR:

[\[improve\] \[pip\] PIP-364: Introduce a new load balance algorithm AvgShedder](https://github.com/apache/pulsar/pull/22946)

\
The implementation source code can be seen in the following PR:\
[\[improve\]\[broker\] PIP-364: Introduce a new load balance algorithm AvgShedder](https://github.com/apache/pulsar/pull/22949)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://tumbleds-library.gitbook.io/thetumbleds-library/chapter-5-load-balancing-algorithm-avgshedder.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
