Re: Apache 2.2 MPM Worker Virtual Memory Usage
On Sun, 21 Oct 2007, Ruediger Pluem wrote:
What is your setting for ThreadsPerChild?
On my Linux each thread consumes 8MB of virtual memory (I assume for
stack and other thread private data) as shown by pmap. This can sum
up to a large amount of memory.
This is due to linux libc setting the thread stack size using the
stack resource limit. We have the following in our apache httpd
startup script:
# NPTL (modern Linux threads) defaults the thread stack size to the setting
# of your stack resource limit. The system-wide default for this is 8MB,
# which is waaay exaggerated when running httpd.
# 512kB should be more than enough (AIX manages on 96kB, Netware on 64kB).
ulimit -s 512
We didn't bother with trying to lower it more, but I've run the same
httpd config on IBM AIX 5.1 with the default 96kB thread stack size
without problems.
This could probably be worked around in httpd/APR by calling setrlimit
before starting the threads, however I think it's probably better to
just document this Linux thread bogosity and let vendors fix their
httpd startup scripts though.
/Nikke
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se | [EMAIL PROTECTED]
---
No boom now. Boom tomorrow...there's ALWAYS a boom tomorrow...BOOM!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Re: Apache 2.2 MPM Worker Virtual Memory Usage
The default of 25 threads. 8MB * 25 = 200MB. Very helpful. Stack size. Doh. Why didn't I think of that. This should of course affect Prefork as well. The stack size must be less than 10MB with it. Does Apache change the stack size with Prefork? Or, is Linux handling the VM needs differently? I lowered ThreadStackSize down to 2MB from 10MB. How low can I go here without any programmatic modules (PHP, etc...) loaded? Thanks... StartServers 3 MaxClients 300 MinSpareThreads 75 MaxSpareThreads 250 ThreadsPerChild 25 MaxRequestsPerChild 0 [EMAIL PROTECTED] [/usr/local/apache/conf/extra]# ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited pending signals (-i) 1024 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size(512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 71680 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited # 10MB stack size [EMAIL PROTECTED] [/usr/local/apache/conf/extra]# pmap -x 9956 9956: /usr/local/apache/bin/httpd -k start -DSSL Address Kbytes RSSAnon Locked Mode Mapping 08048000 544 - - - r-x-- httpd 080d 16 - - - rw--- httpd 080d40001232 - - - rw---[ anon ] a6d7f000 16 - - - r-x-- libnss_dns-2.3.4.so a6d83000 4 - - - r libnss_dns-2.3.4.so a6d84000 4 - - - rw--- libnss_dns-2.3.4.so a6d85000 36 - - - r-x-- libgcc_s-3.4.6-20060404.so.1 a6d8e000 4 - - - rw--- libgcc_s-3.4.6-20060404.so.1 a6d9a000 4 - - - -[ anon ] a6d9b000 10240 - - - rw---[ anon ] a779b000 4 - - - -[ anon ] a779c000 10240 - - - rw---[ anon ] a819c000 4 - - - -[ anon ] a819d000 10240 - - - rw---[ anon ] a8b9d000 4 - - - -[ anon ] a8b9e000 10240 - - - rw---[ anon ] a959e000 4 - - - -[ anon ] a959f000 10240 - - - rw---[ anon ] a9f9f000 4 - - - -[ anon ] a9fa 10240 - - - rw---[ anon ] aa9a 4 - - - -[ anon ] aa9a1000 10240 - - - rw---[ anon ] ab3a1000 4 - - - -[ anon ] ab3a2000 10240 - - - rw---[ anon ] abda2000 4 - - - -[ anon ] abda3000 10240 - - - rw---[ anon ] ac7a3000 4 - - - -[ anon ] ac7a4000 10240 - - - rw---[ anon ] ad1a4000 4 - - - -[ anon ] ad1a5000 10240 - - - rw---[ anon ] adba5000 4 - - - -[ anon ] adba6000 10240 - - - rw---[ anon ] ae5a6000 4 - - - -[ anon ] ae5a7000 10240 - - - rw---[ anon ] aefa7000 4 - - - -[ anon ] aefa8000 10240 - - - rw---[ anon ] af9a8000 4 - - - -[ anon ] af9a9000 10240 - - - rw---[ anon ] b03a9000 4 - - - -[ anon ] b03aa000 10240 - - - rw---[ anon ] b0daa000 4 - - - -[ anon ] b0dab000 10240 - - - rw---[ anon ] b17ab000 4 - - - -[ anon ] b17ac000 10240 - - - rw---[ anon ] b21ac000 4 - - - -[ anon ] b21ad000 10240 - - - rw---[ anon ] b2bad000 4 - - - -[ anon ] b2bae000 10240 - - - rw---[ anon ] b35ae000 4 - - - -[ anon ] b35af000 10240 - - - rw---[ anon ] b3faf000 4 - - - -[ anon ] b3fb 10240 - - - rw---[ anon ] b49b 4 - - - -[ anon ] b49b1000 10240 - - - rw---[ anon ] b53b1000 4 - - - -[ anon ] b53b2000 10240 - - - rw---[ anon ] b5db2000 4 - - - -[ anon ] b5db3000 10240 - - - rw---[ anon ] b67b3000 4 - - - -[ anon ] b67b4000 10240
Re: Apache 2.2 MPM Worker Virtual Memory Usage
What is your setting for ThreadsPerChild? On my Linux each thread consumes 8MB of virtual memory (I assume for stack and other thread private data) as shown by pmap. This can sum up to a large amount of memory. Regards RĂ¼diger On 10/21/2007 12:29 PM, Apache Dev wrote: > > I tried asking this on the users mailing list. But, I think it is beyond > that list. > > There appears to be a significant difference between Apache 2.2 MPM > Worker and MPM Perfork virtual memory usage. As well as between Apache > 2.2 MPM Worker and Apache 1.3 virtual memory usage. This can become an > issue in a VPS (virtual private server) environment where resources are > more constrained. Privvmpages is limited in this environment. The impact > here is that some VPS users simply cannot run the Worker MPM. Which is > unfortunate. > > I am seeing 280MB vs 5.8MB of VM usage per process. You could argue that > worker is supposed to use more virtual memory, as running multiple > threads per process it actually uses less. But, that is not the case. > Total VPS privvmpages is 2.1GB vs 358MB. What is really interesting here > is why is it so much higher. You would expect some increase but it looks > like most (if not all) of the virtual memory of each of the 7 worker > processes is not shared. 7 * 280MB = 2GB. Which means it can't be code. > I don't see how it could be this much code anyway. So then what is it? > (Conversely most of the 2.2 perfork virtual memory is shared code. 150 * > 5.8MB = 850MB,which is more than 358MB for the entire VPS.) Is the code > building some kind of large local process database? Anyway to turn it off? > > Note I do not have PHP or any other programmatic modules loaded. See > below for configure info. > > Thanks... >
