UPDATE Aug'12: have a look at these first: http://munich2012.drupal.org/program/sessions/4x-high-performance-drupa… http://munich2012.drupal.org/program/sessions/high-performance-theming
A website was slowing down drastically and even freezing up. This post notes some measuring and measures taken as part of the analysis and clean-up.
- Watch Linux performance some of the usual tools, look at the Apache and Linux systems logs. Find the bottlenecks: Apache/mysql/drupal ... cpu/memory/disk or even the network.
- Enable the Apache server-status page: limit to specific addresses, enable enhanced status, and to make it visible. Edit .htaccess to convince Drupal to allow access to the server-status page (see http://drupal.org/node/52511).
Look for pages with high "Req" values (time to service a request).
- Install 'apachetop'
- Install webalizer or similar to analyse where most of the traffic is coming from, when.
- Tail -f /varLog/apache2/access_log
Now that we're measuring, we can start to see what kind of traffic is loading the system: crawlers, anonymous traffic, images, java script files, pretty theme scripts, authenticated users (reading or writing)..
The traffic type will help choose what kind of additional caching to build in. For example Boost might be useful on a site with many anonymous requests to pages that dont change much.
- Switch on the start Drupal performance enhancements.
- Disable devel and any unneeded modules.
- Enable APC
- Make sure the theme registry is not being constantly rebuilt (settings[zen_rebuild_registry] = 0).
- Tune robots.txt:
On one multilingual site, the usual urls that robots are told to ignore needed to be prefixed for each language.
- Tune Apache: start more processes, keep more spares.
- Add a second CPU and more memory (ease if running a Vm..)
- Move the DB to a separate server
Then, it gets in to the more invasive tactics suchas Speedy, Boost, Memcache & Varnish..... more to come ..