Re: Dollar Self Storage (aka mod_perl children sharing/updating data on a schedule)

Ryan Gies <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Organization Livesite Networks, LLC
Message-ID <[email protected]>
On 01/03/2011 04:48 PM, Jeff Anderson wrote:
> the goal being that each child will not have to hit a database for every request.
>    
If the reason behind not hitting the database on each request is because 
you don't want to impact your page-response times, know that the Cleanup 
phase happens after the response has been sent to the client.

The below demonstration assigns a cleanup handler which sleeps for 3 
seconds.  You will notice that your pages still load before the snooze 
handler is run.

# ---- Source from: .../httpd.conf ----

PerlModule            Apache2::Testing
PerlCleanupHandler    Apache2::Testing->snooze_handler

# ---- Source from: .../Apache2/Testing.pm ----

package Apache2::Testing;
use strict;
use ModPerl::Util;
our $Seconds = 3;
sub snooze_handler {
   my $phase = ModPerl::Util::current_callback();
   warn sprintf("[%d] %s: is sleeping for %d seconds.\n", $$, $phase, $Seconds);
   sleep $Seconds;
   warn sprintf("[%d] %s: is now awake.\n", $$, $phase);
}
1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.