]> git.ipfire.org Git - thirdparty/haproxy.git/commit
CONTRIB: tcploop: implement fork()
authorWilly Tarreau <w@1wt.eu>
Sat, 12 Nov 2016 12:25:53 +0000 (13:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 Nov 2016 17:26:43 +0000 (18:26 +0100)
commit95a6b786fc10008ee774b538bf7221fd504de604
treec1741af563917b52153e16d7de12443deee4b7e1
parent84393aa86305385222a94fd09e32a3b70d23ee25
CONTRIB: tcploop: implement fork()

Fork is a very convenient way to deal with independant yet properly
timed connections. It's particularly useful here for accept(), and
ensures that any accepted FD will automatically be released. The
principle is that when we hit a fork command, the parent restarts
evaluating the actions from the beginning and the child continues
to evaluate the next actions. Listen and connect are skipped if the
connection is already established. Fork() is amazingly cheap on
Linux, 21k forked connections per second are handled on a single
core, and 38k on two cores.

For now it's not possible to have two different code paths so in order
to have both a listener and a connector, two distinct commands are
still needed.
contrib/tcploop/tcploop.c