You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Eugene S. Panenko" <es...@agama.com> on 2000/05/26 12:38:06 UTC

Problem with mod_perl

Hi all,

Sorry if it is an incorrect list to ask...

I have a strange problem with mod_perl. I've tested mod_perl using a very
simple scripts (one of them is attached). The network load is emulated via LAN
using a special proggy. The problem is: under load above 20 requests per second
after working some time (about 15-30 sec) Apache daemon stopts accepting new
connections and blocks forever (without -X option httpd at this moment begin
forking until it eats all resources) . I've found that the problem exists
only when scripts use modules (tested with CGI v 2.46, IPC::Shareable, our own
modules).  Test scripts without modules work fine even under load of 200
requests per second.

I observed this on two machines, both under FreeBSD/i386 (3.3-RELEASE and
3.4-RELEASE, kernel options: maxusers 256, NMBCLUSTERS=4096).  I've tried Apache
v. 1.3.9 through 1.3.12, perl  5.005_03, mod_perl 1.22 and 1.24. Most Apache's
config variables have default values, except that I added several lines
which are nessesary for mod_perl scripts: 

Alias   /scripts/       /usr/local/www/scripts/
<Directory /usr/local/www/scripts>
        SetHandler      perl-script
        PerlHandler     Apache::Registry
        PerlSendHeader  On
        PerlModule      CGI
        Options         +ExecCGI
</Directory> 

-- 
Regards,
	Eugene.

RE: Problem with mod_perl

Posted by Greg Estep <ge...@thinkronize.com>.
On Fri, 26 May 2000, Eugene S. Panenko wrote:

> Hi all,
>
> Sorry if it is an incorrect list to ask...
>
> I have a strange problem with mod_perl. I've tested mod_perl using a very
> simple scripts (one of them is attached). The network load is emulated via
LAN
> using a special proggy. The problem is: under load above 20 requests per
second
> after working some time (about 15-30 sec) Apache daemon stopts accepting
new
> connections and blocks forever (without -X option httpd at this moment
begin
> forking until it eats all resources) . I've found that the problem exists
> only when scripts use modules (tested with CGI v 2.46, IPC::Shareable, our
own
> modules).  Test scripts without modules work fine even under load of 200
> requests per second.


Without knowing too much about your apache config. files, machine specs,
etc. I am guessing that your Apache MaxClients is still set at 150 (the
out-of-the-box value).

When apache receives a request that it cannot immediately handle (all of the
pre-forked process are busy) it will fork another one (up to MaxClients).
Eventually, you will run out of physical memory and begin to hit your swap
space.  When this happens, it takes longer to handle a request.  That causes
more requests to back up in the queue, so apache forks some more processes
to handle the load. These new processes increase the amount of swapping that
needs to be done, and the situation gets out of control.

How many subprocesses you can support depends upon the size of your httpd
process's text and data segments.  I have seen several mod_perl applications
increase the size of an httpd process to over 10 Mbytes.  If you set
MaxClients to a number that can be safely stored in physical memory
(adjusting for the OS and other processes running on the machine, of course)
you might eliminate your problem.

--
Greg Estep <ge...@thinkronize.com>


Re: Problem with mod_perl

Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 26 May 2000, Eugene S. Panenko wrote:

> Hi all,
> 
> Sorry if it is an incorrect list to ask...
> 
> I have a strange problem with mod_perl. I've tested mod_perl using a very
> simple scripts (one of them is attached). The network load is emulated via LAN
> using a special proggy. The problem is: under load above 20 requests per second
> after working some time (about 15-30 sec) Apache daemon stopts accepting new
> connections and blocks forever (without -X option httpd at this moment begin
> forking until it eats all resources) . I've found that the problem exists
> only when scripts use modules (tested with CGI v 2.46, IPC::Shareable, our own
> modules).  Test scripts without modules work fine even under load of 200
> requests per second.

what are the frozen server doing if you strace them?

does it make a difference if you move 'my(%accessed)' inside your 'sub
Main'?  you should do that anyhow to avoid the 'variable won't stay
shared' problem.


Re: Problem with mod_perl

Posted by Ged Haywood <ge...@jubileegroup.co.uk>.
Hi there,

On Fri, 26 May 2000, Eugene S. Panenko wrote:

> The problem is: under load above 20 requests per second after
> working some time (about 15-30 sec) Apache daemon stopts accepting
> new connections and blocks forever (without -X option httpd at this
> moment begin forking until it eats all resources)

How much RAM in the machines?

73,
Ged.