You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Fabian Kreitner <fa...@ainea-ag.de> on 2005/09/21 17:34:30 UTC

PerlInterpMaxRequests

Hello,

I've recently switched to Apache 2 with mod_perl 2. Unfortunately I 
still have to run some perl scripts which only worked with 
Apache::PerlRun and PerlSetVar PerlRunOnce On.

After a bit of reading I concluded that ....

<VirtualHost *:8080>

  ServerName            test
  DocumentRoot          /test/html

  PerlOptions           +Parent

  PerlInterpStart       1
  PerlInterpMax         1
  PerlInterpMaxRequests 1

  PerlResponseHandler   ModPerl::PerlRunPrefork

  <Files *.epl>
    SetHandler          perl-script
    PerlOptions         -ParseHeaders
    Options             +ExecCGI
  </Files>

</VirtualHost>

... should allow those scripts (ending in *.epl) to run while not 
affecting other stuff in other virtual hosts.

However, it wont.

A simple test script like >>> print "OLD: $::empty"; $::empty = 1;" <<< 
will work as expected the first time but the second time it will output 
 >>> OLD: 1 <<< (fail). Alternately it works and fails a few times and 
then will fail every time after that, just as if it filled up available 
server processes. (It also remembers having "use"d stuff and reports 
"not a code reference" when it fails.)

Looks like I misunderstood what PerlInterpMaxRequests is supposed to 
do.What am I missing? What do I need to change to allow such scripts to 
run? Changing the scripts is unfortunately no option.

Thank you for your help.

-- 
Mit freundlichen Grüßen

Ainea AG
Fabian Kreitner

Rheinuferstraße 9
67061 Ludwigshafen

Telefon:  +49 (0)621 - 59 29 77-0
Fax:      +49 (0)621 - 59 29 77-99
E-Mail:   fabian.kreitner@ainea-ag.de
Website:  http://www.ainea-ag.de


Re: PerlInterpMaxRequests

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Fabian Kreitner wrote:
>>> Fabian Kreitner wrote:
>>>
>>>>  PerlInterpStart       1
>>>>  PerlInterpMax         1
>>>>  PerlInterpMaxRequests 1
This works for me.
FYI, you need an ithread enabled perl, but you probably know that or you 
wouldn't have gotten this far :)


<VirtualHost *:8080>
     DocumentRoot /httpd-2.0.54/prefork-ithreads/my_htdocs

     PerlSwitches  +inherit

     PerlInterpStart 1
     PerlInterpMax 1
     PerlInterpMaxRequests 1

     PerlResponseHandler ModPerl::PerlRunPrefork

     <Files *.epl>
         SetHandler perl-script
         PerlOptions -ParseHeaders
         Options +ExecCGI
     </Files>
</VirtualHost>

Test Script:
#!perl

$count++;

print "Content-Type: text/html\n\n";
print "Count is $count\n";

1;



-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com

Re: PerlInterpMaxRequests

Posted by Fabian Kreitner <fa...@ainea-ag.de>.
Well, I found the problem. I need to set ...
(1) KeepAlive Off
(2) MaxRequestsPerChild 1

(1) can be set in the virtual host, unfortunately (2) cant. So it will 
be a global performance hit :-(
If I leave MaxRequestsPerChild > 1 it will cycle between several perl 
threads (checked with /perl-status) even though it should only have 
started a single interpreter.

Fabian Kreitner wrote:

>
> Thank you for your suggestion.
>
> Unfortunately MaxRequestsPerChild cannot be set in a virtual host. 
> Setting it outside and removing PerlOptions +Parent didnt change the 
> behaviour either.
>
> Philip M. Gollucci wrote:
>
>> Fabian Kreitner wrote:
>>
>>>  PerlInterpStart       1
>>>  PerlInterpMax         1
>>>  PerlInterpMaxRequests 1
>>
>>
>> You might try setting:
>> MaxRequestsPerChild 1
>> for preform mpm
>>
>> Though I thought
>> PerlInterpMaxRequests 1
>> should work too
>>
>> http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlInterpMaxRequests_ 
>>
>> http://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_Directives_Argument_Types_and_Allowed_Location 
>>
>>
>> I supposed I'd have to try this when I get some time.
>>
>


-- 
Mit freundlichen Grüßen

Ainea AG
Fabian Kreitner

Rheinuferstraße 9
67061 Ludwigshafen

Telefon:  +49 (0)621 - 59 29 77-0
Fax:      +49 (0)621 - 59 29 77-99
E-Mail:   fabian.kreitner@ainea-ag.de
Website:  http://www.ainea-ag.de


Re: PerlInterpMaxRequests

Posted by Fabian Kreitner <fa...@ainea-ag.de>.
Thank you for your suggestion.

Unfortunately MaxRequestsPerChild cannot be set in a virtual host. 
Setting it outside and removing PerlOptions +Parent didnt change the 
behaviour either.

Philip M. Gollucci wrote:

> Fabian Kreitner wrote:
>
>>  PerlInterpStart       1
>>  PerlInterpMax         1
>>  PerlInterpMaxRequests 1
>
> You might try setting:
> MaxRequestsPerChild 1
> for preform mpm
>
> Though I thought
> PerlInterpMaxRequests 1
> should work too
>
> http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlInterpMaxRequests_ 
>
> http://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_Directives_Argument_Types_and_Allowed_Location 
>
>
> I supposed I'd have to try this when I get some time.
>

-- 
Mit freundlichen Grüßen

Ainea AG
Fabian Kreitner

Rheinuferstraße 9
67061 Ludwigshafen

Telefon:  +49 (0)621 - 59 29 77-0
Fax:      +49 (0)621 - 59 29 77-99
E-Mail:   fabian.kreitner@ainea-ag.de
Website:  http://www.ainea-ag.de


Re: PerlInterpMaxRequests

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Fabian Kreitner wrote:
>  PerlInterpStart       1
>  PerlInterpMax         1
>  PerlInterpMaxRequests 1
You might try setting:
MaxRequestsPerChild 1
for preform mpm

Though I thought
PerlInterpMaxRequests 1
should work too

http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlInterpMaxRequests_
http://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_Directives_Argument_Types_and_Allowed_Location

I supposed I'd have to try this when I get some time.


-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com