21
© 2009 DPCI. All Rights Reserved. Drupal for the Enterprise Seminar by DPCI featuring Dries Buytaert Michael Mainiero, and Jeff Rigby Thursday, October 29, 2009

Jeff Rigby on Scaling Drupal in the Enterprise

Embed Size (px)

DESCRIPTION

Presentation by Jeff Rigby held Thursday, October 29th, 2009 at DPCI Seminar on Drupal in the Enterprise

Citation preview

Page 1: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Drupal for the Enterprise

Seminar by DPCI featuring Dries Buytaert

Michael Mainiero, and Jeff Rigby

Thursday, October 29, 2009

Page 2: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Drupal for the Enterprise

Presented by Jeff RigbyWeb Application Architect, DPCI

Thursday, October 29th, 2009

Page 3: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Goals of this PresentationDescribe how to scale Drupal from an out-of-box build to an enterprise level solutionExplain some of the approaches DPCI has used with our clients to meet their scaling needs

Page 4: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Scaling DrupalAnonymous is easy to scale— Mirror servers— Reverse-Proxy caches— Drupal only manages the content

Authenticated traffic is more difficult— Each dynamic page must be processed by PHP— Requires more horsepower

Page 5: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Built In OptionsConfiguration— Drupal page/block cache— Page compression— Aggregate JS/CSS

Coding— Drupal cache (use it!)— Use static variables when possible

Immediately usable with no additional modules

Page 6: Jeff Rigby on Scaling Drupal in the Enterprise

Built In Options Results

© 2009 DPCI. All Rights Reserved.

5.8

4.8

96.5

4.8

0 20 40 60 80 100 120

Anon

Auth

Requests Per Second

Optimized

OOB

Page 7: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Quick OptimizationsBoostMemcachedOpcode Cache

Page 8: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

BoostAmazing performance gainAnonymous users onlyServes static filesNo additional software or hardware needed

Page 9: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

MemcachedEasy to install on the serverMinor module configurationRemoves the cache from the databaseOptionally removes session tracking from the databaseSignificantly reduces MySQL statements

Page 10: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Opcode Cache— A few out there (APC, Zend Optimizer, XCache,

eAccelerator)— Easy to install— Pre-compiles PHP in memory— Reduces server load

Page 11: Jeff Rigby on Scaling Drupal in the Enterprise

Combined Results

© 2009 DPCI. All Rights Reserved.

5.8

4.8

427

15.1

0 100 200 300 400 500

Anon

Auth

Request Per Second

Optimized

OOB

Page 12: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

MySQL TweaksTune your MySQL configuration to your server. MySQL Tuner is very useful: http://blog.mysqltuner.comEnable the query cache! Enable the slow query log to spot problem queries

Page 13: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Apache SOLRModule provides drop-in replacement for searchGets search out of DrupalAvoids expensive node_load() callsAvailable as a hosted solution from Acquia

Page 14: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Reverse-Proxy CacheSquid or VarnishRun on the same server or clustered on multiple external serversCan reduce web server traffic by 90%+ if serving the entire site (anonymous traffic)For dynamic sites, offload all static files (JS, CSS, images, etc.) and let Apache focus on PHPLow overheadTip: Override the expires header (— Expires: Sun, 19 Nov 1978 05:00:00 GMT

Page 15: Jeff Rigby on Scaling Drupal in the Enterprise

Reverse-Proxy Cache

© 2009 DPCI. All Rights Reserved.

Page 16: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Use a CDNMany options out there: Akamai, Amazon, CacheFlyGenerally easy to setupOff-load entire site or only static files (JS, CSS, images, etc.)Can be expensive

Page 17: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Static Page TipsJavascript!Store dynamic values in a cookieUse AJAX to load small portions of dynamic contentUse Javascript to replace dates with natural language “About 4 Minutes Ago”

Page 18: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Load Balanced Web ServersUse rsync to keep Web servers synched or NFS web rootAdvanced load balancers can handle server failuresEasy to add or remove servers with no site downtimeRun server intensive tasks (cron, data import, etc.) on an internal server to avoid site slow downs

Page 19: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Multiple MySQL DatabasesMaster / Slave Setup— Minimum of 2 servers— Drupal 5 and 6 require minor core hacks— Built into Drupal 7!— Be mindful of database lag— Reliant on master database

Use Memcached to share the query cache across all serversClustering and distributed configurations

Page 20: Jeff Rigby on Scaling Drupal in the Enterprise

Sample Large Scale Site

© 2009 DPCI. All Rights Reserved.

Page 21: Jeff Rigby on Scaling Drupal in the Enterprise

© 2009 DPCI. All Rights Reserved.

Questions?Jeff’ s Blog:

www.databasepublish.com/blog/jrigby

Scaling Drupal