Drupal performance


Published on

Published in: Technology

Drupal performance

  1. 1. Drupal PerformanceTools & Measurement (Arradi Nur Rizal) Joe Chin SJ 19 February 2013, Singapore
  2. 2. Quick Overview● Drupal as CMS, CMF● What this meetup is about ○ Birds eye vs detailed? ○ Best practices ○ Measurement tools● Open discussion, share & interrupt anytime
  3. 3. http://drupalwatchdog.com/1/1/many-layers-caching-drupal
  4. 4. Before We Begin...● Apache bench / Siege / Jmeter● Yslow & Firebug (FF extension)● Developer Tools (Chrome extension)● Pingdom.com● XHProf / devel module● New Relic
  5. 5. IA / Site Building● might affect performance, but no studies● 3rd party webservices● taxonomy (indexed) vs list fields (text)?● contrib module selection ○ domain_taxonomy, term_reference_tree ○ how to choose?● coding best practices in custom modules (use hook instead of core/contrib hacks, making use of proper caching: drupal_static, ctools caching, proper theming)● target users: anon vs authenticated
  6. 6. Easy Peasy Lemon Squeezy!● optimize / compress files locally (images)● aggregate CSS & JS● enable page cache & block cache● disable unnecessary modules (unused or heavy UI: views_ui, ds_ui)● syslog—or no log—instead of dblog● boost (access to .htaccess, or vhosts file)● storage_api, CDN
  7. 7. Apache Configurations● Enable mod_expires, mod_deflate● Move directives from .htaccess to host configuration and set AllowOverride None● Set timeout from 300 to 30● Set StartServers, MinSpareServers, MaxSpareServers, MaxClients and MaxRequestsPerChild values● Disable unused modules ie. mod_cgi, mod_ldap
  8. 8. MySQL Configurations● Set in my.cnf ○ query_cache_type = 1 ○ query_cache_size = 128M ○ query_cache_limit = 2M● Review with: show status like Qcache_%; ○ Qcache_hits - bigger is better ○ Qcache_lowmem_prunes - smaller is better● Run mysqltuner.pl
  9. 9. Additional Services/Modules● Always use OpCode caching - APC● Reverse Proxy - Varnish, Squid, Nginx● Cache storage - Memcache, Redis, Filecache● NoSQL DB - MongoDB● Offload searching to Apache Solr● Substitute Apache for Nginx
  10. 10. Real Advance Stuff!● Separating services ○ web, database, file, search, reverse proxy● Load balancing ○ Web cluster ○ Database master/slave● Database sharding
  11. 11. Demo 1 - Benchmarking● Create a worksheet● Measure baseline● Single change, measure, repeat
  12. 12. Demo 2 - XHProf● Inclusive - include sub-functions● Exclusive - exclude sub-functions● Sort by Exclusive wall time first
  13. 13. Additional Resources● drupal.org● Drupal 7 books (dev) http://drupal.org/books?availability%5B% 5D=38414&version%5B%5D=120&version% 5B%5D=20236&audience%5B%5D=1756● Lullabot / drupalize.me http://drupalize.me/series/drupal- performance-scalability-series
  14. 14. Q&AThis presentation is collaborative work of:● Arradi Nur Rizal (arradi.nur.rizal@wunderkraut.com)● Joe Chin (joe@techknowjoe.com)● SJ (sj@pixelonion.com)