Drupal is a very flexible content management system capable of providing a very wide range of functionality. It’s modular design, whilst flexible, does have the downside of being on the slow side in the performance stakes in certain cases. This guide shows you how to squeeze the last drop of performance out of Drupal by optimizing the various levels of a Drupal installation.
When running in an unoptimized configuration relatively simple pages can consume a lot of RAM, a fair amount of CPU and issue a large number of database queries. On medium sized sites it can be difficult to run in some shared server environments if the host is concerned about CPU and RAM. It is therefore important to attempt to get the most from your installation given your skill level and the resources available to you.
The Drupal community has taken steps to workaround these limitations. Tweaks can be made at different levels of the stack (Apache, PHP, MySQL, Drupal, page rendering) to improve performance. The good news for administrators is that there are some easy wins for all sites requiring only a couple of minutes of your time. Further, if you are prepared to dig deeper then there are a lot of areas which can be tuned to make your website perform even better.
- Performance benchmarking of Drupal 5.12, Drupal 6.6, and Drupal 7.x: we are getting slower …
- Drupal 5 faster than Drupal 6 faster than Drupal 7.
What do we mean by performance and scalability?
Performance refers to the speed of the system. Basically, how long does it take to produce a page? Performance is a result of how long it takes to render a page (i) on the server and (ii) on the client side in the browser. It is important now to forget the client side of the equation as big gains can be made here if all else is running smoothly.
Scalability refers to the ability of the system to handle more requests. ie. as the load increases on a system how is it placed to handle it. What is the throughput of the site under heavy load? For anonymous users and logged in users? How stable is the system? Are there faults or errors? How many resources are consumed?
It is important to focus on both aspects. A site which performs well provides a strong foundation on which a scalable solution can be based. Performance improvements can be made on a number of different levels: (i) data access, (ii) code efficiency and (iii) page rendering. The aim of the game is to ensure that you have removed any major bottlenecks from each of these layers. There is no point in optimizing one when problems exist in others. Scalability comes mainly from (i) caching at the page or block level, (ii) web server request handling and (iii) scaling out web servers. We will cover all these areas in this series of articles.
Easy wins?
It is not always easy to scale Drupal — not because Drupal sucks, but simply because scaling the LAMP stack (including Drupal) takes no small amount of skill. You need to buy the right hardware, install load balancers, setup MySQL servers in master-slave mode, setup static file servers, setup web servers, get PHP working with an opcode cache, tie in a distributed memory object caching system like memcached, integrate with a content delivery network, watch security advisories for every component in your system and configure and tune the hell out of everything.
Dries Buytaert
Scaling Drupal isn’t always easy. That said, there are some easy wins which will bring big gains for all sites. See the Out of the Box section for simple config options built into Drupal. We’ll cover a lot of ground in this guide but will start easy and will clearly identify where the biggest wins can be made for your kind of site. Relevant articles and discussions will be linked to for further reading. If you want a quick summary of the main tips then skip down to the Quick Reference section which covers the biggest wins for various kinds of sites.
Contents
This guide is divided in the following sections.
- Squeezing the last drop from Drupal
This page - Server Tools
YSlow, Devel, MySQL Admin, MySQL client, Munin, Analytics - Drupal and Server Profile
Different types of sites - Drupal Hosting Environment
Shared, Dedicated, Virtual and Managed - Drupal Performance Out of the Box
Page caching, compression - Drupal LAMP Server Tuning
Opcode cache, DB engine, indexes and warmup, Apache vs Nginx, RAM - Drupal Implementation Decisions
Search, module bloat, CCK, good practices - Drupal Troubleshooting
DB queries, dodgy modules - Drupal Caching
Boost, Varnish, Cache Router - Custom Drupal Distributions
Pressflow, Project Mercury - Drupal Benchmarking
Apache Bench, JMeter - Drupal Page Rendering
Requests, CDN, Expires Headers, Zip, Images - Drupal Performance Quick Reference
Best tips for your site - Slides for these articles
Presented at Sydney Drupal Users Group
Further Reading
Once you have finished reading the guide check out these resources for further reading.
- Server tuning considerations
- Good reference for ways to tune your server: Apache, PHP, MySQL
- Performance
- Performance blog entries from Wim Leers.
- Drupal performance-tuning and optimization for large web sites
- Impressive collection of hard core articles with problems and solutions.
- scaling drupal – an open-source infrastructure for high-traffic drupal sites
- Incremental steps you can take to go from a standard Drupal install on a single box to multiple web and DB servers.
- Tips on speeding up your Drupal sites
- A good list of common tips for speedier Drupal sites.
- Drupal Performance and Scalability
- Good online book from Tag1 Consulting with holistic approach. Some later chapters incomplete.
- High performance
- Drupal group dedicated to all performance concerns of Drupal. Conversation largely focuses on Pressflow, Memcached, Boost, Varnish and Nginx.
- Best Practices for Building a High Performance and Scalable Drupal Site
- Webinar covering a lot of ground.
- Drupal 6 Performance Tips
- Newly published book (Feb 2010) covering a range of performance tips: standard Drupal features, Boost, Devel, Memcache and multisite. Read reviews.
Author
The author, Murray Woodman, has developed one large Drupal site with 10M+ nodes and has earnt some of the above experience through a lot of trial and error. Much of the other material (Nginx, FastCGI, Varnish, CacheRouter, Memcache) is a result of synthesizing results from other authors. Thanks goes to all the authors of referred articles. This article was written as the foundation of a March 2010 presentation at the Sydney Meetup of the Drupal Australia Group.




2 Comments
really good list of articles and links within. must read for all who love performance n scalability..
great job, thank you spending time for us.. you write is here Drupal Performance Out of the Box is very nice. all links are very useful for drupal developers & drupal programmers..
One Trackback
[...] bin ich auch noch über ein anderes interessantes Buch gestossen: 'Squeezing the last drop from Drupal' . Da lohnt sich auf jeden Fall auch einen Blick rein zu [...]