Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 40

Boost Drupal Performance

By Rumen Yordanov
OpenSource Department Manager at
Propeople
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
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
Why is this important?
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
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!


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
Web workflow
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
Profiling Drupal

• http://mirror.facebook.net/facebook/xhprof
• Inlcuded in latest Devel module
• Not compatible with full page cache( devel
version )
Profiling Drupal

• Small D6 installation
• Only core modules enabled
• Profile node/1
• Enable some of the most used module
• Profile node/1
Profile Drupal 6
Profile D6
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
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


Choosing cache strategy
• Things to consider

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


- Do not add too many cache layers
- Reboot strategy
Full page cache
Profiling
Full page cache(Authcache)

• Advantages
- really fast
- give you Ajax framework for fast callbacks

• Things to consider
- are your pages cacheable
- side effects
Invalidating cache

• Drupal says invalidate all


• We need to rewrite cache_clear_all ()
• Add good invalidation strategy
Invalidating cache
• Rules module
• Add trigger and actions you need
• Some already made actions for you
http://drupal.org/project/cache_actions
When the cache is not enough

• User specific data ( facebook )


• User often add contents that make the cache
invalid
• Database become bottleneck
Memcache

• Store data in memory


• Very fast
• Only key, value storage
• Timestamp approach to invalidation
Offload database

• Memcache
• Search
• Statistics
• Live data
NoSQL( MongoDB)

• Faster ( no transactions or data integrity)


• Easy to scale
• MongoDB has D7 support
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
Prepare Drupal for scale

• Add ability to use master slave


• Add reverse proxy support
( output correct headers )
• Optimize for innodb
http://fourkitchens.com/pressflow-makes-drupal-
scale
Prepare Drupal for scale

• Add ability to use master slave


• Add reverse proxy support
( output correct headers )
• Optimize for innodb
http://fourkitchens.com/pressflow-makes-drupal-
scale
Optimize LAMP Stack

• Accelerate PHP
- APC
- XCache
- HipHop
Optimize LAMP Stack

• Tune apache configuration


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

• Really fast
• Highly flexible configuration
• Lots of tools to debug and profile
• Edge side includes
Varnish
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
Monitoring

• Why is important
• Cacti
• Munin
• Google Analytics
Stress tests
• Why are they important
- Determine capacity
- Early detect of errors
• Much easier to make today(
http://loadstorm.com )
Web Browser Optimizations

• Make fewer HTTP requests( Drupal support


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

• Improved cache support for reverse proxy


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

?
Want to learn more?

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

Location: Sofia, Pirin 40A street. Second floor


Date: Every Thursday from ~19.30.

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


Need a new job?

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

Interested? Talk with Welin or Rumen.

You might also like