It was thus said that the Great benjamin once stated:
> Hello,
> 
> I'm currently using Apache 2.2 under Debian Etch, with FastCGI/Suexec
> and Php5.2 (all of these softwares have been installed as Debian
> paquets, using aptitude).
> 
> CPU load is correct, however memory consumption is really high : some
> Apache 2 processes can take up to 10 % of total RAM, which is more or
> less equal to 200 Mb :
> 
> And here are a few details about the Apache 2 version I'm using :
> ----------------------------------------
> Server version: Apache/2.2.3
> Server built: Jan 27 2008 18:09:58
> Server's Module Magic Number: 20051115:3
> Server loaded: APR 1.2.7, APR-Util 1.2.7
> Compiled using: APR 1.2.7, APR-Util 1.2.7
> Architecture: 32-bit
> Server MPM: Worker
> threaded: yes (fixed thread count)
> forked: yes (variable process count)

  I recently discovered that pthreads (the threading library used on most
Unix systems, including Linux) uses the process limit for the stack for each
thread it creates.  You can check this value under Linux by running the
command "ulimit -s" at the command line.  

[spc]lucy:~>ulimit -s
10240
[spc]lucy:~>

  The value returned is in kilobytes, so the default stack size on my system
(CentOS) is 10M (and for a recent project I worked on, that explained why
the memory consumption was ridiculously huge---the program created a bunch
of threads).  

  You can decrease the amount of stack space by running the above command
with a value:

[spc]lucy:~>ulimit -s 128 # set maximum stack size to 128K

  but be warned that pthreads will use a minimum amount of stackspace (it
checks if the process limit is too small, and if so, will use its minimum
size).  This size is anywhere from 16k to 128k, depending upon the platform. 
Also, setting the stack to a smaller value *may* cause Apache to crash (the
reason why a 10M stack segment isn't a problem is that the statck grows
on the fly as the program is running; pthreads can't do that for thread
stacks and has to allocate the memory when the thread is created).

  -spc 


---------------------------------------------------------------------
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: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to