Help - Search - Members - Calendar
Full Version: Apache memory usage
The Planet Forums > Operating Systems > Red Hat Linux
DRYALLS
  1. When a user visits a server, does each visitor require a separate httpd process to be running?
  2. How long is that process running? HTTP is stateless protocol, is the process only running for as long as it takes to render the page?
  3. Typically (RHEL3) how much memoryy does each httpd process need?
  4. Is there a way to limit the memory that the process asks for?
I ask because I seem to have a lot of httpd processes running at any one time, and each is asking for 16M memory. Which seems excessive, particularly when each httpd process is also probably kicking of mysqld processes too.
EvolutionCrazy
enable server-status (extented) and take a look to the status page... it will explain a lot of things icon_wink.gif

1) a user can use more then one single process (like a html page with 50 images: the user (depends on it's browsers settings) can ask (for example) 10 files simultaneously... that mean 10httpd process servicing a single user icon_smile.gif )
or another example: ppl that uses download accelerators that simultaneously downloads 4 chunks of the same file from the same server icon_smile.gif

2) a process will still run till it will serve the number of requests specified in the httpd.conf (like: MaxRequestsPerChild 10000 <= it will regenerate after 10000 requestes)

3) that depends on what you do... in my case with php as module an httpd process that serve static (or nearly static...) content consume around 5~11mb of memory... but if you start using php functions like image manipulation (gd) etc... the memory usage can grow a lot icon_smile.gif
In my case sometime i see httpd process

4) reduce the number of modules loaded in your httpd.conf and tweak your php pages ?

CODE
[admin@titan admin]$ top | grep 'httpd'

29264 apache    16   0 11348  10M  6144 S     8.6  2.1   0:14   0 httpd

30824 apache    15   0 10484  10M  5908 S     2.8  2.0   0:00   0 httpd

30826 apache    15   0  6336 6188  3320 S     2.8  1.2   0:00   0 httpd

30825 apache    15   0 10660  10M  5876 S     1.9  2.0   0:00   0 httpd

30829 apache    15   0  6700 6544  3644 S     1.9  1.2   0:00   0 httpd

30830 apache    15   0  4840 4648  2192 S     0.9  0.9   0:00   0 httpd

29264 apache    16   0 11348  10M  6144 S    11.1  2.1   0:15   0 httpd

30826 apache    15   0  6324 6176  3308 S     2.3  1.2   0:00   0 httpd

30821 apache    15   0 11136  10M  6196 S     1.5  2.1   0:00   0 httpd

30823 apache    15   0  6660 6512  3628 S     1.1  1.2   0:00   0 httpd

30831 apache    15   0  4856 4672  2192 S     1.1  0.9   0:00   0 httpd

30824 apache    15   0 10512  10M  5932 S     0.9  2.0   0:00   0 httpd

30829 apache    15   0  6924 6776  3860 S     0.9  1.3   0:00   0 httpd

30825 apache    15   0 10648  10M  5864 S     0.5  2.0   0:00   0 httpd

30830 apache    15   0  4844 4656  2188 R     0.3  0.9   0:00   0 httpd

29264 apache    16   0 11348  10M  6144 S     9.1  2.1   0:15   0 httpd

30760 apache    15   0 10000 9832  5296 S     5.5  1.9   0:00   0 httpd

30827 apache    15   0  9984 9828  5472 S     4.5  1.9   0:00   0 httpd

30330 apache    16   0 10584  10M  5808 S     1.1  2.0   0:01   0 httpd

30823 apache    15   0  6644 6496  3612 S     0.9  1.2   0:00   0 httpd

30829 apache    15   0  7020 6872  3904 S     0.5  1.3   0:00   0 httpd

30825 apache    15   0 10628  10M  5844 S     0.3  2.0   0:00   0 httpd

30830 apache    15   0  4844 4656  2184 S     0.3  0.9   0:00   0 httpd

30824 apache    16   0 10632  10M  6048 S     0.1  2.0   0:00   0 httpd

29264 apache    15   0 11348  10M  6144 S     8.3  2.1   0:16   0 httpd

30760 apache    16   0 10176 9.8M  5476 S     1.9  1.9   0:00   0 httpd

30829 apache    15   0  7108 6960  3992 S     0.9  1.3   0:00   0 httpd

30825 apache    15   0 10672  10M  5884 R     0.5  2.0   0:00   0 httpd

30830 apache    15   0  6232 6084  3200 S     0.5  1.1   0:00   0 httpd

30771 apache    15   0 10508   9M  5520 S     0.3  2.0   0:00   0 httpd

30331 apache    15   0 11544  11M  6428 D     0.1  2.2   0:02   0 httpd

29264 apache    16   0 11348  10M  6144 S     8.1  2.1   0:16   0 httpd

30825 apache    15   0 10808  10M  6008 S     0.5  2.0   0:00   0 httpd

30829 apache    15   0  7108 6960  3992 S     0.3  1.3   0:00   0 httpd

30830 apache    15   0  6232 6084  3200 S     0.1  1.1   0:00   0 httpd

29264 apache    15   0 11348  10M  6144 R     9.9  2.1   0:17   0 httpd

30773 apache    16   0 10548  10M  5776 S     4.5  2.0   0:01   0 httpd

30820 apache    16   0 10440  10M  5804 S     3.9  2.0   0:00   0 httpd

29046 apache    16   0 11352  10M  6360 S     1.9  2.1   0:03   0 httpd

29264 apache    16   0 11380  10M  6144 R    12.1  2.1   0:17   0 httpd

30773 apache    15   0 10548  10M  5776 S     0.5  2.0   0:01   0 httpd

29912 apache    16   0 12160  11M  6220 R    13.7  2.3   0:03   0 httpd

29264 apache    16   0 11348  10M  6144 S    10.7  2.1   0:18   0 httpd

30766 apache    15   0  6044 5896  3128 S     1.7  1.1   0:00   0 httpd

30773 apache    15   0 10548  10M  5776 S     0.3  2.0   0:01   0 httpd

30820 apache    15   0 10476  10M  5840 S     0.1  2.0   0:00   0 httpd

30827 apache    15   0  9984 9836  5472 S     0.1  1.9   0:00   0 httpd

29264 apache    16   0 11348  10M  6144 S    10.5  2.1   0:18   0 httpd

29912 apache    15   0 11692  11M  6196 S     3.3  2.2   0:03   0 httpd

30773 apache    15   0 10496  10M  5724 S     0.7  2.0   0:01   0 httpd

30828 apache    15   0 10544  10M  5556 S     0.5  2.0   0:00   0 httpd

29978 apache    15   0 10252 9916  5352 S     0.3  1.9   0:02   0 httpd

30332 apache    16   0  9924 9780  4892 S     0.3  1.9   0:01   0 httpd

30403 apache    15   0 10140 9580  5172 S     0.3  1.8   0:01   0 httpd

30766 apache    15   0  6008 5860  3088 S     0.1  1.1   0:00   0 httpd

28970 apache    16   0 17456  16M  6764 S     6.3  3.3   1:05   0 httpd

30689 apache    16   0  8928 8752  5288 S     1.9  1.7   0:00   0 httpd

29264 apache    16   0 11364  10M  6160 S     1.3  2.1   0:18   0 httpd

29912 apache    15   0 11736  11M  6240 S     0.9  2.2   0:03   0 httpd

29978 apache    15   0 10252 9916  5352 S     0.5  1.9   0:02   0 httpd

28970 apache    16   0 17456  16M  6764 S     9.7  3.3   1:05   0 httpd

29912 apache    15   0 11736  11M  6240 S     0.5  2.2   0:03   0 httpd

29978 apache    15   0 10252 9916  5352 S     0.3  1.9   0:02   0 httpd

30768 apache    15   0     0    0     0 Z     0.1  0.0   0:00   0 httpd <defunct>

28970 apache    16   0 17484  16M  6792 S    11.0  3.3   1:06   0 httpd

29978 apache    16   0 10564   9M  5664 S     5.7  2.0   0:02   0 httpd

30764 apache    16   0 10584  10M  5740 S     5.3  2.0   0:00   0 httpd

30816 apache    15   0 10236 9.8M  5668 S     3.9  1.9   0:00   0 httpd

30769 apache    16   0  8692 8544  5140 R     1.7  1.6   0:00   0 httpd

29912 apache    15   0 11736  11M  6240 S     0.5  2.2   0:03   0 httpd

28970 apache    16   0 17484  16M  6792 S    12.5  3.3   1:06   0 httpd

29919 apache    15   0 16356  15M  6272 R     0.5  3.1   1:00   0 httpd

30769 apache    16   0  8888 8740  5208 S     0.5  1.7   0:00   0 httpd

30410 apache    15   0 10476  10M  5596 S     0.3  2.0   0:01   0 httpd

30820 apache    15   0 10448  10M  5812 S     0.3  2.0   0:00   0 httpd

28970 apache    16   0 17484  16M  6792 S    11.1  3.3   1:07   0 httpd

29919 apache    16   0 16608  15M  6396 S     8.3  3.1   1:01   0 httpd

28976 apache    16   0 11436  10M  6012 S     6.9  2.1   0:03   0 httpd

30820 apache    15   0 10448  10M  5812 S     0.5  2.0   0:00   0 httpd

30410 apache    15   0 10476  10M  5596 S     0.1  2.0   0:01   0 httpd


icon_biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.