Elizabeth Mattijsen wrote:
I was wondering whether the following trick could somehow work with mod_perl 2. And excuse my preference for prefork MPM's: I guess that's the hammer to work on all my nails (pun intended). I'm open to other solutions to this "problem"!

Liz, when you are talking about prefork mpm, you get a better chance to get more people to read your question if you don't mention mp2. My guess is that folks won't even try to reply, since they aren't familiar with mp2. But your question applies to mp1 just as well.


The problem:
-----------------

When you're using prefork MPM, you try to create as many constant data-structures as possible before the children are being forked. Sometimes, these structures require updating during the lifetime of the server, but the updated information does not need to be available to all the currently running children. And/Or you don't want the server to be completely restarted for that. An example would be a blacklist of IP-numbers that you want to block, or indexes that only need updating if a new entry is added.

If I remember correctly, you mentioned this to me back at YAPC::Paris in July. But back then you said you are going to gracefully restart the child processes, after updating the parent's data so that the newly spawned processes will see the updated info. It won't work in any other way.


You are probably much better off using a dbm file or some other external cache, so that you don't need to look for tricky solutions. David Harris wrote Apache::DB_File which is optimized for read-often/update-rarely case.

and a Perl*Handler (PreConnection?) is installed. This handler should run _inside_ the parent before each request. It would conceptually go like this:

PreConnection will work only if you don't use KeepAlive. With KeepAlive it'll be executed once for the whole connection. If you are talking about serving HTTP, you probably want PerlInitHandler. Similar to Apache::Reload.



__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com


-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to