Apache woes and Drupal

 

   

Our server recently died a few times (swap exploded and didn't serve any requests), but since then we've changed a few figures in the configuration files and everything seems fine (for now).

But the apache2 processes seem to be extremely big, each process takes about 200-300MB, and we don't know how to reduce this or even if it is possible (or necessary) to reduce this figure?

So, there are currently 3 sites on this server having 3 separate drupal 6 installations:

  • the public site (using memcache 6.x-1.8)
  • the development site (only known to a hand full of people)
  • and another site (only known to a hand full of people)

And because only a few people know the other two sites I don't think it is a problem having these extra code bases on the same server. But, perhaps we're wrong about this? We have checked the enabled modules and couldn't find any to disable. We also disabled the UIs for some modules (e.g. views). What else can we do?

Some data:

top

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
21593 www-data  20   0  548m 316m 228m S    0  7.6  28:43.80 apache2
15040 www-data  20   0  505m 307m 262m S    0  7.4   7:29.57 apache2
20553 www-data  20   0  538m 295m 217m S    0  7.1  28:24.97 apache2
31777 www-data  20   0  491m 292m 261m S    0  7.0  11:52.78 apache2
20483 www-data  20   0  521m 290m 229m S    0  7.0   9:46.53 apache2
21598 www-data  20   0  515m 290m 234m S    0  7.0   9:52.10 apache2
20475 www-data  20   0  486m 287m 261m S    0  6.9  11:03.25 apache2
25861 www-data  20   0  486m 287m 261m S    0  6.9  10:10.30 apache2
20809 www-data  20   0  483m 285m 261m S    0  6.9  10:28.34 apache2
15593 www-data  20   0  484m 284m 258m S    0  6.8   3:56.59 apache2
...

apache mods enabled

alias
auth_basic
authn_file
authz_default
authz_groupfile
authz_host
authz_user
autoindex
cgi
deflate
dir
env
mime
negotiation
php5
rewrite
setenvif
status

php mods enabled

apc
curl
gd
mcrypt
memcache
mysql
mysqli
pdo
pdo_mysql
suhosin
xapian

APC

Uptime 3 days, 8 hours and 38 minutes
Free: 3.7 MBytes (1.4%)
Used: 252.3 MBytes (98.6%)
Fragmentation: 0%

Cached Files 2314 (220.8 MBytes)
Hits 64020298
Misses 16860
Request Rate (hits, misses) 220.59 cache requests/second
Hit Rate 220.53 cache requests/second
Miss Rate 0.06 cache requests/second
Insert Rate 0.06 cache requests/second
Cache full count 6

memcached

Uptime 5 days, 18 hours and 5 minutes
Free: 25.4 MBytes (19.9%)
Used: 102.6 MBytes (80.1%)
Hits: 7828688 (36.7%)
Misses: 13507506 (63.3%)

memory at devel_shutdown

30 - 40 MB

This post based on drupal.org post here by our programmer.

Share this
Posted on: 8 June 2011
 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
01 Mar10:34

Thanks all for the suggestions!

By mavergames

We're taking a look at options and I will post what we ended up trying here later...

Chris

01 Mar10:56

Apache monitoring

By Nicholas Thompson (not verified)

dalin is correct - top isn't a "great" way to get the memory usage.

I had a similar issue with a server I managed at a previos job. The Rackspace Support guys were a great help and we ended up with a script which monitored the number of apache threads and email-noitified as soon as a threshold was broken (this helped us know when we needed to monitor the server...

In particular, this bash "macro" was very useful in quickly monitoring the ACTUAL size of apache threads:

ps axo 'pid user size cmd' | grep http | grep -v "\(root\|grep\)"
01 Mar12:59

@Nicholas Thompson

By sb (not verified)

@Nicholas Thompson

Thanks a lot, this is quite helpful!
Using your command I get 56 apache processes with an average size of 29m. This is a total of ~1630m. Adding up all other processes using
ps axo 'pid user size cmd' | grep -v "\(grep\|apache2\)"
I get ~215m (memcached and rsyslogd) but free -m is showing me that 3426m are used so I guess the rest is shared memory of apache?

So I'm still confused on how to get good numbers for MaxClients, MinSpareServers and MaxSpareServers.
Do I simply use 4g minus non-apache-processes, apc and some extra space so lets say 3200m and divide it by 29m (~110)?

Seems a bit odd to me as currently there are 56 apache processes and mem is already at 3.4g of 4g or can I just ignore what free -m is telling me as long as there is free space?

04 Mar12:07

A good tool to check memory

By Frederik (not verified)

A good tool to check memory usage by processes is smem: http://www.selenic.com/smem/

28 Mar22:08

host?

By Gyuri (not verified)

I was under the impression as per your earlier post that you have moved to Rackspace cloud sites? http://mavergames.org/content/drupal-rackspace-clouds-cloud-sites-platform-some-tips-our-experiences What happened? You have not moved all sites?

29 Mar09:29

Yes, we moved all sites

By mavergames
... to Rackspace. Chris

Post new comment

The content of this field is kept private and will not be shown publicly.

More information about formatting options