perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Anderson <>
Subject Dollar Self Storage (aka mod_perl children sharing/updating data on a schedule)
Date Mon, 03 Jan 2011 21:48:53 GMT

I am looking to set up a mod_perl handler which keep track of the
count of requests coming in. Each child process will store this data
in local memory and after 5-10 minutes have passed, each child process
will merge its data into a central database, the goal being that each
child will not have to hit a database for every request.

I have a handler that contains a data in $self for each child and when
a REQUEST comes through, a check is made to see if the interval has
passed and if so, the child will merge its data with the database.

The problem is --- how do i additionally have each child merge its
data on a schedule -- that is, without relying only on an incoming
request to "hit" that specific child process? I have tried 2 attempted
solutions with no luck. (Keep in mind that as long as requests are
coming in, the children will eventually merge their data within a good
degree of accuracy, but only if requests are coming in.)

Attempt #1 --- configure a signal handler and send a signal to each
child process - this didn't seem to work but i am about to try some
more tests. I have read in the docs, however, that sending direct
signals to mod_perl children is not recommended.

Attempt #2 --- register a Clean Up hook. This doesn't seem to work for
me because, as i understand so far, assigning a reference to a sub via
PerlCleanupHandler is not the same as calling the object's method.
Hence ... i do not have access to $self nor the local memory. So, the
sub is called via the Clean Up phase, but the sub is meant to be
called as a method (and i can't use $self has a hash ref unless called
as a method).

Other considerations:

- Perhaps each child process will need to use it's own SQLite or similar cache?
- Perhaps there is another hook that i do not know about that better
suits such needs?
- Perhaps my mistake is obvious -- configuring Clean up hook incorrectly, etc.

Any information will be greatly appreciated. I hope everyone had a
Happy New Year. On a side note -- there is a storage facility in LA
called "Dollar Self Storage" ... :)


View raw message