How can you help your Drupal website continue to perform at the highest level as it grows to meet demand? This comprehensive guide provides best practices, examples, and in-depth explanations for solving several performance and scalability issues. You’ll learn how to apply coding and infrastructure techniques to Drupal internals, application performance, databases, web servers, and performance analysis.
Covering Drupal versions 7 and 8, this book is the ideal reference for everything from site deployment to implementing specific technologies such as Varnish, memcache, or Solr. If you have a basic understanding of Drupal and the Linux-Apache-MySQL-PHP (LAMP) stack, you’re ready to get started.
Establish a performance baseline and define goals for improvement
Optimize your website’s code and front-end performance
Get best and worst practices for customizing Drupal core functionality
Apply infrastructure design techniques to launch or expand a site
Use tools to configure, monitor, and optimize MySQL performance
Employ alternative storage and backend search options as your site grows
Tune your web servers through httpd and PHP configuration
Monitor services and perform load tests to catch problems before they become critical
Chapter 1 Beginning a Performance Project
Getting Started with Performance Improvements
Establishing a Performance Baseline
Setting Goals for Website Performance
The Many Aspects of Drupal Performance
Creating a Prioritized List of Improvements
Chapter 2 Frontend Performance
Limiting HTTP Requests
Keep Third-Party Libraries Up to Date
Single Points of Failure (SPOFs)
Chapter 3 Drupal Performance Out of the Box
When Should You Use Page Caching?
The Cache and Other Swappable Storage
Chapter 4 Drupal Coding for Optimal Performance
Queues and Workers
Cache Stampedes and Race Conditions
Chapter 5 Drupal Coding for Abysmal Performance
Excessive Cache Granularity
Debug Code in the Code Base
Chapter 6 Verifying Changes
Analyzing Frontend Performance
Analyzing Application Performance
Chapter 7 Infrastructure Design and Planning
Horizontal and Vertical Scaling
Working Well Together
Example Two-Layer Configuration
Example Larger-Scale Infrastructure
Development and Staging Environments
Internal Network Layout
High Availability and Failover
Chapter 8 Service Monitoring
The Importance of Monitoring Services
Monitoring Alerts with Icinga
Graphing Monitoring Data
Internal Versus Remote Monitoring
Chapter 9 "DevOps": Breaking Down Barriers Between Development and Operations
Revision Control Systems
Configuration Management Systems
Pulling It Together: In-Depth Example with Puppet and Git
Development Virtual Machines
Deployment with Jenkins CI
Chapter 10 File Storage for Multiple Web Servers
Single NFS Server
HA NFS Cluster
Storage Area Networks (SANs)
Chapter 11 Drupal and Cloud Deployments
What Is the Cloud?
Why Use the Cloud?
Common Issues with Cloud Deployments and Their Mitigations
Chapter 12 Failover Configuration
IP Failover Versus DNS Failover
Chapter 13 MySQL
Drupal and MySQL Engines
Versions of MySQL
Chapter 14 Tools for Managing and Monitoring MySQL
Percona Monitoring Plug-Ins
Chapter 15 MySQL Query Optimization
Base Tables and Join Order
Chapter 16 Alternative Storage and Cache Backends
Cache, Lock, and Session Storage
Memcache In Depth
How to Break Your Site with Memcache
Chapter 17 Solr Search
Performance and Scalability Considerations
Integrating Solr with Drupal
Drupal Module Installation
Chapter 18 PHP and httpd Configuration
APC: PHP Opcode Cache
PHP Apache Module Versus CGI
Apache MPM Settings
Prefork Thread Settings
Administrative Directory or VirtualHost
Chapter 19 Reverse Proxies and Content Delivery Networks
Jeff has been involved with open source for over eleven years. He started using Linux professionally at the University of California at Santa Barbara, where he was a Senior Systems Administrator and Programmer for the Computer Science department. He most recently worked at the Oregon State University Open Source Lab (OSL) as the Operations Manager, providing technical and organizational leadership to the OSL while working closely with the many open source projects hosted there, including Drupal.org, the Linux Foundation, and the Apache Software Foundation.
Jeff has extensive infrastructure experience, gained over the years. As the Operations Manager at OSU Open Source Lab -- the largest open source hosting infrastructure of its kind -- he led the infrastructure and development teams; he is deeply involved in the CentOS Linux build and release process as a member of the QA team; and he works as a volunteer for the drupal.org infrastructure team. Jeff currently maintains a number of packages for the Fedora Project and Fedora's Extra Packages for Enterprise Linux (EPEL), and serves as the Lead Systems Engineer for multiple Tag1 clients. He lives in Vancouver, Washington.
Narayan is a co-owner of Tag1 Consulting, who joined the team in 2008. He was introduced to Drupal during his tenure at the Oregon State University Open Source Lab where he was the co-lead system administrator -- and served as their Database Administrator of over 180 MySQL databases -- the Freenode Server Administrator, and the Drupal.org Server Administrator. He is a permanent member of the Drupal Association, as their Systems Coordinator, and is the lead Systems Administrator for the Drupal.org Infrastructure Team. He is also a co-maintainer of the Pressflow high performance Drupal distribution.
Outside of Drupal, Narayan has been deeply involved in the FreeBSD, Gentoo, and Slackware communities. More recently, he acted as infrastructure lead for the Examiner.com 2.0 re-launch, infrastructure lead for the drupal.org redesign launch, and infrastructure lead/performance lead for drupal.org git migration. Narayan is currently Chief Technology Officer at Tag1 Consulting and resides in Portland, Oregon.
Nathaniel Catchpole has been using Drupal since version 4.5, and has been a regular contributor to Drupal core since 2006; along with extensive code profiling, he has contributed over 400 patches to the Drupal 7 release. Nathaniel also maintains the core entity, cache and taxonomy subsystems, as well as the memcache and entity cache contributed projects. In September 2011, Nathaniel became branch maintainer and release manager for the Drupal 8 release cycle.
Nathaniel has been with Tag1 Consulting since September 2010. Prior to that, he worked on the Examiner.com Drupal migration and launch, and as a consultant for CivicActions, with clients such as Sony BMG and Amnesty International.
Jeff Sheltren has been involved with open source since 2001. He started using Linuxprofessionally at the University of California at Santa Barbara, where he was a seniorsystems administrator and programmer for the computer science department. His previousposition at the Oregon State University Open Source Lab (OSU OSL) was as theoperations manager, providing technical and organizational leadership to the OSU OSLwhile working closely with the many open source projects hosted there, including Drupal.org, the Linux Foundation, and the Apache Software Foundation. Currently, Jeffworks as a performance engineer at Tag1 Consulting.
Jeff has extensive infrastructure experience, gained over the years. As the operationsmanager at OSU OSL—the largest open source hosting infrastructure of its kind—heled the infrastructure and development teams; he is deeply involved in the CentOS Linuxbuild and release process as a member of the QA team, and he works as a volunteer forthe Drupal.org Infrastructure Team. Jeff currently maintains a number of packages forthe Fedora Project and Fedora’s Extra Packages for Enterprise Linux (EPEL), and heserves as the lead systems engineer for multiple Tag1 clients. He lives in Vancouver,Washington.
Narayan Newton is a co-owner of Tag1 Consulting who joined the team in 2008. Hewas introduced to Drupal during his tenure at the Oregon State University Open SourceLab, where he was the co-lead system administrator—and served as the database administratorof over 180 MySQL databases; he has also held the positions of freenodeserver administrator and Drupal.org server administrator. Narayan is a permanentmember of the Drupal Association as their systems coordinator, and is the lead systemsadministrator for the Drupal.org Infrastructure Team. He is also a co-maintainer of thePressflow high-performance Drupal distribution.
Outside of Drupal, Narayan has been deeply involved in the FreeBSD, Gentoo, andSlackware communities. More recently, he acted as infrastructure lead for the Examiner.com 2.0 relaunch, infrastructure lead for the Drupal.org redesign launch, and infrastructurelead/performance lead for Drupal.org Git migration. Narayan is currentlychief technology officer at Tag1 Consulting and resides in Portland, Oregon.Nathaniel Catchpole has been using Drupal since version 4.5 and has been a regularcontributor to Drupal core since 2006; along with extensive code profiling, he has contributedover 400 patches to the Drupal 7 release. Nathaniel also maintains the coreentity, cache, and taxonomy subsystems, as well as the Memcache and Entity Cachecontributed projects. In September 2011, Nathaniel became branch baintainer and releasemanager for the Drupal 8 release cycle.
Nathaniel has been with Tag1 Consulting since September 2010. Prior to that, he workedon the Examiner.com Drupal migration and launch and as a consultant for CivicActions,with clients such as Sony BMG and Amnesty International.
The animal on the cover of High Performance Drupal is the Red-shouldered Hawk(Buteo lineatus). The Red-shouldered Hawk can be found in North America, specificallyin eastern North America, the coast of California, and northern Mexico. They live inwooded areas and stay within a confined range within those areas.
Adult male Red-shouldered Hawks are 15 to 23 inches in length and tend to weigh 550grams. Females, on the other hand, are a bit longer than males by just a few inches, andweigh 700 grams. The wingspan of the adult Red-shouldered Hawk ranges from 35 to50 inches. They have brown heads, red chests, red bars along their bellies, and whitebars along their tails. Like many hawks, they have great vision and will swoop down ontheir prey. They eat rodents, squirrels, rabbits, amphibians, small birds, and large insects.
The Red-shouldered Hawk is a monogamous bird. A breeding pair will typically builda stick nest and will use the same nest every year. The female Red-shouldered Hawktypically gives birth to three to four eggs and after being born the young are dependenton their parents for up to 19 weeks.
The cover image is from Johnson’s Natural History. The cover fonts are URW Typewriterand Guardian Sans. The text font is Adobe Minion Pro; the heading font is AdobeMyriad Condensed; and the code font is Dalton Maag’s Ubuntu Mono.