Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: mod_perl children process

by sundialsvc4 (Abbot)
on Oct 08, 2017 at 20:38 UTC ( [id://1200950]=note: print w/replies, xml ) Need Help??


in reply to mod_perl children process

It is, in fact, working as designed.   Let’s sort your list by PID to see if we can thereby discern what is actually happening:

i=1, mod_perl/2.0.8, pid is 17578 i=2, mod_perl/2.0.8, pid is 17578 i=3, mod_perl/2.0.8, pid is 17578 i=4, mod_perl/2.0.8, pid is 17578 i=5, mod_perl/2.0.8, pid is 17578 i=1, mod_perl/2.0.8, pid is 467 i=2, mod_perl/2.0.8, pid is 467 i=3, mod_perl/2.0.8, pid is 467 i=1, mod_perl/2.0.8, pid is 24789 i=2, mod_perl/2.0.8, pid is 24789 i=3, mod_perl/2.0.8, pid is 24789 i=1, mod_perl/2.0.8, pid is 24378 i=2, mod_perl/2.0.8, pid is 24378 i=1, mod_perl/2.0.8, pid is 2742 i=2, mod_perl/2.0.8, pid is 2742

We plainly see from this that Apache is running your process using five child-processes, and that the requests are being handled by a per-process Perl instance that has not disappeared (since $i is incrementing), so we know that mod_perl is doing its job.   (Your program is not “being recompiled each time.”)   We also observe that each process is an independent instance, each owning its own independent Perl interpreter context, each with its own distinct and unrelated notion of what $i is.

Replies are listed 'Best First'.
Re^2: mod_perl children process
by hippo (Bishop) on Oct 09, 2017 at 08:02 UTC
    Let’s sort your list by PID

    I cannot guess the sorting mechanism which results in (17578, 467, 24789, 24378, 2742) being a sorted sequence. Perhaps you could enlighten me?

      It's the order of the first appearance of each PID in the OP's output.

      So, more like de-interleaving than sorting.

Re^2: mod_perl children process
by LorCo (Initiate) on Oct 11, 2017 at 00:04 UTC
    Why Apache start compile new process if few of them already exists?
    I have heavy scripts where perl load many libraries and I see Apache re-load and recompile whole code every few requests.

      From Re: mpm-worker + mod_perl2 settings meaning

      If all running interpreters are in use, mod_perl will clone new interpreters to handle the request, up until this number of interpreters is reached. when PerlInterpMax is reached, mod_perl will block (via COND_WAIT()) until one becomes available (signaled via COND_SIGNAL()). Default value: 5

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1200950]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-18 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found