In the past, we were able to reduce the size of an Apache 2 process to 10-12M (resident set size), by using eAccelerator, and disabling all unnecessary modules.
Last week we ran a Drupal caching benchmark on Ubuntu Feisty (7.04) and noticed that we cannot run as many concurrent processes as we used to under Ubuntu Edgy (6.10). After running the following command against Drupal 5.1:
ab -c10 -n1000 http://example.com/
We noticed that each Apache 2 process was around 34MB in size:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27526 www-data 15 0 246m 43m 18m S 10.1 4.3 0:05.06 apache2
27524 www-data 15 0 242m 30m 10m S 9.7 3.1 0:03.65 apache2
28121 www-data 15 0 243m 31m 10m S 9.1 3.1 0:03.57 apache2
27523 www-data 16 0 246m 34m 10m R 8.1 3.5 0:04.55 apache2
28118 www-data 16 0 245m 34m 10m R 7.9 3.4 0:04.39 apache2
28115 www-data 15 0 246m 34m 10m S 7.6 3.5 0:04.33 apache2
27525 www-data 16 0 245m 34m 10m R 7.0 3.4 0:04.47 apache2
27527 www-data 15 0 246m 34m 10m S 6.8 3.5 0:04.53 apache2
28119 www-data 15 0 244m 33m 10m S 6.8 3.4 0:03.86 apache2
28117 www-data 16 0 245m 34m 10m S 5.8 3.4 0:04.15 apache2
27529 www-data 15 0 244m 33m 10m S 2.4 3.4 0:04.40 apache2
After disabling SSL, DAV and SVN, using the following command:
a2dismod ssl authz_default authz_groupfile authz_host authz_user dav_fs dav dav_sv
We got the following result:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29389 www-data 15 0 221m 20m 14m S 3.8 2.0 0:00.93 apache2
29386 www-data 15 0 221m 20m 13m S 4.1 2.0 0:01.05 apache2
29390 www-data 15 0 221m 19m 12m S 4.7 1.9 0:01.09 apache2
29387 www-data 15 0 221m 18m 12m S 4.3 1.9 0:00.87 apache2
29388 www-data 16 0 221m 18m 12m S 5.7 1.9 0:01.04 apache2
29397 www-data 15 0 221m 16m 10m S 4.4 1.6 0:00.89 apache2
29393 www-data 15 0 221m 16m 10m S 4.1 1.6 0:01.48 apache2
29396 www-data 15 0 221m 16m 10m S 3.7 1.6 0:12.06 apache2
29398 www-data 15 0 221m 16m 10m S 5.3 1.6 0:00.90 apache2
29400 www-data 15 0 221m 16m 10m S 3.4 1.6 0:00.84 apache2
There was improvement, but still, 16-18MB is higher than 10-12MB, and can add up.
We even noticed that on a live site that does not have SVN, the same can be observed:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4290 www-data 16 0 57808 17m 13m S 0 3.5 0:00.07 apache2
4284 www-data 16 0 58396 16m 10m S 0 3.1 0:00.19 apache2
4299 www-data 16 0 58184 14m 9648 S 0 2.8 0:00.09 apache2
4291 www-data 15 0 57560 14m 9.8m S 0 2.7 0:00.11 apache2
4293 www-data 15 0 58040 13m 9000 S 0 2.6 0:00.13 apache2
4289 www-data 15 0 58048 13m 8780 S 0 2.6 0:00.22 apache2
4297 www-data 15 0 58124 13m 8584 S 0 2.6 0:00.12 apache2
4294 www-data 16 0 57824 12m 8576 S 0 2.5 0:00.11 apache2
4296 www-data 16 0 57784 12m 8612 S 0 2.5 0:00.06 apache2
4292 www-data 16 0 57532 12m 8816 S 0 2.5 0:00.18 apache2
4302 www-data 16 0 57784 12m 8564 S 0 2.5 0:00.11 apache2
4279 www-data 16 0 57556 12m 8548 S 0 2.5 0:00.12 apache2
4295 www-data 15 0 57508 12m 8368 S 0 2.4 0:00.07 apache2
4298 www-data 16 0 57508 12m 8360 S 0 2.4 0:00.08 apache2
4300 www-data 15 0 57508 12m 8280 S 0 2.4 0:00.07 apache2
4277 root 16 0 56648 7132 3988 S 0 1.4 0:00.06 apache
That live site has Ubuntu Feisty, and the following modules:
alias auth_basic authn_file authz_default authz_groupfile authz_host
authz_user cgi deflate dir env mime php5 rewrite status
So, Apache 2 on Ubuntu Feisty, there is definitely bloat over Edgy. I can't say it is a memory leak, since after the initial "growth" of the process size, there is no more observed as more requests are processed. It may be that PHP 5.2.1 consumes more memory than PHP 5.1.6.
This is still an improvement over the case where you run PHP without eAccelerator, with process size being 28M to 45M. Not to mention the speed penalty. The following listing speaks for itself.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
32119 www-data 16 0 227m 45m 3680 S 0.0 4.5 0:21.46 apache2
32114 www-data 16 0 226m 45m 3680 S 0.0 4.5 0:21.23 apache2
32117 www-data 15 0 220m 38m 3760 S 0.0 3.9 0:13.24 apache2
32133 www-data 15 0 213m 32m 3760 S 0.0 3.2 0:06.75 apache2
32118 www-data 15 0 209m 28m 3760 S 0.0 2.8 0:02.35 apache2
32116 www-data 15 0 209m 28m 3680 S 0.0 2.8 0:02.51 apache2
32136 www-data 15 0 209m 28m 3680 S 0.0 2.8 0:02.07 apache2
32137 www-data 15 0 209m 28m 3680 S 0.0 2.8 0:01.75 apache2
Comments
Visitor (not verified)
20+ M process size - Holy Cow ...
Fri, 2007/10/19 - 08:39Thank you very much for your detailed articles and
benchmarks. Actually, they make me wet my pants -
we chose drupal based on the features, not because of
of its performance, which was reportedly questionable for
large sites. I can hardly imagine what performance
issues will arise, but your articles may help ...
We are about to migrate a hightraffic "homegrown CMS" site
to drupal. The old site has 16 M maximum process size with
Apache 1.3 + php 4.4.7 (having jumped from 10M after
introducing a couple of wordpress blogs ...)
Now there is this fine, new, pristine server
(Debian-Etch,Apache224,PHP524,APC3.1.15) where
each and every Apache and php module/extension is handpicked.
Nevertheless I already have a process
size of 20+M - with nothing else than drupal and only two persons
using it at all.
14694 wwwrun 15 0 186m 21m 17m S 0 0.3 0:00.46 httpd
14688 wwwrun 15 0 186m 20m 14m S 0 0.2 0:00.21 httpd
....
I wonder where this is going to end up and will certainly keep
an eye on your site. Thanks for sharing this helpful
information!
Regards,
Ulrich
Khalid
Drupal is scalable?
Fri, 2007/10/19 - 10:05Drupal is indeed scalable. I personally know of several sites who can handle a million page views a day on a single dedicated server with no sweat.
On one server, we get around 17M per Apache process, but it depends on what modules you have installed and other factors as well.
So, yes, Drupal is feature rich, but is also very scalable.
--
2bits -- Drupal and Backdrop CMS consulting