perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Dunlap <j...@lariat.co>
Subject Re: Shared var between processes
Date Thu, 19 Oct 2017 20:02:47 GMT
To piggy back onto this question, what is the best way to do this such that
the values of the variables are different for every virtual host? In our
model, all virtual hosts shared the same interpreter pool but we need to
have different configuration variables on a per virtualhost basis.
Currently, we are using PerlSetVar for this purpose.

On Thu, Oct 19, 2017 at 3:57 PM, Ben RUBSON <ben.rubson@gmail.com> wrote:

> Nice, perfect, just tested, working perfectly !
> Thank you very much Adam !
>
> Ben
>
>
>
> On 19 Oct 2017 18:39, Adam Prime wrote:
>
> If it doesn't need to change then you should be able to set it in
>> PerlPostConfigRequire code, and it will then be available to all children
>> in copy on write memory (ie any change will only affect the process that
>> changed it.)
>>
>> https://perl.apache.org/docs/2.0/user/handlers/server.html#Startup_File
>>
>> Adam
>>
>>
>> On 17-10-19 12:11 PM, Ben RUBSON wrote:
>>
>>> Hi,
>>> I'm trying to share a var between the different processes of my prefork
>>> Apache.
>>> I then tried the following idea :
>>> $r->server()->dir_config('var','val');
>>> Unfortunately, $r->server()->dir_config('var') is not shared among the
>>> processes.
>>> I would have thought config was stored at the very first Apache process
>>> (the parent) level.
>>> Other solution is IPC::Shareable (one more module to load :-/)
>>> Any other solution ?
>>> I would have been happy with an Apache-only way to do this (like I tried
>>> above).
>>> I need the var to be set only one time to a constant random value, then
>>> to be read by the different processes.
>>> I then also thought about an environment variable set when Apache
>>> starts, and then given to Perl using "PerlSetVar var ${VAR}".
>>> But 1. var value would be disclosed into Apache env which I want to
>>> avoid, 2. PerlSetVar at every request is perhaps not really perfect in
>>> terms of performance.
>>> Thank you very much for your help !
>>> Ben
>>>
>>
>
>


-- 
John Dunlap
*CTO | Lariat *

*Direct:*
*john@lariat.co <john@lariat.co>*

*Customer Service:*
877.268.6667
support@lariat.co

Mime
View raw message