当前位置:网站首页>What are the ways to realize load balancing?
What are the ways to realize load balancing?
2022-07-19 14:04:00 【ZNineSun】
List of articles
Load balancing is an application of cluster . Through the allocation of traffic , So as to improve the concurrent processing ability , Generally we mean web Load balancing , Now let's discuss how many ways there are for load balancing ?
First of all, we need to be clear about : What is the purpose of load balancing ?
Distribute user requests to many servers , Solve the problem of high concurrency

1.HTTP Redirect load balancing

The load balancing process is shown in the figure above :
1、 Request to the load balancing server ;
2、 According to the equalization algorithm , return 403, Redirect to the server actually responsible for Computing IP Go to browser ;
3、 Then the browser directly requests the server actually responsible for the calculation ;
4、 Finally, the server actually responsible for computing corresponds to the client browser ;
shortcoming
1、 The request passes through the server twice ( Load balancing server , Actual computing server ), Added corresponding time ;
2、 Exposed the actual load of the server public network IP Go to browser , Low security ;
Java Implementation code
response.sendRedirct("http://127.0.0.1/service?param=a");
2.DNS Load balancing

The load balancing process is shown in the figure above
1、 User requests domain name , Ask to DNS The server ;
2、DNS The server returns parsed IP Address to client , It is not exposed to the browser for redirection ;
3、 The client gets the returned server in charge of calculation IP, Request server ;
4、 The computing server returns the corresponding information ;
improvement
1、 You don't need to request the load every time IP, It can be cached , Reuse , Provide performance ;
2、DNS There is no need to expose the actual computing server IP( It is not exposed in the browser by redirection , Instead, I did secondary load balancing , Intranet IP It won't come out ), The security is slightly better ;
This method is adopted for multi activity in different places , One IP Resolve to different regions IP, Realize the load balancing of the first layer , Then based on the region IP Do secondary load balancing ;
3. Reverse agent load balancing

The load balancing process is shown in the figure above
1、 The client initiates a request to the load balancing server , The load balancing server gets the load according to the algorithm IP;
2、 The load balancing server constructs the request , Computing server requesting intranet load ;
3、 The computing server returns the corresponding results to the load balancing server ;
4、 The load balancing server returns the corresponding results to the client ;
such as nginx、apache
shortcoming
1、 be based on HTTP Load balancing done by layer , It is a relatively heavy agreement , It's a little inefficient ;
2、 It is generally suitable for smaller clusters ,10 + scale ;
4.IP Layer load balancing

On the network layer IP Address to replace , Don't need to HTTP Work on the layer , Directly in the operating system kernel IP Replace address in packet , Efficient than HTTP Layer reverse proxy high ;
The load balancing process is shown in the figure above
1、 The client requests the load balancing server ;
2、 Load balancing server modification purpose IP For intranet machines IP;
3、 The calculation of the intranet machine is completed , Corresponding IP Change to server balanced server IP Internal network address ;
4、 The load balancing server modifies the corresponding IP For your own Internet IP, Return the result to the client ;
shortcoming
Requests and responses need to go through the load balancing server IP Layer replacement , The corresponding data will become the bottleneck in the later stage ;
5. Data link layer load balancing

Solve the problem of excessive data and low efficiency , By modifying the data link layer mac Address ,IP Using virtual IP, To achieve load balancing ;
The load balancing process is shown in the figure above
1、 The client requests the load balancing server ;
2、 Load balancing server replacement mac The address is the computing server ,IP Load balancing server IP;
3、 The computing server directly sends the corresponding data to the client ;
This load balancing method has the highest throughput , Large Internet companies adopt this load balancing method ;
LVS Load balancing (Linux Virtual Server) It's a combination of IP Load balancing method of layer and data link ,IPVS Is its specific implementation module ;Linux These two load balancing methods can be realized through configuration .
边栏推荐
- 鸿蒙设备开发快速入门之Helloword与LED——华为云14天鸿蒙设备开发实战学习笔记 第二篇
- 跑通Caffe ResNet-50网络实现图片分类——基于华为云Ai1s
- iVX低代码平台系列详解 -- 概述篇(二)
- Android开发大厂面试,做好这3个准备,规划好自己
- 【7.9】代码源 -【选数】【序列操作】【Minimum Or Spanning Tree】
- Robotics at Google:Laura Graesser | i-Sim2Real:在紧密的人机交互循环中强化学习机器人策略
- "Podcast" \ # 392 original Tang Lang original food: MIDSUMMER night, ma Sha, kebab, Kebab
- QT use qlisview to realize QQ login history list
- Use of Google browser developer tools (Master!)
- 活动预告|Apache Doris x Apache SeaTunnel 联合 Meetup 开启报名!
猜你喜欢
![[code hoof set novice village 600 question] calculate the number of digits of an integer](/img/4b/4c2b6889decd30bb2e0f3b28dee0cf.png)
[code hoof set novice village 600 question] calculate the number of digits of an integer

面额10exp(303)的钞票

No.3汇编进阶
![[code hoof set novice village question 600] format specifier of float and double](/img/19/433f794617f3c3c72732f1a4efe252.png)
[code hoof set novice village question 600] format specifier of float and double

Programming examples of stm32f1 and stm32subeide -mpu-6050 six axis (gyroscope + accelerometer) drive

活动预告|Apache Doris x Apache SeaTunnel 联合 Meetup 开启报名!

unity 实现UI-背包装备拖拽功能

Introduction:Multiple DataFrames
![[7.15] code source - [neat array 2] [ternary cycle] [reverse pair on tree] [sequence of cochlea]](/img/86/8300586819e76502134e8467dc28a3.png)
[7.15] code source - [neat array 2] [ternary cycle] [reverse pair on tree] [sequence of cochlea]
![[Flink] Flink will report an error if it fails to set checkpoints once. Setlerablecheckpointfailurenumber does not work](/img/62/5761d8d7b2d8ea1bc74b609b6aa3c7.jpg)
[Flink] Flink will report an error if it fails to set checkpoints once. Setlerablecheckpointfailurenumber does not work
随机推荐
【7.15】代码源 -【整齐的数组2】【三进制循环】【树上逆序对】【蜗蜗的数列】
Is it safe for Hongye futures to open an account online? Are there any account opening guidelines?
Start from here by counting the information of the broadcast room
unity 实现UI-背包装备拖拽功能
About XML file (VII) - XML DTD
Go exceed API source code reading (III) -- openreader ()
云审计服务CTS是一项付费服务,付费项目包括开通追踪器、事件跟踪以及7天内事件的存储和检索等相关费用
Some puzzles about data dictionary
Analyze and hook sshd to hijack password
AcWing第 60 场周赛
Version announcement | Apache Doris 1.1 release version officially released!
NFT市场格局仍未变化,Okaleido能否掀起新一轮波澜?
NO.4位、字节、信息存储
asterisk:No compatible codecs, not accepting this offer!
OpenSSL operation
Luogu p3522 [poi2011] TEM temperature solution
看一看try{}catch{}
topy库的安装(拓扑优化软件)
Introduction:Multiple DataFrames
[postgraduate entrance examination vocabulary training camp] day 5 - alarm, cooperate, point, benefit, industrial, revolution, mechanism