What is availability?
HA (high availability) that is highly available; when is the single point of failure in a high-availability cluster to automatically shift resources and switching service, to ensure always-on service mechanism.
LVS
LVS: (linux virtual server) that is linux virtual server; mainly to achieve load balancing role.
LVS composition
LVS program consists of two parts, including ipvs and ipvsadm
- ipvs (ip virtual server): a piece of code work in kernel space, called ipvs, the code went into effect achieved scheduling.
- ipvsadm: another period of work in user space, called ipvsadm, is responsible for the preparation ipvs core framework of rules that define who is a cluster service, and who is the real back-end server (Real Server)
Load Balancing Compare
LVS:
- Strong anti-load capacity. Anti-load capacity, high performance, can reach 60% F5 hardware; memory and cpu resource consumption is relatively low
- 4 works in the network layer, the vrrp forwarding protocol (the distribution purposes only), the specific processing flow of the linux kernel, so no flow.
- Stability, reliability, itself has a perfect Redundancy; (eg: LVS + Keepalived)
- Broad range of applications, load balancing can be done for all applications;
- Does not support regular treatment, we can not do static and dynamic separation.
- It supports load balancing algorithms: rr (round robin), wrr (weighted round robin), lc (minimum connection), wlc (weighted least connections)
- Complex configuration, dependent on the network is relatively large, high stability.
Ngnix:
- Work on the seven layers of the network, you can do some diversion policy for http applications, such as for the domain name, the directory structure;
- Nginx dependent on the network is relatively small, it is theoretically possible to ping function of load can be carried out;
- Nginx relatively simple to install and configure, test more convenient;
- It can also take a high load pressure and stable, generally support more than 10,000 concurrent times;
- Health checks for the back-end server supports only be detected through the port does not support detected by url.
- Nginx asynchronous processing request can help reduce the load on the server node;
- Nginx can only support http, https and Email protocols, so that a lesser scope.
- It does not support the Session held directly, but through the ip_hash to resolve. On the Big request header support is not very good,
- Supports load balancing algorithms: Round-robin (round robin), Weight-round-robin (weighted round robin), Ip-hash (Ip hash)
- Nginx can do a Web server that is Cache function.
HAProxy:
- Agent supports two modes: TCP (four) and HTTP (seven), support for virtual hosts;
- Nginx can complement some shortcomings such as Session remains, Cookie guidance, etc.
- Support url detection of the back-end server detects the problem will be a good help.
- More load balancing strategies such as: Dynamic Weighted Round Robin (Dynamic Round Robin), weighted source address hash (Weighted Source Hash), weighted and weighted parameters URL hash hash (Weighted Parameter Hash) has been achieved
- Just from the efficiency in terms of HAProxy more than Nginx has better load balancing speed.
- HAProxy can load balance Mysql, the rear end of the DB nodes to detect and load balancing.
- Supports load balancing algorithms: Round-robin (round robin), Weight-round-robin (weighted round robin), source (original address remains), RI (request URL), rdp-cookie (based on cookie)
- That can not be done Web server Cache