"Drupal is always so fast!" ... said no one, ever.
Drupal has a reputation as being a slow CMS, but that reputation is undeserved; there are many small things that impact a Drupal site's performance in sometimes substantial ways. This session will highlight many 'quick wins' that will get your site performing like a champ in no time!
Then we'll take a demonstration site that has many elements of real-world 'slow' Drupal sites, show how to do a quick performance evaluation/triage, and change the site from loading in 4-5 seconds to loading in less than a second, and maxing out at 2 requests per second to a speedy 4,000+ requests per second!
The session will also discuss the importance of a plan, benchmarking, and assumptions when you do performance work on your own Drupal site.
17. Easy Wins - Drupal
• General
• KISS: Remove modules, simplify layouts... be ruthless!
• Use Boost (if no Varnish/Nginx static cache)
• Disable dblog module
18. Easy Wins - Drupal
• Caching
• Enable anonymous page cache (default in D8)
• Views: use views caching (+ Views cache bully... but not
needed in D8!), use Litepager
• Use panels, block, entity caching
• Watch for cache-breaking elements (e.g. login block +
Honeypot, etc.)
19. Easy Wins - Drupal
• On the edge of 'easy'
• Use drupal_fast_404() + Fast 404
• Avoid redirects inside Drupal (convenience tradeoff)
• Use drush for cron, use Elysia Cron
20. Easy Wins - Backend
• Apache / Nginx
• "Use PHP-FPM instead of Apache mod_php"
• Not really this simple; more about smart
resource allocation
• More CPU cores, more RAM
21. Easy Wins - Backend
• PHP
• Run version 5.5+
• Make sure OpCache can hold all your code
(opcache_get_status())
• MySQL
• innodb_buffer_size - database in RAM
• slow_query_log - watch it!
22. Easy Wins - Front End
• Optimize images (smaller sizes w/ styles, fewer
images per page, lazy loading)
• Enable CSS/JS Aggregation, consider advagg
• Use CloudFlare or another CDN
• YSlow/PageSpeed - Fix easy configuration
changes (expires, etags, etc.)
• Remove external / social widgets and embeds
23. Easy Wins - Front End
• External service integrations are often the #1
or #2 performance burden for front-end page
load times.
• Social widgets
• Embedded media
• Ads, tracking
• iframe content
24. Let's Do This Thing!
1. Plan
2. Benchmark
3. Adjust
4. Benchmark again
25. 1. Plan
• Home page should load in <1s for anonymous
users over a local network connection
• Home page should load in <2s for authenticated
users over a local network connection
• Assumptions:
• Site has mostly anonymous traffic
• Site serves a single geographical region, mostly
desktop users
26. 1. Plan
• Home page should load in <1s for anonymous
users over a local network connection
• Home page should load in <2s for authenticated
users over a local network connection
• Assumptions:
• Site has mostly anonymous traffic
• Site serves a single geographical region, mostly
desktop users
Important!
31. 3. Adjust
Symptom Indication
Large BE/FE Δ Slow-loading FE resources
Long TTFB* (> 1s) Backend response slow
~2 req/s capacity Site will scale... poorly
*TTFB = Time To First Byte
32. 3. Adjust
• Add Caching
• Beware lipstick on a pig!
• Caches should make what's good, better
• Stop the bleeding first
• Easy Wins, then harder things like slow queries
and code fixes
33. 4. Benchmark again
Benchmark Before After
DOMContentLoaded ~1.6s ~0.2s
Load (Full) ~4.0s ~0.2s
drush (backend) ~2.0s ~0.8s
wrk (load test) ~1.75 req/s ~437 req/s