You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Evert Lammerts <ev...@gmail.com> on 2008/03/19 12:27:46 UTC

[users@httpd] apache process locks at 100% cpu usage

Hi all,

On a php driven webpage we do 2 asynchronous requests with an 
xmlhttprequest immediately after the page loads. The first request 
returns without a problem, the second never returns and leaves the 
server (ubuntu dapper drake with apache 2.2.4) with an apache process 
using (according to the top command) 100% CPU. If you try, in the same 
browser window, to go to an other page the request wont load and 
stopping the server does not kill the process.

I did some debugging with xDebug on the second request after the 
pageload (which does not use any database functions) and doing this, or 
in other words delaying the response of the service, lets the request 
finish fine and doesn't leave the server with an unfinished process.

Any idea what to do?

I have the impression this has something to do with concurrent request 
handling, MPM. We're using prefork and the settings are:

# prefork 
MPM                                                                                                                

# StartServers: number of server processes to 
start                                                                          

# MinSpareServers: minimum number of server processes which are kept 
spare                                                  
# MaxSpareServers: maximum number of server processes which are kept 
spare                                                  
# MaxClients: maximum number of server processes allowed to 
start                                                           
# MaxRequestsPerChild: maximum number of requests a server process 
serves                                                   
<IfModule 
mpm_prefork_module>                                                                                                

    StartServers         
10                                                                                                  

    MinSpareServers      
10                                                                                                  

    MaxSpareServers     
100                                                                                                  

    MaxClients          
150                                                                                                  

    MaxRequestsPerChild   
0                                                                                                  

</IfModule>

Thanks, Evert



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: apache process locks at 100% cpu usage

Posted by Joshua Slive <jo...@slive.ca>.
On Wed, Mar 19, 2008 at 10:42 AM, Evert Lammerts
<ev...@gmail.com> wrote:
> And how about this: after benchmarking apache with ab -c 100 -n 10000 an
>  apache process is left in the process list for a while with <defunct>
>  appended - it disappears after a minute or so.
>
>  If I benchmark the server from two different machines with two different
>  requests, apache locks up, the benchmarks time out and the server is
>  left with a process list filled with apache2 processes that need to be
>  killed with killall. It does seem to be a concurrency problem but I
>  can't figure out where it comes from. Any help would be great!

Session locking?

This is almost surely some kind of lock contention in your php code.
You can grab a live backtrace of a "stuck" process to see where the
problem is:
http://httpd.apache.org/dev/debugging.html#backtrace

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: apache process locks at 100% cpu usage

Posted by Evert Lammerts <ev...@gmail.com>.
And how about this: after benchmarking apache with ab -c 100 -n 10000 an 
apache process is left in the process list for a while with <defunct> 
appended - it disappears after a minute or so.

If I benchmark the server from two different machines with two different 
requests, apache locks up, the benchmarks time out and the server is 
left with a process list filled with apache2 processes that need to be 
killed with killall. It does seem to be a concurrency problem but I 
can't figure out where it comes from. Any help would be great!

Evert

Evert Lammerts wrote:
> Hi all,
>
> On a php driven webpage we do 2 asynchronous requests with an 
> xmlhttprequest immediately after the page loads. The first request 
> returns without a problem, the second never returns and leaves the 
> server (ubuntu dapper drake with apache 2.2.4) with an apache process 
> using (according to the top command) 100% CPU. If you try, in the same 
> browser window, to go to an other page the request wont load and 
> stopping the server does not kill the process.
>
> I did some debugging with xDebug on the second request after the 
> pageload (which does not use any database functions) and doing this, 
> or in other words delaying the response of the service, lets the 
> request finish fine and doesn't leave the server with an unfinished 
> process.
>
> Any idea what to do?
>
> I have the impression this has something to do with concurrent request 
> handling, MPM. We're using prefork and the settings are:
>
> # prefork 
> MPM                                                                                                                
>
> # StartServers: number of server processes to 
> start                                                                          
>
> # MinSpareServers: minimum number of server processes which are kept 
> spare                                                  # 
> MaxSpareServers: maximum number of server processes which are kept 
> spare                                                  # MaxClients: 
> maximum number of server processes allowed to 
> start                                                           # 
> MaxRequestsPerChild: maximum number of requests a server process 
> serves                                                   <IfModule 
> mpm_prefork_module>                                                                                                
>
>    StartServers         
> 10                                                                                                  
>
>    MinSpareServers      
> 10                                                                                                  
>
>    MaxSpareServers     
> 100                                                                                                  
>
>    MaxClients          
> 150                                                                                                  
>
>    MaxRequestsPerChild   
> 0                                                                                                  
>
> </IfModule>
>
> Thanks, Evert
>
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org