For balancing your workload over different webservers, there are several options. One of them is nginx. This post explains what nginx does, and how to configure it.
Last days I have been looking for a good proxy alternative. I now have one Dell PowerEdge server with 4 cpu’s as frontend to the myp2p.eu website. Behind that, there are 3 upstream servers. The frontend server needs to balance all connections. After some googling, I discoverend nginx (engine-x). Nginx is extremely flexible and light. It is created by some Russian, and he delivered one hell of a job.
The compilation of nginx was not hard. I specified a config path and pid path. Next to that I included the upstream_hash module and the stub_status module. The first one is to create a layer 4 (ip) persistence. The second one for some fancy statistics. To enable the upstream_hash module, I had to patch the sourcecode of nginx. This is the configuration command I used:
./configure --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --add-module=/root/src/nginx_upstream_hash-0.2/ --with-http_stub_status_module
Then nginx had to be configured in the nginx.conf. I specified an upstream cluster, pointing to the backend webservers:
upstream MyP2P {
server 10.0.0.67:80;
server 10.0.0.68:80;
server 10.0.0.70:80;
hash $remote_addr;
}
Later on in the configuration file, this cluster is used as a proxy pass. See complete config file in attachement.
Problem at this point is that the upstreams get connected via eth1 (internal). All data will be send to the client via eth0 (external). This means that the data now gets bounced by bcrelay, which is a CPU comsuming process. Probably a better NIC would solve this, or reduce the CPU time required. Another solution would be connection the upstream servers on the same NIC. Will be looking into this.