Optimize DrupalMake your Drupal site faster
Sunday, May 12, 13
Lê Thanh Sang
• http://drupal.org/user/204321
• Skype: mr.lamphong
• Module Development
• 5 years with Drupal
Sunday, May 12, 13
Agenda
• Hardware
• WebServer
• Drupal
• FrontEnd
• Monitor
Sunday, May 12, 13
Hardware
• Many CPU as possible
• Faster disk IO as possible (Sata < SAS < SSD < PCI Flash)
Sunday, May 12, 13
Web Server
• Reverse Proxy
• Nginx for static file
• Percona Database server
• PHP-FPM + Opcode (APC, Xcache, eAccelerator)
• Redis or Memcache
Sunday, May 12, 13
Web Server - Reverse Proxy
• Use nginx or varnish
• Cache content on RAM (Create a mount point using tmpfs)
• Allow flush cache on Internal IP. Use purge module on Drupal.
Sunday, May 12, 13
Web Server
• Using nginx if you can. Apache is fine, use Reverse Proxy for faster.
• Using mod_pagespeed (http://code.google.com/p/modpagespeed/)
• For nginx: https://github.com/pagespeed/ngx_pagespeed
Sunday, May 12, 13
Database Server
• PerconaDB or MariaDB
• Don’t use same server with Drupal if you can.
• Use master for write
• Slave replication for read
Sunday, May 12, 13
PHP-FPM
• Running via socket (faster than TCP/IP)
• Only install extension we need
• Set max_request
• Turn off log for production
Sunday, May 12, 13
Drupal
• Use Pressflow (Require PHP 5)
• Block cache
• Redis cache
• Authenticated cache
• Remove slow module (Statistics, admin_menu, tagadelic, nice menus)
• Using xdebug or xhprof for profiling
Sunday, May 12, 13
Drupal theme
• Never use a function in the tpl file, always on the preprocess function
• In tpl only print variables
• Only use hook_theme (theme, process, preprocess)
Sunday, May 12, 13
Drupal search
• Don’t use default DB search
• Solr or Elastic Search
Sunday, May 12, 13
FrontEnd
• Browser can send 4~6 request per domain (2 for IE).
• CSS/JS aggregation
• CDN, Gzip compression, sprites, image optimization (Done if using mog_pagespeed)
Sunday, May 12, 13
SummaryUpgrade your hardware is alway a best solution
Sunday, May 12, 13
Question?Lê Thanh Sang
Sunday, May 12, 13