You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ethan Joffe <et...@toolfoundry.com> on 2004/03/14 22:34:16 UTC

passing external data into modperl

I am trying to find the most efficient way to send a piece of information 
from an external program to apache/modperl such that each process will have 
the value when next checked. The idea is to have an in memory variable that 
changes infrequently, but needs to be checked every time a script that uses 
it is run. The application is to keep frequently used database data cached 
in modperl, and to send a cache dirty revision number when something which 
might be cached is modified. I know one can use a file, and check the file 
contents each time, but this seems extremely expensive considering my very 
small script does not access any other files (I am ignoring the standard 
overhead for modperl checking if the script has changed, etc). I could also 
keep the revision number in the DB, but the DB overhead seems an even 
bigger waste. Note that using a simple dirty flag does not suffice since 
each process needs to keep track of whether it is up to date, so it needs 
to be a value.

Is there a way to pass a value into apache such that each modperl process 
then has access to it? Note that when a new value is passed before a 
process had a chance to check the previous one, it is OK for the previous 
one to never have been seen.

I am using Apache::Registry.

Any ideas?

-Ethan 


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: passing external data into modperl

Posted by Perrin Harkins <pe...@elem.com>.
Ethan Joffe wrote:
> Is there a way to pass a value into apache such that each modperl 
> process then has access to it?

You have to use a sharing mechanism of some kind.  IPC::MM, BerkeleyDB, 
and Cache::FastMmap are all very efficient for single machines.  For 
clusters, a simple table in MySQL is almost as fast as those.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: passing external data into modperl

Posted by Tom Schindl <to...@profile.co.at>.
Hi,

You can share data between processes using various techniques:

1. SHM
2. Berkely DB
3. ...

See here for other modules:
http://mathforum.org/epigone/modperl/naubrouclee/3F1D0C4C.9020009@stason.org

Tom

On Sun, 2004-03-14 at 22:34, Ethan Joffe wrote:
> I am trying to find the most efficient way to send a piece of information 
> from an external program to apache/modperl such that each process will have 
> the value when next checked. The idea is to have an in memory variable that 
> changes infrequently, but needs to be checked every time a script that uses 
> it is run. The application is to keep frequently used database data cached 
> in modperl, and to send a cache dirty revision number when something which 
> might be cached is modified. I know one can use a file, and check the file 
> contents each time, but this seems extremely expensive considering my very 
> small script does not access any other files (I am ignoring the standard 
> overhead for modperl checking if the script has changed, etc). I could also 
> keep the revision number in the DB, but the DB overhead seems an even 
> bigger waste. Note that using a simple dirty flag does not suffice since 
> each process needs to keep track of whether it is up to date, so it needs 
> to be a value.
> 
> Is there a way to pass a value into apache such that each modperl process 
> then has access to it? Note that when a new value is passed before a 
> process had a chance to check the previous one, it is OK for the previous 
> one to never have been seen.
> 
> I am using Apache::Registry.
> 
> Any ideas?
> 
> -Ethan 
-- 
   \\\||///
  \\  - -  //
   (  @ @  )
-oOo--( )--oOo----------------------------------------------------------
                     ___  ___                                tom schindl
      o       __    /  / /           innovative medientechnik planung AG
     / /\/\/ / /   /__/ / __            mailto:tom.schindl@profile.co.at
    / / / / /_/   /  / /___/                        http://www.impire.de
           /                 voice:+43(512)34193431,fax:+43(512)34193420
   Eduard-Bodem-Gasse 6, A-6020 Innsbruck, Austria, Software Engineering
------------------------------------------------------------------------


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html