During seasonal peaks or as traffic grows, there will be a need to add multiple app servers to your Magento store. A load balancer for Magento becomes essential. We have found that using nginx as a load balancer gives acceptable performance. We have not found many instances where we would recommend a hardware load balancer. Recent tests by nginx confirms this.
We would recommend a different load balancer only for additional features such as autoscaling.
Nginx as a load balancer offers many advantages including
- uneven upsream servers as nginx can assign weights to each load balancer
- self healing – takes a upstream server out of a cluster if it stops responding
- path based load balancing
- combination of path based and weight based load balancing
- php upstream servers
- SSL/TLS termination
This article assumes the process of adding a new app server to a Magento cluster is well understood. Here the focus is on the nginx configuration.