Boost Drupal performance by Rumen Yordanov

40
Boost Drupal Performance By Rumen Yordanov OpenSource Department Manager at Propeople

Transcript of Boost Drupal performance by Rumen Yordanov

Page 1: Boost Drupal performance by Rumen Yordanov

Boost Drupal Performance

By Rumen YordanovOpenSource Department

Manager at Propeople

Page 2: Boost Drupal performance by Rumen Yordanov

Facts about me

• Rumen Yordanov• OpenSource Department Manager at

Propeople• Working with Drupal since 2007• PHP and Mysql Certified Engenieer• Web development since 2000• Participate and presenting at Drupal

Events

Page 3: Boost Drupal performance by Rumen Yordanov

Facts about Propeople

• Danish full service web agency• 70+ brains• CPH, Sofia, Chisinau, Sweden, SF, Ukrane• Drupal, Magento, SiteFinity, EPiServer,

MOSS• Acquia Enterprise Select & Microsoft Gold • Berlingske, Amnesty, UNICEF, FDM, Saxo

Bank, Arla Foods, Mærsk, Egmont, SBS

Page 4: Boost Drupal performance by Rumen Yordanov

Why is this important?

Page 5: Boost Drupal performance by Rumen Yordanov

What we can do

• Educate on the subject• Include it in our estimation• Include it in your business plan• Optimize your hosting costs• Plan your success

Page 6: Boost Drupal performance by Rumen Yordanov

Things to consider

• Every system has capacity/limitations

• Improving capacity is ongoing process of monitoring, optimizing and scaling your setup

• No magic pills but the principals are the same!

Page 7: Boost Drupal performance by Rumen Yordanov

This session

• Understand web sites performance• Understand Drupal performance• Make/choose your caching layer• Optimize LAMP Stack• Scaling • Monitoring• Web browser optimization• D7 and performance• Questions

Page 8: Boost Drupal performance by Rumen Yordanov

Web workflow

Page 9: Boost Drupal performance by Rumen Yordanov

Optimization process

• Find week spot( bottleneck )• Determine goals• Increase capacity( make it run

faster)• Meassure system performance again

to determine new capacity• Record your results

Page 10: Boost Drupal performance by Rumen Yordanov

Profiling Drupal

• http://mirror.facebook.net/facebook/xhprof

• Inlcuded in latest Devel module• Not compatible with full page

cache( devel version )

Page 11: Boost Drupal performance by Rumen Yordanov

Profiling Drupal

• Small D6 installation• Only core modules enabled • Profile node/1• Enable some of the most used

module• Profile node/1

Page 12: Boost Drupal performance by Rumen Yordanov

Profile Drupal 6

Page 13: Boost Drupal performance by Rumen Yordanov

Profile D6

Page 14: Boost Drupal performance by Rumen Yordanov

Profiling Drupal

• Bootstrap process takes more time with increasing the numbers of installed modules

• Sides effect 404 and ajax callback takes resources and are and will execute at least for the time of bootstrapping

• Your custom code will just add time to bootstrap process

Page 15: Boost Drupal performance by Rumen Yordanov

Choosing cache strategy

• Full page cache – have side effects but is most effective

• Cache only elements( nodes, views, panels)

Easy to implement but not that effective

• Combination – use both

Page 16: Boost Drupal performance by Rumen Yordanov

Choosing cache strategy

• Things to consider

- When cache is build( on demand or on event )

- Do not add too many cache layers - Reboot strategy

Page 17: Boost Drupal performance by Rumen Yordanov

Full page cache

Page 18: Boost Drupal performance by Rumen Yordanov

Profiling

Page 19: Boost Drupal performance by Rumen Yordanov

Full page cache(Authcache)

• Advantages - really fast - give you Ajax framework for fast callbacks • Things to consider - are your pages cacheable - side effects

Page 20: Boost Drupal performance by Rumen Yordanov

Invalidating cache

• Drupal says invalidate all• We need to rewrite cache_clear_all ()• Add good invalidation strategy

Page 21: Boost Drupal performance by Rumen Yordanov

Invalidating cache

• Rules module• Add trigger and actions you need• Some already made actions for youhttp://drupal.org/project/cache_actions

Page 22: Boost Drupal performance by Rumen Yordanov

When the cache is not enough

• User specific data ( facebook ) • User often add contents that make

the cache invalid• Database become bottleneck

Page 23: Boost Drupal performance by Rumen Yordanov

Memcache

• Store data in memory• Very fast • Only key, value storage• Timestamp approach to invalidation

Page 24: Boost Drupal performance by Rumen Yordanov

Offload database

• Memcache• Search• Statistics • Live data

Page 25: Boost Drupal performance by Rumen Yordanov

NoSQL( MongoDB)

• Faster ( no transactions or data integrity)

• Easy to scale• MongoDB has D7 support

Page 26: Boost Drupal performance by Rumen Yordanov

Patch Drupal

• http://drupal.org/node/557542 -> Cache on module implements

• http://drupal.org/node/259623 -> Skip apache folder traverse ( very expensive on high load)

• http://drupal.org/node/106559 -> drupal_lookup_path() optimization

Page 27: Boost Drupal performance by Rumen Yordanov

Prepare Drupal for scale

• Add ability to use master slave• Add reverse proxy support( output correct headers )• Optimize for innodbhttp://fourkitchens.com/pressflow-

makes-drupal-scale

Page 28: Boost Drupal performance by Rumen Yordanov

Prepare Drupal for scale

• Add ability to use master slave• Add reverse proxy support( output correct headers )• Optimize for innodbhttp://fourkitchens.com/pressflow-

makes-drupal-scale

Page 29: Boost Drupal performance by Rumen Yordanov

Optimize LAMP Stack

• Accelerate PHP - APC - XCache - HipHop

Page 30: Boost Drupal performance by Rumen Yordanov

Optimize LAMP Stack

• Tune apache configuration• Add nginx for static content• Add reverse proxy • Tune database ( innodb settings )

Page 31: Boost Drupal performance by Rumen Yordanov

Varnish

• Really fast• Highly flexible configuration• Lots of tools to debug and profile• Edge side includes

Page 32: Boost Drupal performance by Rumen Yordanov

Varnish

Page 33: Boost Drupal performance by Rumen Yordanov

Varnish

• When to use edge server includes - when you have different ttl for

elements in the page but the content is shared

• Things to consider - They will take resources ( make

smart callbacks ) - the end user must wait till all

requests are processed

Page 34: Boost Drupal performance by Rumen Yordanov

Monitoring

• Why is important• Cacti• Munin• Google Analytics

Page 35: Boost Drupal performance by Rumen Yordanov

Stress tests

• Why are they important - Determine capacity - Early detect of errors• Much easier to make today(

http://loadstorm.com )

Page 36: Boost Drupal performance by Rumen Yordanov

Web Browser Optimizations

• Make fewer HTTP requests( Drupal

support aggregation of js and css)• GZIP the content• CDN• Effective browser cache

Page 37: Boost Drupal performance by Rumen Yordanov

D7 Improvements

• Improved cache support for reverse proxy

• Master/Slave replication• Multiple cache backbends• NoSQL support• Better innodb support

Page 38: Boost Drupal performance by Rumen Yordanov

Questions

?

Page 39: Boost Drupal performance by Rumen Yordanov

Want to learn more?

Drupal ThursdaysFor you that want to learn advanced Drupal from the developers and themers in Propeople.

Location: Sofia, Pirin 40A street. Second floorDate: Every Thursday from ~19.30.

More info: http://groups.drupal.org/node/119009

Page 40: Boost Drupal performance by Rumen Yordanov

Need a new job?

We’re hiring • Team Lead / Senior PHP developer• PHP / Drupal developers• Senior HTML developer

Interested? Talk with Welin or Rumen.