high performance drupal
DESCRIPTION
Presentation from BADCamp 2009 on high performance Drupal: how to make your website fast and scalable.TRANSCRIPT
![Page 1: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/1.jpg)
High Performance DrupalMaking Your Site Fast Fast Fast
![Page 2: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/2.jpg)
Drupal Is Powerful
![Page 3: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/3.jpg)
Drupal is Slow
![Page 4: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/4.jpg)
Databases are Slow
![Page 5: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/5.jpg)
PHP Is Slow
![Page 6: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/6.jpg)
Consumer-Grade Networks Are Slow
![Page 7: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/7.jpg)
Increasing Speed Means Diving Less Deeply Into The Stack
![Page 8: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/8.jpg)
Fast Is Making Fewer Requests From Faster Sources
![Page 9: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/9.jpg)
The Life Of A Pageload
• Browser Request
• Browser Cache?
• Network Request
• Server Response
• Associated Assets (back to top)
![Page 10: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/10.jpg)
Optimizing For The Browser
• Make Your HTML/CSS Images Efficient
• Use CSS/JS Aggregation
• Use a CDN
• Yslow is good for profiling this
![Page 11: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/11.jpg)
Optimizing Server Response
• Reverse Proxy/Drupal Page Cache
• PHP OpCode Cache
• Drupal System Cache
![Page 12: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/12.jpg)
Reverse-Proxies Are Very Fast
![Page 13: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/13.jpg)
Faster Than Apache
![Page 14: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/14.jpg)
Much Faster Than Drupal
![Page 15: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/15.jpg)
Don’t Bother Your Power Tools With Simple Tasks
![Page 16: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/16.jpg)
Implementing Varnish
• Use Pressflow
• Implement A Simple VCL Based On Sessions
• Enable Aggressive Caching
• Enjoy, Experiment, Excel
![Page 17: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/17.jpg)
OpCode Caching Keeps Drupal Loaded In Memory
![Page 18: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/18.jpg)
Don’t Touch The Disk
![Page 19: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/19.jpg)
Don’t Load Up Apache Threads With Copies of Drupal
![Page 20: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/20.jpg)
Implementing APC
• The Biggest/Cheapest Win
• Install via apt-get, yum, or pecl
• Monitor with apc.php
• Lots of modules? Bump the SHM size
• Enable apc.stat=0 with caution
![Page 21: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/21.jpg)
Drupal Freezes It’s Code Before Launch
![Page 22: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/22.jpg)
Most Real-World Scaling Information Comes After Release
![Page 23: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/23.jpg)
Drupal Supports A Crazy Array Of Use Cases
![Page 24: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/24.jpg)
$5/month Shared Hosting Is Not High Performance
![Page 25: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/25.jpg)
Pressflow
• “Pressflow Makes Drupal Scale”
• Drop-in Replacement For Core
• Backports many Drupal 7 features
• PHP 5.x/MySQL 5.x Required
• Enables robust reverse-proxy, mysql replication and more
• Runs drupal.org and many other high-performance sites
![Page 26: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/26.jpg)
Drupal Has A Cache And That Is Good
![Page 27: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/27.jpg)
But... Drupal’s Cache Is In The Database
![Page 28: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/28.jpg)
And Serialized.
![Page 29: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/29.jpg)
That Works Anywhere, But Is Both Slow and Expensive
![Page 30: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/30.jpg)
CacheRouter
• Use settings.php to plug in cacherouter instead of /includes/cache.inc
• Pick your poison: APC, XCache, Memcached, Filesystem, or classic db caching.
• Change caches per table.
• Vital for high-speed logged-in pageloads.
![Page 31: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/31.jpg)
Coming Soon: Advcache
• Cache Nodes, Users, Taxonomy Terms and other common objects via cacherouter.
• Extends the notion of drupal’s static cache to whole objects.
• Still in development, but if you’re into writing patches...
![Page 32: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/32.jpg)
Other Tips
• Search is among the slowest and most expensive queries. Use Solr instead.
• InnoDB can help with locking in MySQL
• Hardware is faster and often more cost effective than code cleanup.
• Monitor load and scale ahead of problems.
![Page 33: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/33.jpg)
Benchmarking/Profiling
• Cachegrind to profile code.
• Jmeter to simulate load.
• Slow Query logs, cactai, etc.
![Page 34: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/34.jpg)
Vertical/Horizntal Scaling
• Start with all services you need.
• Separate services into layers.
• Add more servers at each layer as needed.
• Shameless plug: Project Mercury: http://getpantheon.com
![Page 35: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/35.jpg)
![Page 36: High Performance Drupal](https://reader035.vdocuments.us/reader035/viewer/2022070315/554f931fb4c905435d8b51ab/html5/thumbnails/36.jpg)
More Resources
• http://groups.drupal.org/high-performance
• http://pressflow.org
• http://tag1consulting.com
• http://2bits.com
• http://getpantheon.com