Drupal Tuning

One of the reasons I opted for moving all my sites to a VPS was to be better able to control parts of the web server that hosted servers can't let you touch -- the Apache server, the MySQL server, things like that.

If I were just creating HTML pages, I wouldn't have make the change. But having a database-driven website, while opening up wide possibilities, also introduces performance issues. When I finally got Gallery2 running on my current setup, the whole thing slowly ground to a halt. But after tweaking the PHP, Apache and MySql config files, it hummed along better than before.

And I can't emphasize enough that you can gain wonderful quickness just by using Drupal's performance settings (admin/settings/performance). Especially with D6, it can be quick as a bunny.

One of the most useful sessions at the Do It With Drupal conference in Dec 08 was Matt Westgate & John VanDyk session on Performance and Scalability. In brief, here's an outline of what they discussed:

  • APACHE
    • enable mod_expires (allows for browser caching)
    • set [MaxClients] = RAM / Average Apache process memory size
    • set [KeepAliveTimeout] to 2 (or maybe 5)
  • PHP
    • OpCode CacheAPC or E-accelerator (caches compiled PHP)
    • set php.ini memory limit to 75M (?!)
    • install memcache module
    • benchmark "ab -n 1000 -c 10 http://[website]/"
  • MYSQL
    • set query_cache_size 32M
    • enable slow queries (log_slow-queries = /var/log/slow_log, log_query_time = 5)
    • log_queries_not_using_indexes
  • CRON
    • use it
  • DRUPAL
    • cacheing
    • CSS aggregation

This is covered in their book Pro Drupal Development, if you'd like more detail.

And here's some sources I've found on the Internets that deal with Drupal performance:

Tags: Drupal Performance | Web Server