Haproxy
The main function is load balancing, load balancing algorithm support a lot, support health check, support various sessions to maintain the way, support remote information acquisition and so on. The haproxy itself is a load-balanced software.
But haproxy on the scale is very poor, adding new features is very laborious, for the expanding new business, haproxy difficult to deal with.
Nginx
Web server-based, load balancing although there is nginx plus but, not open source, nginx The biggest advantage is the structure is good, support module expansion, there are basic anti-generation model.
Nginx supports a few load balancing algorithms, and does not support health checks, and does not provide remote information acquisition capabilities.
Conclusion
It is relatively easy to generate a load Balancer service based on nginx modification. If you modify with Nginx, you may need to make some major changes to the existing framework.
The first one needs to increase the health check function in master.
The second session holds the module and the Load Balancer module at the location of the refactoring.
The third load-balancing algorithm relies on a comprehensive set of mechanisms to rely on global data.
The above describes the Nginx Haproxy both the advantages and disadvantages of doing load balancing, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.