0

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?

aleroot
  • 3,160
  • 5
  • 28
  • 37
Pooch
  • 161
  • 2
  • 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 04 '11 at 21:05
  • See: http://serverfault.com/questions/325781/can-you-determine-which-apache-modules-have-been-used-and-can-be-removed. – Zoredache Nov 04 '11 at 21:17

2 Answers2

1

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.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
1

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.

Stefan Lasiewski
  • 22,949
  • 38
  • 129
  • 184
  • 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 04 '11 at 22:56