Hi,
I am working on
OpenXPKI, an open source PKI project that has (roughly) the following design:
- A server (using Net::Server::Fork) listens on a Unix domain socket for connections and handles messages from users.
- A Mason/mod_perl-based web interface talks to this server.
So we have one forked server for each connection made by the webserver, which (depending on how many Apache workers there are) turns into quite an amount of idling connections (and into a good amount of overhead for newly forking those servers, which do some setup each time they are forked (re-opening DB connections, for example). I guess the design is not exactly the best here, but I am currently not in the position to change it.
This is why I am looking at some kind of connection pooling mechanism, so my basic idea would be have a server that listens at another domain socket, have the apache workers talk with this one and let this server have a pool of connections to the "real" server, of which it knows whether they are currently usable for a request.
I am looking for suggestions on how to implement this best. POE::Component::Client::Keepalive looks interesting, but I haven't had much exposure to POE yet. Anything else I might be missing, or maybe an easy way to fix that problem without introducing a new connection pooling server?
Looking forward to your suggestions ...
Alex