Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: mod_perl / mason - variable shared between apache2's children

by Crackers2 (Parson)
on May 21, 2009 at 02:14 UTC ( #765364=note: print w/replies, xml ) Need Help??

in reply to Re: mod_perl / mason - variable shared between apache2's children
in thread mod_perl / mason - variable shared between apache2's children

I think that's irrelevant here. What matters is not _how_ you populate those variables, but the fact that you only want to do it once per server instance.

In ASP and Cold Fusion there's the concept of Application vairables, which are shared between all requests and processes of the server. They were great for configuration options to your application. You'd load them once (from a real config file or a DB most likely; either way relatively slow), and then you could just use the variables in each request without much overhead.

The most common way to emulate these in perl and PHP seems to be populating the variables on each request, which has always seemed somewhat wasteful to me. (when running under mod_perl I suspect there's probably a way to have real shared variables; I've never used Perl much for web programming myself)

  • Comment on Re^2: mod_perl / mason - variable shared between apache2's children

Replies are listed 'Best First'.
Re^3: mod_perl / mason - variable shared between apache2's children
by trwww (Priest) on May 21, 2009 at 15:47 UTC

    Right, its not how but when. If you have some read only data (config data), load it before apache forks its children and apache will share the memory without duplicating it in each child.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://765364]
[marto]: they have a commercial product called perlapp
[mark4]: Do you h=know how I can get pp.exe? Is there a module I can install that includes this?
[marto]: I always found Strawberry Perl on windows to be a much better environment, made life much easier
[marto]: pp. install it like you would any other module
[marto]: it probably exists in one of the PPM repositories
[marto]: failing that see the README
[mark4]: I installed "PAR" from the ppm install window. pp.exe. did not show up.
[marto]: it should just be a script, pp, or on windows pp.bat, post install you should just be able to call pp -x packed.exe as the PPM package should put everything required into the appropriate path

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2018-01-19 14:15 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (218 votes). Check out past polls.