This is Pen, a highly scalable, highly available, robust load balancer
for tcp and udp based protocols such as
dns, http or smtp. It allows several servers to appear as one to the
outside and automatically detects servers that are down and distributes
clients among the available servers. This gives high availability and
Pen works on Linux, FreeBSD, OpenBSD, NetBSD, Solaris and most other
Posix-like systems. It can also be installed as a service on Windows.
Pen supports GeoIP filtering and can be configured for SSL termination,
direct server return and transparent reverse proxy.
Pen is of course compatible with IPv4 and IPv6 as well as local sockets
on systems that have them.
Git source here:
The load balancing algorithm keeps track of clients and will try to
send them back to the server they visited the last time. The client
table has a number of slots (default 2048, settable through command-line
arguments). When the table is full, the least recently used one will
be thrown out to make room for the new one.
This is superior to a simple round-robin algorithm, which sends a client
that connects repeatedly to different servers. Doing so breaks
applications that maintain state between connections in the server,
including most modern web applications.
When pen detects that a server is unavailable, it scans for another
starting with the server after the most recently used one. That way
we get load balancing and "fair" failover for free.
Correctly configured, pen can ensure that a server farm is always
available, even when individual servers are brought down for maintenance
or reconfiguration. The final single point of failure, pen itself,
can be eliminated by running pen on several servers, using vrrp to
decide which is active.
Sander van Burken noticed that it wasn't possible to specify a listening address
in the configuration file when using UDP: it was created as TCP even if -U was
used on the command line.
Harry G. Coin found that Pen would use the CARP address as local address in
upstream connections. An expected behaviour, but undesirable when CARP is used
with two instances of Pen. A new configuration option allows another source
address to be specified.
Vincent Bernat added support for OpenSSL 1.1.0. OpenSSL 1.0.2 is still supported.
Full list of changes:
161028 Merged pull request from Vincent Bernat for OpenSSL 1.1.0 compatibility.
This fixes issue #28.
161024 Allow setting local address for upstream connections. This fixes issue #31.
New penctl command "source" to set this option.
160914 Fixed issue #30: UDP not working in combination with a configuration file.
Description of redundancy using vrrpd on Linux
The Ultimate Cheapskate Cluster
A blog, mostly about Pen
(Old) mailing list archive
A side-effect of the load-balancing is that several logfiles are produced,
and all accesses seem to come from the load balancer. The program
penlogd solves this problem by merging pen's log file with the ones
produced by the web servers. See penlogd(1) and penlog(1) for details.
Pen emits statistics when it receives a USR1 signal, but the output
can be hard to interpret. The cgi script webstats
can be used in conjunction with the -w option to pen to get statistics
in HTML format instead.
Take a look here to see what
a Pen status can look like here at siag.nu. This is not "live" data, but
generated from this cron job every 10 minutes:
2,12,22,32,42,52 * * * * kill -USR1 `cat /var/run/pen.pid`
Note that there are usually few active connections. This is because of the
way the web works: the client connects, the server sends data, the
client disconnects. The whole transaction is over in seconds.
This load balancer is known to work on a long lite of operating systems,
including but not limited to FreeBSD, Linux, HP-UX, Windows and Solaris.
Other Unixes should work as well, possibly requiring trivial changes.
Success stories or problem reports are welcome.
It runs on Windows, too.
And on MacOS X.
The Git source repository is automatically test built and tested every hour to catch compatibility issues.
The current build and test status can be seen on this web page:
Automatic test status
The easiest way to install Pen nowadays is to get it from one of the
distributions that package it (most do). On e.g. Debian or Ubuntu the entire process is:
apt-get install pen
And on Fedora:
yum install pen
If you still want to install from source because you need features not built
into the packages, here's how. Type:
By default the programs are installed in /usr/local/bin. This can
be changed like this example:
to install into /usr/bin instead.
Contributed start scripts
Github source repository
Hercules Load Balancer Virtual Appliance, a VMware virtual machine based on Pen ("repackaged" version here)
Penbw, Pen backend
watcher, monitors and blacklists backends automatically in case
of a failure
Pre-compiled packages for Solaris
A redundant load-balancing firewall system, using FreeBSD
Zen load balancer, a load balancer appliance based on Pen.
Freshmeat project page
Load balancing UDP on EC2