当前位置:网站首页>Haproxy cluster
Haproxy cluster
2022-07-04 12:03:00 【Feather weaving song】
Occupy the pit , Subsequent updates
One 、Haproxy brief introduction
Haproxy It's a use C Free and open source software written in language , It provides high availability 、 Load balancing , And based on TCP and HTTP Application proxy for .
1.1Haproxy Applied analysis
LVS In enterprise application, it has strong anti load ability , But there are shortcomings
LVS Regular processing is not supported , Can't achieve the separation of static and dynamic
For large websites ,LVS The implementation configuration of is complex , Maintenance costs are relatively high
Haproxy Is a high availability 、 Load balancing 、 And based on TCP and HTTP Application agent software
Suitable for heavy load web Site
Running on hardware, it can support tens of thousands of connection requests for concurrent connections
1.2Haproxy Characteristics of
Very good reliability and stability , Can work with hardware level F5 Load balancing devices
It can be maintained at the same time 40000-50000 Two concurrent connections , The maximum number of requests processed per unit time is 20000 individual , The maximum processing capacity can reach 10Git/s
Support up to 8 A kind of load balancing algorithm , It also supports session keeping
Support virtual host function , So as to achieve web Load balancing is more flexible
Support connection rejection 、 Unique functions such as fully transparent agent
Have a strong ACL Support , For access control
Its unique elastic binary tree data structure , The complexity of data structure is raised to 0(1), That is, the query speed of data will not decrease with the increase of data items
Support client side keepalive function , Reduce client and haproxy Multiple handshakes and three handshakes lead to resource cost , Let multiple requests in one tcp In connection
Support TCP Speed up , Zero copy function , Be similar to mmap Mechanism
Support response pooling (response buffering)
Support RDP agreement
Source based stickiness , Be similar to nginx Of ip_hash function , Scheduling requests from the same client to the same server upstream in a certain period of time
Better statistical data interface , Its web The interface displays the acceptance of each server in the backend 、 send out 、 Refuse 、 Statistics of errors, etc
Detailed health status testing ,web Interface for health detection status of upstream servers , And provides a certain management function
Traffic based health assessment mechanism
be based on http authentication
Command line based management interface
Log Analyzer , The log can be analyzed
1.3 Common load balancing strategies
Haproxy Support a variety of scheduling algorithms , The most commonly used ones are 8 Kind of
1)RR(Round Robin)
RR Algorithm is the simplest and most commonly used algorithm , Polling scheduling
Understand examples : There are three nodes A、B、C
The first user access is assigned to the node A
The second user access will be assigned to the node B
A third user access is assigned to the node C
The fourth user access continues to be assigned to the node A, Polling allocates access requests to achieve load balancing
2)LC(Least Connections)
Minimum number of connections algorithm , Dynamically allocate front-end requests according to the number of nodes connected to the back-end
Understand examples : There are three nodes A、B、C, The number of connections of each node is A:4 B:5 C:6
First user connection request , Will be assigned to A On , The number of connections becomes A:5 B:5 C:6
The second user request will continue to be assigned to A On , The number of connections becomes A:6 B:5 C:6; A new request will be assigned to B, Each time a new request is assigned to the client with the smallest number of connections
Because of the actual situation A、B、C The number of connections will be released dynamically , It's hard to have the same number of connections
This algorithm is compared with rr The algorithm has been greatly improved , It is an algorithm that uses more rice money
3)SH(Source Hashing)
Source based access scheduling algorithm , For some Session The session is recorded on the server , Can be based on the source of IP、Cookie Wait for cluster scheduling
Understand examples There are three nodes A、B、C, The first user's first access was assigned to A, The second user's first access is assigned to B
When the first user accesses the second time, it will be assigned to A, The second user will still be assigned to B, As long as the load balancer does not restart , The first user will be assigned to A, The second user access will be assigned to B, Realize the scheduling of clusters
The advantage of this scheduling algorithm is to keep the session , But some IP When the traffic is very large, it will cause load imbalance , Some nodes have a large number of accesses , Affect business use
4)uri
Means according to the request URI, do cdn Need to use
5)url_param
Express basis HTTP Request headers to lock each One Time HTTP request .
6)rdp—cookie(name)
According to cookie (name) To lock and hash every time TCP request .
7) source
Indicates that according to the source of the request IP, similar Nginx Of IP hash Mechanism .
8) static-rr
According to the weight , polling
边栏推荐
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12
- Configure SSH key to realize login free
- Process communication and thread explanation
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 16
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 15
- A few words explain redis cache penetration, breakdown, avalanche, and redis sentinel
- Workplace liquor bureau must pay attention to
- Polymorphic system summary
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
- Video analysis
猜你喜欢
Experiment 7. IPv6
netstat
Summary of collection: (to be updated)
Summary of Shanghai Jiaotong University postgraduate entrance examination module -- cryptography
Reptile learning winter vacation series (2)
OSI seven layer reference model
OSI seven layer model & unit
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 22
Climb Phoenix Mountain on December 19, 2021
CSDN documentation specification
随机推荐
Entitas learning [iv] other common knowledge points
Decrypt the advantages of low code and unlock efficient application development
Ternsort model integration summary
Process communication and thread explanation
In 2022, financial products are not guaranteed?
Definition and method of string
2020 Summary - Magic year, magic me
Map container
CSDN documentation specification
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 22
nn. Exploration and experiment of batchnorm2d principle
Polymorphic system summary
Usage of case when then else end statement
LVS+Keepalived实现四层负载及高可用
How to disable debug messages on sockjs stomp - how to disable debug messages on sockjs Stomp
Lecture 9
守护进程Xinted和日志记录Syslogd
Customized version of cacti host template
Games101 Lesson 8 shading 2 Notes