> 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-2-load-balancing-algorithm-principles-and-analysis-load-shedding-strategy.md).

# Chapter 2 Load Balancing Algorithm - LoadSheddingStrategy

In Chapter 1, we introduced the basic principles of load balancing and compared the performance of different algorithms to obtain an important scoring table. In the next two chapters, we will delve into the implementation principles of different algorithms and elaborate on the process of obtaining this scoring table. This analysis process is also the cornerstone for the subsequent design of the new algorithm `AvgShedder`. Only by accurately identifying the root causes of defects in the old algorithms and avoiding these issues in the design of the new algorithm can we scientifically and reasonably design a new algorithm.&#x20;

We previously introduced that the execution of load balancing is divided into `LoadSheddingStrategy` and `ModularLoadManagerStrategy`. Therefore, in this chapter, we will first introduce the `LoadSheddingStrategy` and then introduce the `ModularLoadManagerStrategy` in the next chapter.

<figure><img src="https://3549286078-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fd3bYBC2M7QmbunDfuqpO%2Fuploads%2Fgit-blob-4f03420244f0c1ccb255d2ba9e98a5504e14bdbe%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

The load balancer calls `LoadSheddingStrategy#findBundlesForUnloading` to find the bundles that need to be unloaded. It passes the load data (`LoadData`) it collects and the broker configuration (configured by the `broker.conf`file) and obtains a `MultiMap` that maps brokers to bundles.

The load data `LoadData` includes the throughput, message rate, and resource usage (including CPU usage, network card in/out usage, direct memory usage, and memory usage) of each broker, as well as the throughput and message rate information of each bundle, for the use of the load balancing algorithm.


---

# 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-2-load-balancing-algorithm-principles-and-analysis-load-shedding-strategy.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.
