httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Dev <apache...@mcarlson.com>
Subject Re: Apache 2.2 MPM Worker Virtual Memory Usage
Date Sun, 21 Oct 2007 11:56:18 GMT

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

root@vps [/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
root@vps [/usr/local/apache/conf/extra]# pmap -x 9956
9956:   /usr/local/apache/bin/httpd -k start -DSSL
Address   Kbytes     RSS    Anon  Locked Mode   Mapping
08048000     544       -       -       - r-x--  httpd
080d0000      16       -       -       - rw---  httpd
080d4000    1232       -       -       - 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 ]
a9fa0000   10240       -       -       - rw---    [ anon ]
aa9a0000       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 ]
b3fb0000   10240       -       -       - rw---    [ anon ]
b49b0000       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       -       -       - rw---    [ anon ]
b71b4000       4       -       -       - -----    [ anon ]
b71b5000   10240       -       -       - rw---    [ anon ]
b7bb5000     228       -       -       - rw-s-    [ anon ]
b7bee000      36       -       -       - r-x--  libnss_files-2.3.4.so
b7bf7000       4       -       -       - r----  libnss_files-2.3.4.so
b7bf8000       4       -       -       - rw---  libnss_files-2.3.4.so
b7c04000       8       -       -       - rw---    [ anon ]
b7c06000    1176       -       -       - r-x--  libc-2.3.4.so
b7d2c000       8       -       -       - r----  libc-2.3.4.so
b7d2e000       8       -       -       - rw---  libc-2.3.4.so
b7d30000       8       -       -       - rw---    [ anon ]
b7d32000       8       -       -       - r-x--  libdl-2.3.4.so
b7d34000       4       -       -       - r----  libdl-2.3.4.so
b7d35000       4       -       -       - rw---  libdl-2.3.4.so
b7d36000      56       -       -       - r-x--  libpthread-2.3.4.so
b7d44000       4       -       -       - r----  libpthread-2.3.4.so
b7d45000       4       -       -       - rw---  libpthread-2.3.4.so
b7d46000       8       -       -       - rw---    [ anon ]
b7d48000      20       -       -       - r-x--  libcrypt-2.3.4.so
b7d4d000       4       -       -       - r----  libcrypt-2.3.4.so
b7d4e000       4       -       -       - rw---  libcrypt-2.3.4.so
b7d4f000     156       -       -       - rw---    [ anon ]
b7d76000      32       -       -       - r-x--  librt-2.3.4.so
b7d7e000       4       -       -       - r----  librt-2.3.4.so
b7d7f000       4       -       -       - rw---  librt-2.3.4.so
b7d80000      44       -       -       - rw---    [ anon ]
b7d8b000       8       -       -       - r-x--  libuuid.so.1.2
b7d8d000       4       -       -       - rw---  libuuid.so.1.2
b7d8e000     112       -       -       - r-x--  libapr-1.so.0.2.11
b7daa000       4       -       -       - rw---  libapr-1.so.0.2.11
b7dab000     112       -       -       - r-x--  libexpat.so.0.5.0
b7dc7000       8       -       -       - rw---  libexpat.so.0.5.0
b7dc9000      68       -       -       - r-x--  libaprutil-1.so.0.2.11
b7dda000       4       -       -       - rw---  libaprutil-1.so.0.2.11
b7ddb000     132       -       -       - r-x--  libm-2.3.4.so
b7dfc000       4       -       -       - r----  libm-2.3.4.so
b7dfd000       4       -       -       - rw---  libm-2.3.4.so
b7dfe000      60       -       -       - r-x--  libz.so.1.2.1.2
b7e0d000       4       -       -       - rw---  libz.so.1.2.1.2
b7e0e000       4       -       -       - rw---    [ anon ]
b7e0f000      60       -       -       - r-x--  libresolv-2.3.4.so
b7e1e000       4       -       -       - r----  libresolv-2.3.4.so
b7e1f000       4       -       -       - rw---  libresolv-2.3.4.so
b7e20000       8       -       -       - rw---    [ anon ]
b7e22000     128       -       -       - r-x--  libk5crypto.so.3.0
b7e42000       4       -       -       - rw---  libk5crypto.so.3.0
b7e43000       8       -       -       - r-x--  libcom_err.so.2.1
b7e45000       4       -       -       - rw---  libcom_err.so.2.1
b7e46000     396       -       -       - r-x--  libkrb5.so.3.2
b7ea9000       8       -       -       - rw---  libkrb5.so.3.2
b7eab000      76       -       -       - r-x--  libgssapi_krb5.so.2.2
b7ebe000       4       -       -       - rw---  libgssapi_krb5.so.2.2
b7ebf000     848       -       -       - r-x--  libcrypto.so.0.9.7a
b7f93000      72       -       -       - rw---  libcrypto.so.0.9.7a
b7fa5000      16       -       -       - rw---    [ anon ]
b7fa9000     196       -       -       - r-x--  libssl.so.0.9.7a
b7fda000      12       -       -       - rw---  libssl.so.0.9.7a
b7fe4000       4       -       -       - r-x--  mod_bwlimited.so
b7fe5000       4       -       -       - rw---  mod_bwlimited.so
b7fe6000       4       -       -       - r-x--  mod_auth_passthrough.so
b7fe7000       4       -       -       - rw---  mod_auth_passthrough.so
b7fe8000      88       -       -       - r-x--  ld-2.3.4.so
b7ffe000       4       -       -       - r----  ld-2.3.4.so
b7fff000       4       -       -       - rw---  ld-2.3.4.so
bfff9000      20       -       -       - rw---    [ stack ]
ffffe000       4       -       -       - -----    [ anon ]
-------- ------- ------- ------- -------
total kB  282792       -       -       -


# 2MB stack size
root@vps [/usr/local/apache/conf/extra]# pmap -x 23783
23783:   /usr/local/apache/bin/httpd -k start -DSSL
Address   Kbytes     RSS    Anon  Locked Mode   Mapping
08048000     544       -       -       - r-x--  httpd
080d0000      16       -       -       - rw---  httpd
080d4000     964       -       -       - rw---    [ anon ]
b4585000      36       -       -       - r-x--  libgcc_s-3.4.6-20060404.so.1
b458e000       4       -       -       - rw---  libgcc_s-3.4.6-20060404.so.1
b459a000       4       -       -       - -----    [ anon ]
b459b000    2048       -       -       - rw---    [ anon ]
b479b000       4       -       -       - -----    [ anon ]
b479c000    2048       -       -       - rw---    [ anon ]
b499c000       4       -       -       - -----    [ anon ]
b499d000    2048       -       -       - rw---    [ anon ]
b4b9d000       4       -       -       - -----    [ anon ]
b4b9e000    2048       -       -       - rw---    [ anon ]
b4d9e000       4       -       -       - -----    [ anon ]
b4d9f000    2048       -       -       - rw---    [ anon ]
b4f9f000       4       -       -       - -----    [ anon ]
b4fa0000    2048       -       -       - rw---    [ anon ]
b51a0000       4       -       -       - -----    [ anon ]
b51a1000    2048       -       -       - rw---    [ anon ]
b53a1000       4       -       -       - -----    [ anon ]
b53a2000    2048       -       -       - rw---    [ anon ]
b55a2000       4       -       -       - -----    [ anon ]
b55a3000    2048       -       -       - rw---    [ anon ]
b57a3000       4       -       -       - -----    [ anon ]
b57a4000    2048       -       -       - rw---    [ anon ]
b59a4000       4       -       -       - -----    [ anon ]
b59a5000    2048       -       -       - rw---    [ anon ]
b5ba5000       4       -       -       - -----    [ anon ]
b5ba6000    2048       -       -       - rw---    [ anon ]
b5da6000       4       -       -       - -----    [ anon ]
b5da7000    2048       -       -       - rw---    [ anon ]
b5fa7000       4       -       -       - -----    [ anon ]
b5fa8000    2048       -       -       - rw---    [ anon ]
b61a8000       4       -       -       - -----    [ anon ]
b61a9000    2048       -       -       - rw---    [ anon ]
b63a9000       4       -       -       - -----    [ anon ]
b63aa000    2048       -       -       - rw---    [ anon ]
b65aa000       4       -       -       - -----    [ anon ]
b65ab000    2048       -       -       - rw---    [ anon ]
b67ab000       4       -       -       - -----    [ anon ]
b67ac000    2048       -       -       - rw---    [ anon ]
b69ac000       4       -       -       - -----    [ anon ]
b69ad000    2048       -       -       - rw---    [ anon ]
b6bad000       4       -       -       - -----    [ anon ]
b6bae000    2048       -       -       - rw---    [ anon ]
b6dae000       4       -       -       - -----    [ anon ]
b6daf000    2048       -       -       - rw---    [ anon ]
b6faf000       4       -       -       - -----    [ anon ]
b6fb0000    2048       -       -       - rw---    [ anon ]
b71b0000       4       -       -       - -----    [ anon ]
b71b1000    2048       -       -       - rw---    [ anon ]
b73b1000       4       -       -       - -----    [ anon ]
b73b2000    2048       -       -       - rw---    [ anon ]
b75b2000       4       -       -       - -----    [ anon ]
b75b3000    2048       -       -       - rw---    [ anon ]
b77b3000       4       -       -       - -----    [ anon ]
b77b4000    2048       -       -       - rw---    [ anon ]
b79b4000       4       -       -       - -----    [ anon ]
b79b5000    2048       -       -       - rw---    [ anon ]
b7bb5000     228       -       -       - rw-s-    [ anon ]
b7bee000      36       -       -       - r-x--  libnss_files-2.3.4.so
b7bf7000       4       -       -       - r----  libnss_files-2.3.4.so
b7bf8000       4       -       -       - rw---  libnss_files-2.3.4.so
b7c04000       8       -       -       - rw---    [ anon ]
b7c06000    1176       -       -       - r-x--  libc-2.3.4.so
b7d2c000       8       -       -       - r----  libc-2.3.4.so
b7d2e000       8       -       -       - rw---  libc-2.3.4.so
b7d30000       8       -       -       - rw---    [ anon ]
b7d32000       8       -       -       - r-x--  libdl-2.3.4.so
b7d34000       4       -       -       - r----  libdl-2.3.4.so
b7d35000       4       -       -       - rw---  libdl-2.3.4.so
b7d36000      56       -       -       - r-x--  libpthread-2.3.4.so
b7d44000       4       -       -       - r----  libpthread-2.3.4.so
b7d45000       4       -       -       - rw---  libpthread-2.3.4.so
b7d46000       8       -       -       - rw---    [ anon ]
b7d48000      20       -       -       - r-x--  libcrypt-2.3.4.so
b7d4d000       4       -       -       - r----  libcrypt-2.3.4.so
b7d4e000       4       -       -       - rw---  libcrypt-2.3.4.so
b7d4f000     156       -       -       - rw---    [ anon ]
b7d76000      32       -       -       - r-x--  librt-2.3.4.so
b7d7e000       4       -       -       - r----  librt-2.3.4.so
b7d7f000       4       -       -       - rw---  librt-2.3.4.so
b7d80000      44       -       -       - rw---    [ anon ]
b7d8b000       8       -       -       - r-x--  libuuid.so.1.2
b7d8d000       4       -       -       - rw---  libuuid.so.1.2
b7d8e000     112       -       -       - r-x--  libapr-1.so.0.2.11
b7daa000       4       -       -       - rw---  libapr-1.so.0.2.11
b7dab000     112       -       -       - r-x--  libexpat.so.0.5.0
b7dc7000       8       -       -       - rw---  libexpat.so.0.5.0
b7dc9000      68       -       -       - r-x--  libaprutil-1.so.0.2.11
b7dda000       4       -       -       - rw---  libaprutil-1.so.0.2.11
b7ddb000     132       -       -       - r-x--  libm-2.3.4.so
b7dfc000       4       -       -       - r----  libm-2.3.4.so
b7dfd000       4       -       -       - rw---  libm-2.3.4.so
b7dfe000      60       -       -       - r-x--  libz.so.1.2.1.2
b7e0d000       4       -       -       - rw---  libz.so.1.2.1.2
b7e0e000       4       -       -       - rw---    [ anon ]
b7e0f000      60       -       -       - r-x--  libresolv-2.3.4.so
b7e1e000       4       -       -       - r----  libresolv-2.3.4.so
b7e1f000       4       -       -       - rw---  libresolv-2.3.4.so
b7e20000       8       -       -       - rw---    [ anon ]
b7e22000     128       -       -       - r-x--  libk5crypto.so.3.0
b7e42000       4       -       -       - rw---  libk5crypto.so.3.0
b7e43000       8       -       -       - r-x--  libcom_err.so.2.1
b7e45000       4       -       -       - rw---  libcom_err.so.2.1
b7e46000     396       -       -       - r-x--  libkrb5.so.3.2
b7ea9000       8       -       -       - rw---  libkrb5.so.3.2
b7eab000      76       -       -       - r-x--  libgssapi_krb5.so.2.2
b7ebe000       4       -       -       - rw---  libgssapi_krb5.so.2.2
b7ebf000     848       -       -       - r-x--  libcrypto.so.0.9.7a
b7f93000      72       -       -       - rw---  libcrypto.so.0.9.7a
b7fa5000      16       -       -       - rw---    [ anon ]
b7fa9000     196       -       -       - r-x--  libssl.so.0.9.7a
b7fda000      12       -       -       - rw---  libssl.so.0.9.7a
b7fe4000       4       -       -       - r-x--  mod_bwlimited.so
b7fe5000       4       -       -       - rw---  mod_bwlimited.so
b7fe6000       4       -       -       - r-x--  mod_auth_passthrough.so
b7fe7000       4       -       -       - rw---  mod_auth_passthrough.so
b7fe8000      88       -       -       - r-x--  ld-2.3.4.so
b7ffe000       4       -       -       - r----  ld-2.3.4.so
b7fff000       4       -       -       - rw---  ld-2.3.4.so
bfff9000      20       -       -       - rw---    [ stack ]
ffffe000       4       -       -       - -----    [ anon ]
-------- ------- ------- ------- -------
total kB   61316       -       -       -



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.
> 
> 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...
>>


Mime
View raw message