Improve PHP performance..

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

Hi all,

Wondering if anyone has any suggestions for me to improve the PHP execution performance.. Essentially I am looking for any tweaks to make pages load faster..

The basics are that I have built an in house web based "application" using Drupal.. 99% of the traffic through the site is by authenticated users.. I have tuned up MySQL with enough cache/buffers etc.. I am using nginx for the webserver and php-fpm with APC..

I am using the rules link module to run rules on content from a view.. The main issue seems to be the amount of time it takes to process all the PHP and return the updated view.. I don't see any way caching can help because a) the view needs to be dynamic, b) content is being updated and c) users are authenticated..

This means the only real option is to work out how to get PHP/Drupal to do they need to do but faster.. So not scalability but raw speed.. The only way I can think to do this is a more powerful CPU in the server but looking for ideas other than upgrading the server..

I briefly experimented with memcache in a development VM of the live site but its didn't improve the speed at all..

So if we assume that the server spec is locked.. What can you suggest to get PHP/Drupal to execute more quickly or is it simply down to CPU cycles?

(NOTE: I am not really expecting miracles just interested to see if I may not have tried something. :) )

Comments

devel module

technicalknockout's picture

Have you looked at devel module? I wouldn't run on the live site, but on a development or staging environment. In the settings you can set it to display performance statistics. These should help you find what the most time-consuming function calls & db queries. This might be helpful if you're looking to optimize/rewrite some of the code. Sometimes even might help you see if configuration or site build setup is using excess resources. There's also the xhprof profiler - my experience has been that it's a bit tricky to setup, but can be very helpful also.

newrelic.com might be useful

gerold's picture

newrelic.com might be useful in this kind of situation. we've used it to identify performance problems/bottlenecks with our problematic client servers and sites. it can also provide details on your resource or cpu utilization.

Thanks for the ideas.. Have

wipeout_dude's picture

Thanks for the ideas.. Have been doing a little playing with XHProf this afternoon..

Just a thought, does moving more functionality into "features" have improved performance advantages for low volume but quite complex sites?

90% of what I have built has been through the use of contributed modules and standard drupal functionality.. So that's probably putting a little extra load on the database when it could be exported through features to run as raw code.. I am sure this has big performance implications on high traffic sites but not so convinced there will be a lot of benefit on a low volume site..

_

shamio's picture

I think when you are using nginx and php-fpm with APC currently, you don't need to improve php speed and the other thing you can do is using a caching module like Boost or Varnish to make a static (html) version of your nodes for anonymous users and it helps to increase the speed of your website and reduce CPU usage. If your content is being changes a lot, you can set the caching time to i.e 5 minutes. In this case for the first visitor, it uses MySQL and for the rest visitors between every 5 minutes, the HTML version loads without pressure on your CPU.

Doubt is the father of invention ... ZendegiyeSabz

Also consider to add microcaching to Nginx config

Peter Bowey's picture

See references below:

1) Micro-caching: Speed your app up 250x with no new code
http://fennb.com/microcaching-speed-your-app-up-250x-with-no-n

2) Add micro-caching to Nginx config by default
http://drupal.org/node/1408410

Micro-caching is now a standard part of Aegir (BOA) with Nginx, PHP 5.3.10, and APC. See: http://groups.drupal.org/boa

--
Linux: Web Developer
Peter Bowey Computer Solutions
Australia: GMT+9:30
(¯`·..·[ Peter ]·..·´¯)

Additionally make the plunge to use PHP 5.4.x

Peter Bowey's picture

In my live server benchmarks, I found the PHP 5.4.x was about 8% faster than the older 'stable' PHP 5.3.x.

The downside is that some Drupal code / modules will need patching for old 'bad' PHP code styles. Thankfully, with Drupal 7.x it is not so bad as with the legacy D6.

If you are using D6 it may be a fair amount of work to go to PHP 5.4.x.

I did this PHP 5.4.x migration for both for D6 and D7 and the result is rather nice [performance]!

--
Linux: Web Developer
Peter Bowey Computer Solutions
Australia: GMT+9:30
(¯`·..·[ Peter ]·..·´¯)

Just switched to PHP 5.4..

wipeout_dude's picture

Just switched to PHP 5.4.. Will see in the new year how it goes when everyone is back to work.. Thanks for the suggestion..

High performance

Group notifications

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