Drupal Performance

993 views

Published on

Drupal Performance Presentation by apanag from Eresus.gr Team.

Published in: Technology
  • Be the first to comment

Drupal Performance

  1. 1. Performance 12/12/2010
  2. 2. What is performance?
  3. 3. What is performance? <ul><li>How fast our pages load </li></ul>
  4. 4. Performance Facts <ul><ul><li>500ms slower = 20% drop in traffic (Google) </li></ul></ul><ul><ul><li>400ms slower = 5-9% drop in full-page traffic (Yahoo) </li></ul></ul><ul><ul><li>100ms slower = 1% drop in sales (Amazon) </li></ul></ul>
  5. 5. Performance impacts SEO? <ul><ul><li>Google: “ we encourage you to start looking at your site’s speed – not only to improve your ranking in search engines, but also to improve everyone’s experience on the internet ” </li></ul></ul>Google Webmaster’s tools
  6. 6. <ul><li>So performance matters!!! </li></ul>
  7. 7. When we think about performance? Wireframes Development Production
  8. 8. Always!!! Wireframes Development Production
  9. 9. How fast is our page? <ul><li>Use your senses </li></ul><ul><li>http://webpagetest.org </li></ul><ul><li>Firebug </li></ul>
  10. 10. How fast is our page? (cont’d) <ul><li>The drupal way: </li></ul><ul><ul><li>Devel (devel) </li></ul></ul>
  11. 11. 80 / 20 <ul><li>“ 80% of consequences come from 20% of causes”, The Pareto Principle </li></ul><ul><li>We must focus on the 20% </li></ul>
  12. 12. Make fewer HTTP requests <ul><li>admin/settings/performance </li></ul><ul><li>TIP: Recommended modules: </li></ul><ul><ul><li>Javascript Aggregator (javascript_aggregator) </li></ul></ul><ul><ul><li>CSS gzip (css_gzip) </li></ul></ul><ul><li>Use sprites on your theme icons </li></ul>
  13. 13. Use an op-code & profiling <ul><li>Code Optimization </li></ul><ul><li>Decrease CPU utilization </li></ul><ul><li>Huge decrease in memory utilization </li></ul><ul><li>eAccelerator, APC, Xcache, Zend (commercial) </li></ul><ul><li>TIP: apc.stat = 0 (Available since APC 3.0.10) => doubles our performance, only used on productions servers </li></ul><ul><li>Use xDebug to profile PHP code </li></ul><ul><li>Measure how fast your php code is </li></ul><ul><li>TIP: Use the 80/20 rule </li></ul>
  14. 14. Uninstall unnecessary modules <ul><li>Choose your modules wisely, at the beginning of the project </li></ul><ul><li>Disable modules that you do not need </li></ul><ul><li>Remove slow modules (ex. Statistics, Admin_menu, Tagadelic, Nice Menus) </li></ul><ul><li>TIP: write your module </li></ul>
  15. 15. Optimize your themes <ul><li>NEVER use a function in the tpl files, always on the preprocess functions </li></ul><ul><li>In tpl we ONLY print variables </li></ul><ul><li>TIP: Don’t trust a theme company!!! </li></ul>
  16. 16. Optimize your queries <ul><li>Always use an index in your queries => HUGE BOOST </li></ul><ul><li>NEVER use SELECT * …; </li></ul><ul><li>LIMIT your results (LIMIT 0,10) </li></ul><ul><li>Log slow queries: </li></ul><ul><ul><li>Enabled in my.cnf (default 2’) </li></ul></ul><ul><ul><li>Decrease that number, periodically </li></ul></ul><ul><ul><li>Patch mysql, for < 1 sec times </li></ul></ul><ul><ul><li>Optimize queries with the rule 80/20 in mind </li></ul></ul><ul><li>TIP1: Build your custom query based on views </li></ul><ul><li>TIP2: Add your own indexes, if possible </li></ul><ul><li>TIP3: Use devel </li></ul>
  17. 17. Monitor your server <ul><li>Don’t let your users complain </li></ul><ul><li>Monitor your server: </li></ul><ul><ul><li>Nagios </li></ul></ul><ul><ul><li>Munin </li></ul></ul><ul><ul><li>Unix commands (top, vmstat, htop, netstat etc) </li></ul></ul><ul><ul><li>Mysql (mysql, mytop) </li></ul></ul><ul><ul><li>Logs </li></ul></ul><ul><li>TIP: Always monitor! </li></ul>
  18. 18. Cache as much as possible Always enable drupal caching Tip: On high traffic sites try Memcache Tip: Try blockcache_alter Available on Pressflow
  19. 19. Questions <ul><li>Alexios Panagopoulos </li></ul><ul><li>twitter.com/apanag </li></ul>

×