Re: Shared var between processes

Ben RUBSON <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On 20 Oct 2017 11:17, André Warnier (tomcat) wrote:

> On 20.10.2017 10:50, Ben RUBSON wrote:
>> On 20 Oct 2017 10:38, André Warnier (tomcat) wrote:
>>
>>> On 19.10.2017 22:02, John Dunlap wrote:
>>>> 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.
>>>
>>> And that seems the right way to me.
>>
>> What about a startup file, as proposed by Adam, which would return  
>> John's configuration
>> variables according to $ENV{'SERVER_NAME'} ? (using a switch/case for  
>> example)
>> Each virtualhost would then have its own configuration variables, having  
>> a uniq startup
>> file for the whole server.
>>
>> Would it be more performant than the PerlSetVar solution ? (doc  
>> sometimes warns about
>> PerlSet* performance)
> 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.
>
> (...)
>
> In comparison, the mechanism involving the environment has to set up this  
> environment repeatedly (at least each time a new Apache sub-process is  
> started).

Thank you for your deeply detailed answer André !

I think mod_perl already sets $ENV by default, at least $ENV{'SERVER_NAME'}  
is set.
Is there an additional cost to simply read $ENV{'SERVER-NAME'} ?
Goal would then be to set another variable according to it.

(that said, there is also $s->server_hostname() to retrieve server name)

> It seems much more maintainable (and documentable) to have everything in  
> one place.

I agree :)

Thank you !

Ben
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.