Top Banner
Performance for Site Builders Erik Webb Senior Technical Consultant Acquia Erik Webb @erikwebb Senior Technical Consultant Acquia
26
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Performance Tips for Site Builders

Performance for Site Builders

Erik WebbSenior Technical Consultant

Acquia

Erik Webb@erikwebbSenior Technical ConsultantAcquia

Page 2: Performance Tips for Site Builders

Agenda

IntroductionEvaluating ModulesWhat to Look ForTypes of CachingConfiguring DrupalPerformance-related Tools

Page 3: Performance Tips for Site Builders

About Me

Senior Technical ConsultantFocus on Performance, Infrastructure, and Scalability

5+ years with Drupal10+ years with LAMP

Red Hat Certified Engineer

Worked previously at Georgia Tech, IBM

Page 4: Performance Tips for Site Builders

Bad Performance Advice

Drupal is slow.If it runs out of memory, give it more.Don’t use CCK/Views/Panels/whatever.If you don’t install X, your site will be slow.You need multiple servers.

You should have MySQL slave servers.Varnish will solve all of your problems.*

http://www.diesoft.net/blog/2012/04/10/first-aid-drupal

Page 5: Performance Tips for Site Builders

Evaluating Modules

Page 6: Performance Tips for Site Builders

General Evaluation

1. Supported version(s)2. Maintainer reputation3. Total usage4. Number of open issues5. Usage change over time

Page 7: Performance Tips for Site Builders

Performance Evaluation

Record baseline before installationRecord usage immediately after installationUse ongoing memory monitoring to correlate

Use tag “Performance” in issue queueTypically improvementsWeeds out “My site is slow” issuesExample: http://drupal.org/project/issues/search/views?issue_tags=Performance

Page 8: Performance Tips for Site Builders

Questions to Ask?

When does this module “run”?Examples: Login, Content update, Periodically/cron

How does this module scale?Examples: Per node, per user, per request

What happens if this module fails?If this module fails, no user can login.If this module fails, no content will have functioning slideshows.

Does my site care about performance?Is my site visited entirely by anonymous users?Is this site internal and low-traffic only?

Do I really need this module?

Page 9: Performance Tips for Site Builders

What to Look For

Page 10: Performance Tips for Site Builders

Identifying the Problem

When does it occur?All pages? Anonymous and/or authenticated?Only when saving content? Only when logging in?Under heavy load? Random times during the day?

When did it start?Avoid the “it feels faster/slower” problemRecord performance numbersMaintain release notes (or retain logs)

Who is to blame?Test against regression between featuresTake note of any infrastructure changes

Page 11: Performance Tips for Site Builders

Where Problems Occur

Page building modulesViews and Panels

External web servicesUser loginsAny 3rd-party integration

Overall complexityTotal number of modulesViews within Panels within Panels within...

Misconfigured componentsDefault is uncached (for developers)Understand what is being cached

Page 12: Performance Tips for Site Builders

Managing Performance

Keep records of performance over timeBe analytical, don’t feelNote any milestones of activity or feature developmentCorrelate improvements and regressions

Establish a performance metricSet a level of acceptabilityExample: 80% of pages should return in 500ms or render in 3s

Adopt a “Definition of Done” (DoD)Agile concept - aspects needing satisfaction before completionPerformance is part of QA

Don’t hide behind infrastructureSlow Drupal is cheap, hardware is not

Page 13: Performance Tips for Site Builders

Types of Caches

Page 14: Performance Tips for Site Builders

Application-level Caching

Move along, nothing to see here.Not configurableShould never result in “staleness”Can only be enhanced by improving backend

Examples: Filter, Menu, Path, Filter (not FORM!)

Page 15: Performance Tips for Site Builders

Component-level Caching

Stores user-facing componentsBest speedup for authenticated users

Limited effectiveness without more configurationMostly disabled by default

Varying degrees of contents, HTML to serialized objectsSome implementations more effective than others

Examples: Block, Views, Panels

Page 16: Performance Tips for Site Builders

Page-level Caching

Most efficient possible cacheCombine with reverse proxy

Only applicable for anonymous users*Stored as full HTMLpage_cache_fastpath() in D6

Not supported by default cache backendBypasses database connection and full bootstrap

Page 17: Performance Tips for Site Builders

Configuring Drupal

Page 18: Performance Tips for Site Builders

Performance page

Use block caching!*Disabled by node accessBiggest speedup for auth users

Content changes clear block and page cache

Use “Minimum cache lifetime”Using a reverse proxy?

Use “Expiration of cached pages”

Aggregation/compression only on production

$conf[‘preprocess_css’] = 1;

Page 19: Performance Tips for Site Builders

Fast 404

Added in Drupal 7.9 (currently being backported to D6)See http://drupal.org/node/76824

Configured in settings.phpAvoid performance hit from404 errors

Page 20: Performance Tips for Site Builders

Other Notes

Understand what Drupal does and does not cacheHelps understand when to troubleshoot

Don’t forget the frontend!Do not enable “UI modules” on production

Unneeded memory usageExamples: Field UI, Rules Admin, Views UI

Avoid Database Logging (if you have an alternative)Examples: Syslog, log4php

Unnoticed PHP errors slow down executionIncrease PHP logging on non-production environments

Page 21: Performance Tips for Site Builders

Performance-related Tools

Page 22: Performance Tips for Site Builders

Drupal Modules

DevelExecution time and memory usageQuery logging

BoostFlat file page cachingDesigned for shared hosting (infrastructure neutral)

MemcacheReplace database caching with MemcachedIn-memory cache, reduces DB load

Page 23: Performance Tips for Site Builders

Drupal Modules

Entity CacheDrupal 7 onlyStores created objects a.k.a. “entities” (users, nodes, comments, etc.)

Path CachePressflow (D6) or Drupal 7

Block Cache AlterMaximize effectiveness of block cachingFine-grained control per block

Page 24: Performance Tips for Site Builders

Drupal Modules

Views LitepagerSlow pagers on Views with large DB tables

Views Content CacheStore saved Views based on content changes rather than expirationExample: Clear a View display when a new “Article” node is created

Cache ActionsMore generalized approach than Views Content CacheWorks with Drupal cache, CSS/JS aggregation, Views, and PanelsRequires the Rules module

Page 25: Performance Tips for Site Builders

3rd-Party Tools

Web optimization toolsYahoo! Smush.itSpriteMe

Web testing toolsWebPagetest.orgGoogle PageSpeed Online

Browser-basedFirebug/Web InspectorYSlow!Google PageSpeed

SaaS productsNew RelicYottaa

Page 26: Performance Tips for Site Builders

Questions?Where to find me?

erikwebb.net@erikwebb on Twittererikwebb on LinkedInerikwebb on SlideShare