Pen & Pound- 2 Great opensource server Load balancing tools for Linux

Load balancing is a technique to distribute workload evenly across two or more computers, network links, CPUs, hard drives, or other resources, in order to get optimal resource utilization, maximize throughput, minimize response time, and avoid overload. Using multiple components with load balancing, instead of a single component, may increase reliability through redundancy. The load balancing service is usually provided by a dedicated program or hardware device (such as a multilayer switch or a DNS server).

Today will show you 2 load balancing tools, Pound and Pen.

Pound Balancing Tool:

“The Pound program is a reverse proxy, load balancer and HTTPS front-end for Web server(s). Pound was developed to enable distributing the load among several Web-servers and to allow for a convenient SSL wrapper for those Web servers that do not offer it natively.”

Installation

For ubuntu:


sudo apt-get install pound

For Fedora:

yum install pound

Now in this example  are  2  apache  servers and 1 pound  server. We will try to configure the load balancing between this servers.

To do that, edit  /etc/pound/pound.cfg and  replace everything below and including ListenHTTP :

vi /etc/pound/pound.cfg

Output

ListenHTTP
Address 192.68.1.110
Port    80
End

Service
BackEnd
Address 192.168.1.2
Port    80
End
BackEnd
Address 192.168.1.3
Port    80
End
End

If you are u sing a certicat ssl , generate a new certificate with:

cd /etc/ssl && openssl req -x509 -newkey rsa:1024 -keyout local.server.pem -out local.server.pem  -days 365 -nodes

and add to the pound config

ListenHTTPS
Address 202.54.1.5
Port    443
Cert    "/etc/ssl/local.server.pem"
End

After any configuration restart the pound with

# /etc/init.d/pound restart

PEN Load  balancer tool:

Pen. It’s also a load-balancing proxy, but handily it lets us choose whether or not the X_FORWARDED_FOR header gets changed. It’s about as fast as Pound, and about as stable. Its SSL support is still experimental, but that’s OK, since we’re proxying between local services, not serving as an external front-end. (If we were, we’d probably use Pound.)

This load balancer is known to work on FreeBSD, Linux, HP-UX and Solaris.

Installation:

First download and extract pen to your local directory. Then run the following commands:

	./configure
make
make install

By default the programs are installed in /usr/local/bin. This can be changed like this example:

        ./configure --prefix=/usr

to install into /usr/bin instead.

Lets  give  your  some  example  how  top run pen

HTTP + HTTPS

pen -l pen80.log -p pen80.pid -h lbhost:80 host1:80 host2:80
pen -l pen443.log -p pen443.pid -h lbhost:443 host1:443 host2:443

FTP

pen -l pen.log -p pen.pid lbhost:21 host1:21 host2:21

Can be used for other applications like mail mail mstp  and  openldap.