On 1/1/2014 2:45 PM, ksakhare wrote:
Hi All
Thanks for the replies. I appriciate the replies but the problem i am
currently facing is when i initialize the connection pool in worker 1
(httpd.exe child process), next request may spawn another worker (httpd.exe
process). As these are two different process the connection pool is
re-initialized in second worker.
I would like to avail the connections initialized in first worker from
second worker process. Is there a way, where i create this connection in
global memory pool which is accessible across the worker process.
This is just software, so of course there is a way, but I think you need to
ask yourself *why* you think this is necessary, because the mechanism you
are describing is the most complex. As Eric already pointed out, most
modules don't bother with it. In the example I gave you, the connection
pool per worker process is set up *before* the worker becomes "alive" and
serving requests. Usually the reason why you would want to have a global
connection pool set up just once and then shared is to reduce the perceived
overhead of setting up the connection each time a new worker is spawned. If
the connection pool is established as the child is created, before it
serves requests, the visible effect is the same, and much much simpler.
The example code I posted earlier is also MPM agnostic. It solves the
persistent connection pool problem in such a way that each thread in a
worker process will have its own connection, which will have been
established already before your first request is served. So my suggestion
is that you try it, don't get stuck on the implementation you have
envisioned because it really is the (considerably) more complex route. Just
my $0.02.
Kean