72 Star 329 Fork 136

百度开源 / BRPC

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
lalb.md 1.92 KB
一键复制 编辑 原始数据 按行查看 历史
zyearn 提交于 2017-10-16 09:01 . Translating lalb.md

Overview

Locality-aware load balancing(LALB) is an algorithm that can send requests to downstream servers with the lowest latency timely and automatically. The algorithm is originated from the DP system and is now added to brpc!

Problems that LALB can solve:

  • Round-robin and random policy is not good at scheduling requests since configurations and latencies of downstream servers are different.
  • Downstream servers, offline servers and other servers are deployed hybridly and it is hard to predict performance.
  • Automatically schedule most of the requests to the server in the same machine. When a problem occurs, try the server acrossing the machines.
  • Visit the server in the same server room first. When a problem occurs, try another server room.

...

Background

The most common algorithm to redirect requests is round-robin and random. The premise of these two methods is that the downstream servers and networks are similar. But in the current online environment, especially the hybrid environment, it is difficult to achieve because:

  • Each machine runs a different combination of programs, along with some offline tasks, the available resources of the machine are continuously changing.
  • The configurations of machines are different.
  • The latencies of network are different.

These problems have always been there, but are hidden by machine monitoring from hard-working OPs. There are also some attempts in the level of frameworks. For example, WeightedStrategy in UB redirects requests based on cpu usage of downstream machines and obviously it cannot solve the latency-related issues, or even cpu issues: since it is implemented as regularly reloading a list of weights, one can imagine that the update frequency cannot be high. A lot of requests may timeout when the load balancer reacts. And there is a math problem here: how to change cpu usage to weight.

C/C++
1
https://gitee.com/baidu/BRPC.git
git@gitee.com:baidu/BRPC.git
baidu
BRPC
BRPC
master

搜索帮助