Using Phusion Passenger with HAProxy
Today I decided to turn on HAProxy to load-balance between Apache instances running Phusion Passenger on two separate machines. The results are clear. Doing this nearly doubled our ApacheBench throughput scores.
This config was adaped from the 37Signals blog post here.
# /etc/haproxy/haproxy.cfg
global
maxconn 4096
defaults
mode http
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen web1 XXX.XXX.XXX.210:80
mode http
balance roundrobin
server web1 XXX.XXX.XXX.210:8080
server web2 XXX.XXX.XXX.211:8080
Passenger is configured the normal way.
<VirtualHost *:8080>
ServerName www.example.com
DocumentRoot /var/www/rails_project/current/public
</VirtualHost>






