> 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-1-load-balancing-algorithm.md).

# Chapter 1 Load Balancing Algorithm - Introduction

Thanks to the architecture of Pulsar's separation of storage and computation, Pulsar can easily switch loads to different computing nodes, brokers, achieving load switching in seconds, thus laying the foundation for the implementation of the load balancing module. The load balancing module is a core component of Pulsar. When expanding new machines or reducing machines, it can automatically distribute the load across various broker machines, greatly reducing the operational burden.

Kafka is difficult to accomplish load balancing because Kafka's storage and computation are coupled. If you want to transfer the load to other nodes, you must replicate the data on the current node. This process incurs high costs and consumes valuable business traffic bandwidth. Consequently, Kafka's scaling process are troublesome, usually requiring DevOps to intervene, and often requires a significant amout of time for data replication, so that the load can be slowly transferred to the new node. However, operations like expansion are usually carried out in emergencies. This gives rise to an awkward scenario: there is an urgent need for a rapid response, yet it cannot be achieved promptly, and one can only wait anxiously.

In this chapter, we will first provide a preliminary discussion on the basic principles of Pulsar load balancing and compare the performance of different algorithms. Next, we will elaborate on the reasons for developing a new load-balancing algorithm—`AvgShedder`. Finally, we will detail the outstanding performance of `AvgShedder` in production environments and its configuration methods, guiding users on how to correctly configure and use `AvgShedder` based on their actual needs. Subsequent chapters will delve deeper into the analysis of load-balancing algorithms.

&#x20;


---

# 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-1-load-balancing-algorithm.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.
