LP#1339190 Add support for the "Multiplex" personality user/blake/LP1339190
authorMike Rylander <mrylander@gmail.com>
Wed, 11 Sep 2013 19:52:00 +0000 (15:52 -0400)
committerBlake GH <blake@mobiusconsortium.org>
Fri, 5 Dec 2014 16:08:54 +0000 (10:08 -0600)
commitb0786d3ae13fedb87b13463c18e1bfb43df9c3b5
tree950523440e4250ca65af855a3b484f88083e289e
parentc8e2ac5fe68961219095ab1b42486b161ce68e48
LP#1339190 Add support for the "Multiplex" personality

We use Net::Server::Multiplex to reduce resource consumption.  In
this mode, SIPServer will maintain connection state in the main
listening process and fork workers as needed to handle individual
requests.

Initial implementation by Mike Rylander, with a conversion from
File::Queue to Memcache, and LOTS of debugging, by Bill Erickson.

Some highlights:

* A fork fence for max concurrent in-flight requests

* Allow the ILS to save state in IO::Multiplex mode

* Optimistic login using fork-and-check

When a SIP child process is spawned to handle a new connection login,
the pending login is tracked in the parent process (by PID) and the
child indicates to the parent that the login has succeeded by storing
login success/failure plus some state information in memcache.  Any time
the parent wakes up to process a message, it checks for completed logins
so they can be resolved as OK in the parent and the state information
is extracted and stored for future conversation with the resolved client.

* Let workers hang around for a bit for higher-rate clients

For some clients, such as AMH (sorters), the per-message connections
cause too much latency.  So, instead, we'll let their backends hang
around for a while.  This is controlled by a new attribute on the
server-params element, worker-keepalive, as a peer to the personality
value.  This value can also be set on the institution and login elements
to support finer-grained keepalive tuning.

This is measured in seconds and the default is 5. A value of 0 here
will disable this feature altogether.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Conflicts:

SIPServer.pm
Sip/MsgType.pm

Signed-off-by: Blake GH <blake@mobiusconsortium.org>
SIPServer.pm
SIPconfig.xml
Sip.pm
Sip/Configuration.pm
Sip/MsgType.pm