You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Apache Dev <ap...@mcarlson.com> on 2007/10/21 12:29:25 UTC

Apache 2.2 MPM Worker Virtual Memory Usage

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


#
# Apache 2.2 Worker Thread Memory Usage
#

# Process data.
5    99 28344 28338  20   0  5772 1772 -      S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99 28347 28338  20   0 282496 2020 pipe_w Sl  ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99 28349 28338  22   0 282496 2020 pipe_w Sl  ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99 28351 28338  22   0 282496 2020 pipe_w Sl  ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99 28352 28338  22   0 282496 2020 pipe_w Sl  ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99 28360 28338  20   0 282496 2020 pipe_w Sl  ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99 30684 28338  15   0 282496 2020 pipe_w Sl  ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5     0 28338     1  16   0  5868 2468 -      Ss   ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99 28345 28338  20   0 282632 2660 pipe_w Sl  ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL

# Vpsstat data.
+--------------+------------+------------+------------+------------+----------+
| Resource     |    Current | Recent Max |    Barrier |      Limit | 
Failures |
+--------------+------------+------------+------------+------------+----------+
Primary Parameters
+--------------+------------+------------+------------+------------+----------+
| all memory   |   157.0 MB |        n/a |  1024.0 MB |        n/a 
|      n/a |
| vmguarpages  |        n/a |        n/a |   256.0 MB |        n/a 
|        0 |
| oomguarpages |   146.4 MB |   146.5 MB |        n/a |        n/a 
|        0 |
| privvmpages  |     2.1 GB |     2.1 GB |        n/a |        n/a 
|        0 |
| physpages    |   146.4 MB |   146.5 MB |        n/a |        n/a 
|        0 |
+--------------+------------+------------+------------+------------+----------+
Secondary Parameters
+--------------+------------+------------+------------+------------+----------+
| kmemsize     |     9.8 MB |     9.9 MB |     2.0 GB |     2.0 GB 
|        0 |
| tcpsndbuf    |   423.6 kB |   423.6 kB |     2.0 GB |     2.0 GB 
|        0 |
| tcprcvbuf    |   562.2 kB |   562.2 kB |     2.0 GB |     2.0 GB 
|        0 |
| othersockbuf |    94.4 kB |    94.4 kB |     2.0 GB |     2.0 GB 
|        0 |
| dgramrcvbuf  |       0  B |       0  B |     2.0 GB |     2.0 GB 
|        0 |
| shmpages     |     5.2 MB |     5.2 MB |        n/a |        n/a 
|        0 |
| lockedpages  |       0  B |       0  B |        n/a |        n/a 
|        0 |
+--------------+------------+------------+------------+------------+----------+
Auxiliary Parameters
+--------------+------------+------------+------------+------------+----------+
| numproc      |        271 |        272 |        n/a |        400 
|        0 |
| numtcpsock   |         35 |         35 |        n/a |        500 
|        0 |
| numothersock |         70 |         70 |        n/a |        500 
|        0 |
| numfile      |       5663 |       5680 |        n/a |       8192 
|        0 |
| numflock     |          9 |          9 |        200 |        220 
|        0 |
| numpty       |          2 |          2 |        n/a |         64 
|        0 |
| numiptent    |         75 |         75 |        n/a |        500 
|        0 |
+--------------+------------+------------+------------+------------+----------+

# Configure options.
CFLAGS/CPPFLAGS = -pipe -Os -march=pentium4

               ./configure
                       --enable-deflate
                       --enable-expires
                       --enable-headers
                       --enable-imagemap
                       --enable-logio
                       --enable-nonportable-atomics=yes
                       --enable-rewrite
                       --enable-ssl
                       --enable-suexec
                       --prefix=/usr/local/apache
                       --with-included-apr
                       --with-mpm=worker
                       --with-ssl=/usr
                       --with-suexec-caller=nobody
                       --with-suexec-docroot=/
                       --with-suexec-gidmin=100
                       
--with-suexec-logfile=/usr/local/apache/logs/suexec_log
                       --with-suexec-uidmin=100
                       --with-suexec-userdir=public_html




#
# Apache 2.2 Prefork Memory Usage
#

# Process data.
5    99  9280  9275  19   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9281  9275  21   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9282  9275  20   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9283  9275  20   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9284  9275  20   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9285  9275  20   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9286  9275  20   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9287  9275  20   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9288  9275  20   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9289  9275  22   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9290  9275  21   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9291  9275  21   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9292  9275  21   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9293  9275  21   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9294  9275  21   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9295  9275  21   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9297  9275  24   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9298  9275  23   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9299  9275  23   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9300  9275  23   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9301  9275  23   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9302  9275  23   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9303  9275  23   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9304  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9305  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9306  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9307  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9308  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9309  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9311  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9312  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9313  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9314  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9315  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9316  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9317  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9318  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9319  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9320  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9321  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9322  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9323  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9324  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9325  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9326  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9327  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9328  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9329  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9330  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9331  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9332  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9333  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9334  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9335  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9336  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9337  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9338  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9339  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9340  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9341  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9342  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9343  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9344  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9345  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9346  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9348  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9349  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9350  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9351  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9352  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9354  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9355  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9356  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9357  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9358  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9359  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9360  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9361  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9362  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9363  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9364  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9365  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9366  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9368  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9369  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9370  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9371  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9372  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9373  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9374  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9375  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9376  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9378  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9379  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9380  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9381  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9382  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9384  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9385  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9386  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9390  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9391  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9392  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9393  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9394  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9395  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9396  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9397  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9398  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9399  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9400  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9401  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9402  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9403  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9404  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9410  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9411  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9412  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9413  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9414  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9415  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9416  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9417  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9418  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9419  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9420  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9421  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9422  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9423  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9424  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9427  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9429  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9430  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9431  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9432  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9433  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9435  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9437  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9438  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9439  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9441  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9442  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9443  9275  25   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99 11611  9275  15   0  5836 1792 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9279  9275  16   0  5836 1796 -      S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9310  9275  25   0  5836 1796 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9367  9275  25   0  5836 1796 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9388  9275  25   0  5836 1796 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9278  9275  17   0  5848 2188 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9276  9275  16   0  5836 2276 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5    99  9277  9275  16   0  5836 2276 semtim S    ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL
5     0  9275     1  16   0  5704 2304 -      Ss   ?          0:00 
/usr/local/apache/bin/httpd -k start -DSSL

# Vpsstat data.
+--------------+------------+------------+------------+------------+----------+
| Resource     |    Current | Recent Max |    Barrier |      Limit | 
Failures |
+--------------+------------+------------+------------+------------+----------+
Primary Parameters
+--------------+------------+------------+------------+------------+----------+
| all memory   |   175.8 MB |        n/a |  1024.0 MB |        n/a 
|      n/a |
| vmguarpages  |        n/a |        n/a |   256.0 MB |        n/a 
|        0 |
| oomguarpages |   158.7 MB |   158.9 MB |        n/a |        n/a 
|        0 |
| privvmpages  |   357.9 MB |   358.8 MB |        n/a |        n/a 
|        0 |
| physpages    |   158.7 MB |   158.9 MB |        n/a |        n/a 
|        0 |
+--------------+------------+------------+------------+------------+----------+
Secondary Parameters
+--------------+------------+------------+------------+------------+----------+
| kmemsize     |    16.3 MB |    16.4 MB |     2.0 GB |     2.0 GB 
|        0 |
| tcpsndbuf    |   329.7 kB |   329.7 kB |     2.0 GB |     2.0 GB 
|        0 |
| tcprcvbuf    |   480.0 kB |   480.0 kB |     2.0 GB |     2.0 GB 
|        0 |
| othersockbuf |    54.1 kB |    54.1 kB |     2.0 GB |     2.0 GB 
|        0 |
| dgramrcvbuf  |       0  B |       0  B |     2.0 GB |     2.0 GB 
|        0 |
| shmpages     |     5.1 MB |     5.1 MB |        n/a |        n/a 
|        0 |
| lockedpages  |       0  B |       0  B |        n/a |        n/a 
|        0 |
+--------------+------------+------------+------------+------------+----------+
Auxiliary Parameters
+--------------+------------+------------+------------+------------+----------+
| numproc      |        222 |        223 |        n/a |        400 
|        0 |
| numtcpsock   |         30 |         30 |        n/a |        500 
|        0 |
| numothersock |         51 |         51 |        n/a |        500 
|        0 |
| numfile      |       3665 |       3682 |        n/a |       8192 
|        0 |
| numflock     |          9 |          9 |        200 |        220 
|        0 |
| numpty       |          2 |          2 |        n/a |         64 
|        0 |
| numiptent    |         75 |         75 |        n/a |        500 
|        0 |
+--------------+------------+------------+------------+------------+----------+




Re: Apache 2.2 MPM Worker Virtual Memory Usage

Posted by Apache Dev <ap...@mcarlson.com>.
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...
>>


Re: Apache 2.2 MPM Worker Virtual Memory Usage

Posted by Niklas Edmundsson <ni...@acc.umu.se>.
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      |     nikke@acc.umu.se
---------------------------------------------------------------------------
  No boom now.  Boom tomorrow...there's ALWAYS a boom tomorrow...BOOM!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Re: Apache 2.2 MPM Worker Virtual Memory Usage

Posted by Ruediger Pluem <rp...@apache.org>.
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...
>