Re: Shared var between processes
André Warnier (tomcat) <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
On 21.10.2017 21:20, john edstrom wrote: > What about IPC::Shareable? Its for shared memory. I've used it before, > but not with Apache. I'm no sure that works well under Windows. (The whole point for me of Apache/perl/mod_perl being that it is multi-platform) There is also memcache, but that's a whole setup, and maybe overkill here. > > JE > > On Sat, 2017-10-21 at 08:53 +0200, André Warnier (tomcat) wrote: >> On 20.10.2017 17:15, Adam Prime wrote: >>> On 17-10-20 05:17 AM, André Warnier (tomcat) wrote: >>>> On 20.10.2017 10:50, Ben RUBSON wrote: >>>>> On 20 Oct 2017 10:38, André Warnier (tomcat) wrote: >>>>> >>>> I believe that there is much more of a performance hit, when asking the server to set up >>>> an environment ($ENV) for sub-processes, than via the PerlSetVar mechanism. >>> >>> You don't need to use $ENV. If you're using handlers you could use >>> $r->server()->server_hostname. >>> >>> You could certainly create a big hash at startup and grab stuff out of it that way, where >>> the top level key is the hostname. >> >> Assuming that you wanted to do this, where would you put this big hash, so that it is >> persistent across requests, and can be accessed by mod_perl handlers ? >> >> (I have my own scheme to do this, but I'm curious about maybe a better / less "hacky" way) >> >> If the data that you want to store is just strings >>> though, this might be overkill. If, however, you want to create deeper datastructures from >>> a somewhere, then this would be a perfectly acceptable way to do that. PerlSetVar is great >>> with just strings, but not for anything any more complicated than that. It does have to be >>> static configuration. >>> >>> All the other limitations that André mentioned are completely accurate though. >>> >>> Adam