Pen
C Shell Roff M4 Makefile
Switch branches/tags
Nothing to show
Clone or download
ulric
ulric Fix issue #38
Latest commit d560fe1 Feb 17, 2017
Permalink
Failed to load latest commit information.
X64 bringing up to date Feb 25, 2015
X86 bringing up to date Feb 25, 2015
.gitignore git: ignore autoconf/automake files May 1, 2015
AUTHORS added more files Feb 11, 2014
COPYING added more files Feb 11, 2014
ChangeLog Fix issue #38 Feb 17, 2017
HOWTO added more files Feb 11, 2014
INSTALL INSTALL: point out the difference between building from tarball and g… May 2, 2015
LICENSE.md LICENSE.md: added OpenSSL exception clause Mar 31, 2015
Makefile.am mergelogs: use diagnostics from diag.c May 19, 2015
Makefile.win Makefile.win: added -DFD_SETSIZE to CFLAGS in order to get a more use… Sep 27, 2016
NEWS added more files Feb 11, 2014
README clarified the use of penlogd with direct server return and transparen… Aug 20, 2015
TODO . Mar 2, 2015
acl.c added acl range check to match_acl Nov 17, 2015
acl.h fix build on platforms without dsr support (broken by tarpit code) Nov 18, 2015
bootstrap.sh bootstrap.sh: remove libtoolize line Jun 8, 2015
client.c tarpit support Nov 17, 2015
client.h Allow the connection table size to be updated in the fly May 27, 2015
config.h.in Netmap support on FreeBSD Apr 26, 2015
config.h.win . May 13, 2015
configure.ac Fix issue #38 Feb 17, 2017
conn.c Added CS_HALFDEAD for UDP streams that haven't seen traffic in a while Mar 28, 2016
conn.h choose server based on client's first frame Jan 7, 2017
diag.c Many changes for compatibility with Windows. May 13, 2015
diag.h Replaced all calls to perror with debug(..., strerror(errno); + Updat… Apr 24, 2015
dlist.c Removed unnecessary #include <pen.h> in dlist.c Aug 28, 2015
dlist.h broke out dlist prototypes into dlist.h Feb 28, 2015
dsr.c dsr: don't confuse switches May 3, 2016
dsr.h fix build on platforms without dsr support (broken by tarpit code) Nov 18, 2015
epoll.c Check for EPOLLHUP Jun 29, 2016
event.c Many changes for compatibility with Windows. May 13, 2015
event.h handle errors in epoll code Nov 21, 2015
idlers.c Removed the fixed server table size May 27, 2015
idlers.h More refactoring Apr 22, 2015
kqueue.c kqueue.c conn.h: added necessary includes Apr 29, 2015
memory.c Broke out memory management into memory.[ch]. Apr 19, 2015
memory.h Broke out memory management into memory.[ch]. Apr 19, 2015
mergelogs.1 man: fix NAME section of manual pages May 1, 2015
mergelogs.c removed unused code May 19, 2015
netconv.c Fixed issue #30: UDP not working in combination with a configuration … Sep 14, 2016
netconv.h Fixed issue #30: UDP not working in combination with a configuration … Sep 14, 2016
pen-ocsp.sh pen-ocsp.sh script improved Apr 12, 2015
pen.1 Deprecated -Q option Mar 18, 2016
pen.c Fix issue #38 Feb 17, 2017
pen.h Allow setting local address for upstream connections. Oct 24, 2016
pen.spec added more files Feb 11, 2014
pen_epoll.h Broke out event initialization into event.[ch]. Added pen_epoll.h, pe… Apr 19, 2015
pen_kqueue.h Broke out event initialization into event.[ch]. Added pen_epoll.h, pe… Apr 19, 2015
pen_poll.h Broke out event initialization into event.[ch]. Added pen_epoll.h, pe… Apr 19, 2015
pen_select.h Broke out event initialization into event.[ch]. Added pen_epoll.h, pe… Apr 19, 2015
penctl.1 Allow setting local address for upstream connections. Oct 24, 2016
penctl.c Cleaned up for 0.33.0 release. Apr 7, 2016
penctl.cgi Add LICENSE.md, update copyrights Mar 25, 2015
penlog.1 man: fix NAME section of manual pages May 1, 2015
penlog.c Replaced all calls to perror with debug(..., strerror(errno); + Updat… Apr 24, 2015
penlogd.1 man: fix NAME section of manual pages May 1, 2015
penlogd.c Cleaned up for 0.33.0 release. Apr 7, 2016
penstats added more files Feb 11, 2014
poll.c #inclde <string.h> in poll.c for strerror Apr 24, 2015
select.c fixed spelling error (to large => too large) in select.c Sep 27, 2016
server.c check bind return value Oct 24, 2016
server.h Fixed issue #30: UDP not working in combination with a configuration … Sep 14, 2016
settings.c Fixed issue #30: UDP not working in combination with a configuration … Sep 14, 2016
settings.h Fixed issue #30: UDP not working in combination with a configuration … Sep 14, 2016
siag.pem added more files Feb 11, 2014
ssl.c ssl: add compatibility with OpenSSL 1.1.0 Oct 27, 2016
ssl.h Added support for Server Name Indication Apr 7, 2015
testsuite.sh Added transparent UDP test case to testsuite.sh Feb 17, 2016
windows.c Cleaned up for 0.33.0 release. Apr 7, 2016
windows.h Fixed issue #30: UDP not working in combination with a configuration … Sep 14, 2016

README

This is pen, a load balancer for udp and tcp 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
scalable performance.

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.


A side-effect of load-balancing web servers is that several logfiles
are produced, and by default, Pen operates in a proxy mode that makes
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.

The Direct Server Return and Transparent Reverse Proxy modes make
accesses seem to come directly from the client. Multiple logfiles
are still created, and Penlogd can still be used to consolidate them
automatically.


This load balancer is known to work on FreeBSD, Linux, HP-UX and Solaris.
Other Unixes should work as well, possibly requiring trivial changes.
Success stories or problem reports are welcome.


If pen is started with the -w option, statistics are saved in html
format when a USR1 signal is received. The cgi script penstats can
be used to simplify this; it must be edited to reflect local conditions.


I am Ulric Eriksson, ulric@siag.nu.