Speeding up your Drupal site


Published on

Presentation given on August 15, 2010 at Wiredcraft's office about Drupal Optimization

Published in: Technology
1 Comment
1 Like
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Speeding up your Drupal site

  1. 1. Speeding up your Drupal site by Ronan Berder (Wiredcraft, Managing Director)
  2. 2. The why and the what <ul><li>Front end </li></ul><ul><ul><li>Deliver content to users quickly </li></ul></ul><ul><ul><li>Optimize use of network </li></ul></ul><ul><li>Back end </li></ul><ul><ul><li>Quickly generate content </li></ul></ul><ul><ul><li>Optimize server resources </li></ul></ul>
  3. 3. Some guidelines <ul><li>Keep things simple; add complexity incrementally </li></ul><ul><li>Scale vertically and then horizontally ONLY IF NEEDED </li></ul><ul><li>Most important: users, not system administrators </li></ul><ul><li>Optimizing your code is a huge part of the equation </li></ul>
  4. 4. Identifying your bottlenecks <ul><li>Get familiar with shell; uptime, netstat, ps aux, </li></ul><ul><li>Problem: Network? Disk? CPU? Memory? </li></ul><ul><li>Source: Web server? App server? DB? </li></ul><ul><li>Caching is not the “Blue Powder”, caching adds complexity </li></ul><ul><li>For the long run, you'll need monitoring; Zabbix, Cacti, Nagios... </li></ul>
  5. 5. Optimizing your Web server <ul><li>The basics; </li></ul><ul><ul><li>Remove unnecessary modules </li></ul></ul><ul><ul><li>Clean up your configuration; MPM, MaxClients, MaxRequestsPerChild, KeepAlive... </li></ul></ul><ul><li>There are alternatives; Lighttpd, NGINX </li></ul><ul><li>Stress test (Apache Benchmark) </li></ul>
  6. 6. Optimizing your Application server <ul><li>As usual, clean up your configuration </li></ul><ul><li>Add opcode; APC, Xcache, eAccelerator </li></ul><ul><li>FastCGI; PHP-FPM and PHP-FCGI </li></ul>
  7. 7. Optimizing your Database server <ul><li>As usual, clean up your configuration </li></ul><ul><li>Check for slow queries </li></ul><ul><li>Add caching; Memcached </li></ul><ul><li>Scale horizontally; Master/Slave replication </li></ul><ul><li>You'll probably want to look into Cacherouter and Pressflow </li></ul>
  8. 8. What is Pressflow <ul><li>Patched version of Drupal </li></ul><ul><li>Runs Drupal.org </li></ul><ul><li>Only works with PHP5 and MySQL </li></ul><ul><li>Works with M/S replication and reverse-proxy </li></ul>
  9. 9. Adding more caching <ul><li>Reverse proxy; usually Varnish </li></ul><ul><li>File caching; Boost </li></ul><ul><li>Block caching; Block Cache Alter </li></ul><ul><li>.... </li></ul><ul><li>Be aware that authenticated caching is much more complex </li></ul>
  10. 10. The real big thing <ul><li>Caching is fine, but people tend to forget the biggest bottleneck: the code </li></ul><ul><ul><li>Too many modules (feature creep) </li></ul></ul><ul><ul><li>Poor code, slow queries </li></ul></ul><ul><ul><li>“Bad” modules (usually results from “bad” engineering) </li></ul></ul><ul><li>Code profiling; xdebug, xhprof </li></ul>
  11. 11. Dealing with the situation <ul><li>Get things under control; </li></ul><ul><ul><li>Quick wins; Opcode, Memcached </li></ul></ul><ul><ul><li>Cleanup your configuration </li></ul></ul><ul><ul><li>Cache anonymous traffic (Boost) </li></ul></ul><ul><li>Clean up the mess </li></ul><ul><li>Take things form there </li></ul>
  12. 12. Next step; front end <ul><li>Complete other topic, but many things you can consider; CSS/JS aggregation, parallelization, CDN, Gzip compression, sprites, image optimization... </li></ul><ul><li>Guess what; code is also a big deal here. Optimize! </li></ul>
  13. 13. Thank you! Now, questions?