views:

829

answers:

8

We just implemented a drupal site. Performance of the site seems to be an issue. We enabled drupal caching, set up apache caching derivates. Repeated page visits are fast enough (coz CSS and JS are cached), but initial page visits are still a problem.

Drupal experts, could you offer us some pointers, on different techniques used to speed up drupal sites. (like DOs and DONOTs). Are there any other low hanging fruits?

(BTW, DB is not a problem here. That layer is fast enough. Problem seems to be in PHP/Drupal layer)

A: 

If you're certain the DB is not a bottleneck, then it points to either execution time or server response.

Are you doing any sort of PHP opcode caching?

Also check your Apache config. Does it perform slowly only under concurrent usage or is it slow off the bat with only a single visitor?

There's also a page on Drupal that goes over some common steps: Server tuning considerations

You can ignore the ones related to the database, of course.

thedz
+4  A: 

You mention CSS/JS being slow - have you turned on the 'bandwidth optimizations' for CSS and JS in /admin/settings/performance? It bundles all the CSS (or JS) into a single file - which can make a sizable difference if you have a large number of separate files (latency is a killer).

Using an opcode cache, like APC, can make a big difference in page performance as well, especially once you start piling on the modules. I can't imagine going back to developing PHP without using it.

Sean McSomething
Thanks for the tips, Sean
Think Floyd
+4  A: 

Have you used any tools like YSlow or Firebug to determine what portions of the page load are actually taking up the most time? Also, consider using the Devel module's query monitoring to determine how much time is being taken running queries versus executing PHP code.

As others have noted, an opcode cache like APC can have a dramatic impact. The fact that second visits to the site are faster, though, hints at an issue with secondary files (images, JS, external JS that calls remote sites, etc).

Eaton
I second this piece of advice. Y!Slow will point out a number of things.
wrburgess
@wrburgess but you have to take YSlow's opinion with a grain of salt - it's written to evaluate a page that handles brazillions of requests a second.
Sean McSomething
Indeed. The best hints on the YSlow evaluation involve the number of images/css/js files; Firebug's breakdown of how long each file (local and remote) takes to load is extremely helpful, almost more helpful in most cases.
Eaton
Thanks for the tips, Eaton!
Think Floyd
A: 

I recently launched a Drupal site and it runs quite fast. The biggest bottleneck (according to Y!Slow), is a ShareThis app that we added. Also, the external download of Google Analytics adds a little bit of time.

Also, make sure you have all developer modules turned off (they can add jscript and styling overhead), that you are NOT signed in as the administrator when testing, and use a browser that had minimal add-ons (such as Chrome) that might be doing processing on the side.

wrburgess
A: 

Try installing apc - http://il.php.net/apc or eccelerator - http://eaccelerator.net/

Both improve the run PHP performance. On some sites I tested, the time it takes to load the front page went from from ~750msec to ~300msec.

I have bad experience with PHP/MySQL/Drupal on Windows, finding LAMP duds is sometimes easier. So I would recommend - run away from Windows based setups.

Not really a stackoverflow.com answer... but the syster site is not available yet :)

elcuco
+2  A: 

I wrote an article about page loading performance in Drupal. You'll find references to almost everything you need to know about that subject over there. And as others have noted already, you definitely should install an opcode cache such as eAccelerator or APC. They're easy to setup and give you a free performance boost!

Wim Leers
+2  A: 

Do you have a url to your site?

Couple of quick pointers:

  1. Use YSlow
  2. Use tools.pingdom.com to see if there is anything obviously slow
  3. Compress js and css using YUI compressor
  4. Only use cookies where necessary
  5. Use APC/Xcache
  6. Tune PHP params
  7. Use separate server for static. Use nginx
  8. Use varnish to cache

HTH.

Jauder Ho
A: 

what is the url?