I am having a huge difference in performance in a page refresh from a single client for the same version of Drupal (6.20) between a fresh install of Drupal and the same version but with a lot of extra modules downloaded and enabled.

Events happening in the community are now at Drupal community events on www.drupal.org.
mitchelljj's picture

I am having a huge difference in performance in a page refresh from a single client for the same version of Drupal (6.20) between a fresh install of Drupal and the same version but with a lot of extra modules downloaded and enabled.

The cpu we are using is an intel Xeon quad core (though we are only using 2 cores in our VM). It is an E5345 processor with 8MB of L2 cache, a clock speed of 2.33GHz and FSB speed of 1333MHz.

For a fresh install of Drupal: we see a load on a single core of about 9-10% for about 1 – 1.5 seconds from both IE and Firefox clients

Drupal with a lot of extra modules downloaded and enabled:
a.) Firefox client: 70-80% usage on a single core for about 2-3 seconds
b.) Internet Explorer client: both cores hit the 70-80% usage for about 4-5 seconds

If the client is from Firefox then the CPU usage is around 8 times higher for a SINGLE core for Drupal and takes double the time to complete with a lot of extra modules installed.
If the client is from Internet Explorer then the CPU usage is around 8 times higher for BOTH cores for Drupal and takes three times to complete with a lot of extra modules installed.

Is this normal for Drupal with a lot of extra modules installed to use 8 times more CPU?

Is this normal for Drupal with a lot of extra modules installed and Internet Explorer is the client to use double the cores compared to if Firefox is the client?

Besides the obvious solution of eliminating some of these extra modules which are needed for the extra functionality they provide how can I get Drupal to use less of the CPU when extra modules are installed?

Thanks,

John

Comments

I think the best advice we

attheshow's picture

I think the best advice we can probably give on this topic is to use only the modules that you can't live without and also make sure that you try to use what the rest of the Drupal community uses when possible. If you're using a more obscure module, the likelihood that the code would be written poorly and perform poorly increases. Check out the "usage statistics" link on the project page to find out how many other sites are using a module you're interested in. Also, you might try disabling modules one at a time to see if disabling a particular one causes a major memory improvement. That would give you a good place to start.

Mark W. Jarrell
Online Applications Developer
Richland Library
http://www.richlandlibrary.com
http://fleetthought.com
Twitter: attheshow

Umm ... yeah.

gchaix's picture

The more modules you have enabled, the more code needs to be executed on pageload. That's pretty much an inescapable fact. You can mitigate its effects with caching and the like, but you're likely never going to see a site with a bunch of modules enabled be faster than one with only the minimum installed.

Is this normal for Drupal with a lot of extra modules installed to use 8 times more CPU?

Depending on the modules and number of them, certainly. I wouldn't be surprised.

Some questions and suggestions:

Is your traffic mostly anonymous or authenticated users? If they're anonymous, and your system's well-tuned and you have it behind a reverse proxy like Varnish, much (if not all) of the content should be able to be served from cache and never even touch the backend Apache/PHP threads. If they're authenticated users, have you looked at using something like authcache?

Are you using an opcode cache like APC? APC can drastically reduce the amount of CPU required to deliver PHP-generated content by caching the compiled PHP code instead of making the server compile it every time it's executed.

Are you using memcache? And what are your Drupal caching settings?

You mentioned you're on 6.20. Have you tried the same tests on Pressflow? There are quite a few optimizations that Pressflow brings to sites that may reduce the resources needed to render a page.

mitchelljj's picture

You mentioned APC but I noticed that it only has a dev version for Drupal 6. Has anyone used the current APC dev version for Drupal 6? (http://drupal.org/node/137538/release?api_version[]=87)
You also mentioned Pressflow but since we are using Postgres that is not an option since Pressflow only works with MySQL.
Since most of our users are authenticated then using authcache seems to make sense along with a Contributed cache handler module like memcache.
If we also used the APC dev version for Drupal 6 would it still be beneficial to also use memcache?

APC is a php system

joshk's picture

http://php.net/apc

You 100% must have this if you want decent performance.

As a caching back-end, memcache is more widely used. However APC as a opcode cache is different, and should be considered required.

With APC you don't have to do

vegardx's picture

With APC you don't have to do anything with the webapps, the inner-logic of APC, with the some good defaults (like the one shipped with Debian), you don't need to do anything to see a gain from installing APC. You probably will end up using a little more memory, but that is negligible compared to other things, such as PHP it self.

--
Vegard

I would also make sure you're

thomas4019's picture

I would also make sure you're site with all the modules isn't producing any 404s. Just 1 404 on every page can double your load.

Thomas Hansen
www.ThomasHansen.me

mitchelljj's picture

How would we know if any of the modules are producing any 404s (Not Found error message) within a page other than having a "Not Found error message" displayed on the page.

The "net" tab in firebug will

thomas4019's picture

The "net" tab in firebug will show all requests for a page and 404s will show up in red.

Thomas Hansen
www.ThomasHansen.me

when a file not path is

ddorian's picture

when a file not path is missing(404) drupal bootstraps so it can generate imagecache files(that's how they are done) or log to watchdog

Please elaborate what you

vegardx's picture

Please elaborate what you mean with this, I cannot see how a single page going to 404 would increase load, at best, it would result in lowering the load. But there might be something that I'm missing?

--
Vegard

In particular

joshk's picture

If you have a site which has a theme that references non-existant assets (this is all too common), then each pageload is actually that many times more expensive. Since Drupal handles 404s, that means it's got to bootstrap to do so. This is orders of magnitude slower than delivering a static file asset. Check your logs for 404s that repeatably result from a page load (typically and image, js or css file) and solve any of those that you see ASAP.

As gchaix said, first of all

marios88's picture

As gchaix said, first of all install APC, (http://pecl.php.net/package/APC - http://drupal.org/project/cacherouter).

Make sure you have drupal's cache enabled under performance tab.

Enabling mysql's query cache can have a huge impact too as repeating queries will be loaded from memory.

From my experience 100+ modules will start to bloat. Disable any development modules (like devel) and make sure your apache configuration is correct.

In order to fix this you will have to find where the bottleneck(apache,hdd,database) occurs and fix it.

If nothing of this works try out static page caching (http://drupal.org/project/boost)

Marios
μεταχειρισμενα

mitchelljj's picture

After installing APC (Alternative PHP Cache) will it automatically cache and optimize the Drupal PHP intermediate code or do I have to install a Drupal module like cacherouter to take advantage of APC within Drupal?

mitchelljj's picture

After reading all of the recommendations above I am going to try the following architecture:
The Authcache module using the "Cache Router" contributed cache handler module which connects to APC.

mitchelljj's picture

I have going through all my enabled modules to see if I can disable some of them and I noticed the ImageCache module. Would it be of any benefit to keep the ImageCache module enabled if I add the following (listed below)?
Authcache module using the "Cache Router" contributed cache handler module which connects to APC.

If APC is installed and I

mitchelljj's picture

If APC is installed and I then change the PHP within one of my custom modules will it automatically recompile or will I have click the "clear cache data" button within the admin/settings/performance page?

By default it automatically

brianmercer's picture

By default it automatically checks for file changes. That behavior can be changed to increase performance but then you have to be fastidious about clearing the cache when you update modules and such.

http://www.php.net/manual/en/apc.configuration.php#ini.apc.stat

Oh and that drupal admin

brianmercer's picture

Oh and that drupal admin clear cache will not clear the apc opcode cache. You need to restart the server or use a line of php code to clear the opcode cache.

The drupal admin clear cache will clear the data/user apc cache if you're using cacherouter with apc for data caching.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: