in reply to Re^2: Getting mod_perl to actually 'activate'..
in thread Getting mod_perl to actually 'activate'..

The code you're showing here will take no time at all to run under mod_perl since it will be compiled into constants on the first request. However, keep in mind that we're talking about the first request per process, so you may hit a different child process each time on your first few clicks. An easy way to tell is it to put something like this in your script:
our $counter; $counter++; print $counter;

Replies are listed 'Best First'.
Re^4: Getting mod_perl to actually 'activate'..
by MashMashy (Sexton) on Feb 16, 2009 at 17:37 UTC
    Okay, this is the meat of the problem, then. Rather than make a new thread, mind if I talk about it here?

    Here are the questions I'm getting hug up on, it seems:
    1. how often will these be 'recompiled'?
    2. how can I tell when all the 'child processes' are good to go (i.e. all preloaded)
    3. should I expect these to re-"precompile" on me? This code is being hit by a great many different users once a day - will it compile for each user, or only until all the 'child processes' are good to go?
    3b. am I thinking of 'child processes' incorrectly here?

    Again, Thanks so much - you are turning a light on in a dark room. :)
      Oh, and, would that 'counter' script you put in actually work under ::PerlRun?
        No, you're right, that will only work with Registry. You should really try to get your code running under Registry if you want speed.

      It will be compiled when process executes it first time. It depends on the number of children and MaxRequestsPerChild how often it will be recompiled. You can't tell when all processes are good as they have limited by the MaxRequestsPerChild time of life and new processes may be created at any moment.

        Hm, I think I see the problem now, or at least the 'correct question to ask'.

        See, currently in CGI, the code uses SelfLoader to only serve up the needed subs. in mod_perl, I had assumed that all of the subs would have to be loaded, so they could precompile.

        Is there another way? and could you give me the first couple steps of that 'way' (assuming one exists), so I can try it on?