Why do you need lvs? when you have nginx?

I understand that lvs is a four-tier load balancer and nginx is a layer 7, but I still can"t understand why we still need lvs? when there is nginx. Are there any good examples to understand?

Jul.03,2021

personal understanding:

    lvs
    nginx:

in fact, what to use is determined according to the business scenario and requirements. As long as what suits you is the best, nothing is better than everything.


  1. LVS supports modes such as DR, TUN
    these two modes make it unnecessary for Director to be equipped with peer-to-peer network capacity
  2. layer 3 and layer 4 forwarding of LVS is more efficient than layer 7 of nginx

lvs supports layer 4 and layer 7 loads are very flexible and efficient.
nginx is a layer 7 load, so many complex situations cannot be satisfied because it works in the layer 7 application layer. For example, the open source version only supports http


php is the best language in the world, and I chose js
The principle of

is the same. Choose which one to use

according to the usage scenario.
Menu