Like all frameworks, Drupal comes with a performance cost, but there are many ways to minimise that cost.
This session explores different and complementary ways to improve performance, covering topics such as caching techniques, performance tuning, and Drupal configuration.
We'll touch on benchmarking before presenting the results from applying each of the performance techniques against copies of a number of real-world Drupal sites.
7. Apache
• Pre-fork vs Worker
mode
• Number of servers /
clients
• Impact of .htaccess
/ AllowOverride
• Impact of SuExec
Optimising the stack
8. PHP
• CGI vs Apache
Module vc FastCGI
• php.ini:
– Memory limit -
choose for stability
– register_long_
arrays
Optimising the stack
9. Database
• Optimising the database
– Monitoring with the slow query log
– Add (and remove) indices based on usage
– Consider table types: MYISAM vs INNODB
• Optimising the service
– Custom compilation
– Configuring my.cnf
• Consider your hardware
Optimising the stack
10. APC
• APC is an op-code
cache
• Install and forget?
• Monitor APC use
• APC tuning
– APC memory usage
– APC stat: checks if
files are modified
– APC filters
Optimising the stack
11. Varnish
• Varnish is an HTTP
accelerator
• Requires D7,
Pressflow, or a
patch to Drupal
core
• New mindset for
personalising
content - think ESI
Optimising the stack
12. Tuning Drupal
• Drupal page
cache
• Optimise JS /
CSS
• Memcached
• Using the Drupal
cache
14. Tuning Drupal
Memcached
• Direct replacement for Drupal’s DB cache
• To setup:
– Install the Drupal module
– Configure settings.php
– Install the memcached daemon
– Install the PECL extension
• Minimal tuning (multiple cache ‘bins’)
15. Tuning Drupal
Using cache_get and cache_set
• Use a static cache for simple queries
static $foo = null;
• Use cache_get and cache_set for
complex objects:
– Multiple DB queries
– Slow remote resources (e.g. SOAP)
16. Adding hardware
• Separate the web server, database
server and HTTP accelerator onto their
own dedicated hardware
• Horizontal scaling: double the hardware
= double the performance?
• Hunt the bottleneck
• Scale with the cloud - Project Mercury