Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've been working on on getting my webserver in check and I'm running into some issues. First of all, using top I've noticed that Apache is using a lot of memory, no surprise really, but 130-150M per process seems high even for apache. I'm running 2.2 worker MPM using mod_fcgid for php. I was under the impression that going this route would bring my memory consumption down but it didn't seem to change much when I switched from Prefork and mod_php. What am I missing here? I've read that well tuned apache should be using closer to 15-25MB per process. Am I way off?

Here's a list of the modules compiled with my ver of apache:

Compiled in modules:

  core.c
  mod_authn_file.c
  mod_authn_default.c
  mod_authz_host.c
  mod_authz_groupfile.c
  mod_authz_user.c
  mod_authz_default.c
  mod_auth_basic.c
  mod_cache.c
  mod_mem_cache.c
  mod_include.c
  mod_filter.c
  mod_deflate.c
  mod_log_config.c
  mod_logio.c
  mod_env.c
  mod_expires.c
  mod_headers.c
  mod_unique_id.c
  mod_setenvif.c
  mod_version.c
  mod_proxy.c
  mod_proxy_connect.c
  mod_proxy_ftp.c
  mod_proxy_http.c
  mod_proxy_scgi.c
  mod_proxy_ajp.c
  mod_proxy_balancer.c
  mod_ssl.c
  worker.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_asis.c
  mod_info.c
  mod_suexec.c
  mod_cgid.c
  mod_negotiation.c
  mod_dir.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_rewrite.c
  mod_so.c

Are any of those particularly large and omittable. I built off of a generic version using the easy apache setup on the server. My guess is there's fat to trim there.

The other question I have: Is there shared memory between processes? For each process to use over 130MB seems fishy. Is there a way to limit the amount of memory used? Cache settings?

share|improve this question
1  
Pooch, welcome to Server Fault. This question is quite subjective and open to a variety of interpretation which makes it a "less-than-ideal" question for SF. With a bit of googling, you'll find that there are quite a few documents on tuning Apache (most notably on the Apache website) –  DKNUCKLES Nov 4 '11 at 21:05
    
See: serverfault.com/questions/325781/…. –  Zoredache Nov 4 '11 at 21:17

2 Answers 2

This is virtual memory, not physical memory. Virtual memory is not normally considered a scarce resource. Trying to reduce Apache's consumption of virtual memory will be a waste of time. If you don't have an actual problem with actual symptoms, there's nothing to solve.

share|improve this answer

Apache has some documentation on this, but it's in a weird place.

See http://wiki.apache.org/httpd/DoS , which explains some of what you are seeing:

Note that the memory usage reported by tools like ps(1) and top(1) include shared memory, so they report apparent figures that are far higher than apache's actual per-process usage.

So, your "high memory" problem is a bit of an illusion.

share|improve this answer
    
The note is a bit misleading. The figures are precisely Apache's actual per-process usage. Shared memory consumes virtual memory for each process it is shared by. If 10 processes are sharing 128MB, 1280MB of virtual memory are consumed. (The physical memory consumed can be anywhere from 0 to 1280MB. You can't tell directly.) –  David Schwartz Nov 4 '11 at 22:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.