Speeding up the snail
Marcus Deglos
and making Drupal scale
Who is Marcus?
Software engineer
with Ibuildings
Drupal contributor
PADI scuba diving
instructor
The problem with frameworks
The cost of the
framework:
- include files
- function calls
- database queries
So why use Drupal?
• Quicker to develop
• Easier to maintain
Turbo-charging your site
Optimising the stackTuning
Drupal
Adding hardware
Benchmarks
Optimising the stack
• Apache
• PHP
• MySQL
• APC extension
• Varnish
Apache
• Pre-fork vs Worker
mode
• Number of servers /
clients
• Impact of .htaccess
/ AllowOverride
• Impact of SuExec
Op...
PHP
• CGI vs Apache
Module vc FastCGI
• php.ini:
– Memory limit -
choose for stability
– register_long_
arrays
Optimising ...
Database
• Optimising the database
– Monitoring with the slow query log
– Add (and remove) indices based on usage
– Consid...
APC
• APC is an op-code
cache
• Install and forget?
• Monitor APC use
• APC tuning
– APC memory usage
– APC stat: checks i...
Varnish
• Varnish is an HTTP
accelerator
• Requires D7,
Pressflow, or a
patch to Drupal
core
• New mindset for
personalisi...
Tuning Drupal
• Drupal page
cache
• Optimise JS /
CSS
• Memcached
• Using the Drupal
cache
Tuning Drupal
• admin/settings/performance
• Page caching improves performance for
anonymous users
• CSS and JS aggregatio...
Tuning Drupal
Memcached
• Direct replacement for Drupal’s DB cache
• To setup:
– Install the Drupal module
– Configure set...
Tuning Drupal
Using cache_get and cache_set
• Use a static cache for simple queries
static $foo = null;
• Use cache_get an...
Adding hardware
• Separate the web server, database
server and HTTP accelerator onto their
own dedicated hardware
• Horizo...
Benchmarking
• ab
• Jmeter
• Online services
Real world performance
Real world performance
Page cache
Real world performance
Memcache
Real world performance
APC
Real world performance
Varnish
Real world performance
Summary
• Page cache: 2x - 8x
• Memcache: 2.5x
• APC: 1x - 2x
• Varnish: 50x ?
Final thoughts
• Off the shelf :
Pressflow, Zend
Community
Server
• Quick wins:
– Page cache
– Memcache
– APC
– Varnish
That’s all folks!
Image attribution - CC via Flickr
• SNAIL (nutmeg66)
http://www.flickr.com/photos/rachel_s/29060
95941/
• SCUBA - FISH SCH...
Thanks for coming!
Rate this talk
http://joind.in/620
Download slides
from slideshare
@manarth
Upcoming SlideShare
Loading in...5
×

Speeding Up The Snail

2,254

Published on

Like all frameworks, Drupal comes with a performance cost, but there are many ways to minimise that cost.

This session explores different and complementary ways to improve performance, covering topics such as caching techniques, performance tuning, and Drupal configuration.

We'll touch on benchmarking before presenting the results from applying each of the performance techniques against copies of a number of real-world Drupal sites.

Published in: Technology, Sports
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,254
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Speeding Up The Snail"

  1. 1. Speeding up the snail Marcus Deglos and making Drupal scale
  2. 2. Who is Marcus? Software engineer with Ibuildings Drupal contributor PADI scuba diving instructor
  3. 3. The problem with frameworks The cost of the framework: - include files - function calls - database queries
  4. 4. So why use Drupal? • Quicker to develop • Easier to maintain
  5. 5. Turbo-charging your site Optimising the stackTuning Drupal Adding hardware Benchmarks
  6. 6. Optimising the stack • Apache • PHP • MySQL • APC extension • Varnish
  7. 7. Apache • Pre-fork vs Worker mode • Number of servers / clients • Impact of .htaccess / AllowOverride • Impact of SuExec Optimising the stack
  8. 8. PHP • CGI vs Apache Module vc FastCGI • php.ini: – Memory limit - choose for stability – register_long_ arrays Optimising the stack
  9. 9. Database • Optimising the database – Monitoring with the slow query log – Add (and remove) indices based on usage – Consider table types: MYISAM vs INNODB • Optimising the service – Custom compilation – Configuring my.cnf • Consider your hardware Optimising the stack
  10. 10. APC • APC is an op-code cache • Install and forget? • Monitor APC use • APC tuning – APC memory usage – APC stat: checks if files are modified – APC filters Optimising the stack
  11. 11. Varnish • Varnish is an HTTP accelerator • Requires D7, Pressflow, or a patch to Drupal core • New mindset for personalising content - think ESI Optimising the stack
  12. 12. Tuning Drupal • Drupal page cache • Optimise JS / CSS • Memcached • Using the Drupal cache
  13. 13. Tuning Drupal • admin/settings/performance • Page caching improves performance for anonymous users • CSS and JS aggregation improves front-end performance Admin : performance settings
  14. 14. Tuning Drupal Memcached • Direct replacement for Drupal’s DB cache • To setup: – Install the Drupal module – Configure settings.php – Install the memcached daemon – Install the PECL extension • Minimal tuning (multiple cache ‘bins’)
  15. 15. Tuning Drupal Using cache_get and cache_set • Use a static cache for simple queries static $foo = null; • Use cache_get and cache_set for complex objects: – Multiple DB queries – Slow remote resources (e.g. SOAP)
  16. 16. Adding hardware • Separate the web server, database server and HTTP accelerator onto their own dedicated hardware • Horizontal scaling: double the hardware = double the performance? • Hunt the bottleneck • Scale with the cloud - Project Mercury
  17. 17. Benchmarking • ab • Jmeter • Online services
  18. 18. Real world performance
  19. 19. Real world performance Page cache
  20. 20. Real world performance Memcache
  21. 21. Real world performance APC
  22. 22. Real world performance Varnish
  23. 23. Real world performance Summary • Page cache: 2x - 8x • Memcache: 2.5x • APC: 1x - 2x • Varnish: 50x ?
  24. 24. Final thoughts • Off the shelf : Pressflow, Zend Community Server • Quick wins: – Page cache – Memcache – APC – Varnish
  25. 25. That’s all folks!
  26. 26. Image attribution - CC via Flickr • SNAIL (nutmeg66) http://www.flickr.com/photos/rachel_s/29060 95941/ • SCUBA - FISH SCHOOL (tobze) http://www.flickr.com/photos/tobze/2137899 342/ • BALL AND CHAIN (Fred Dawson) http://www.flickr.com/photos/fwp- dawson/520311773/ • SPOILER (icathing) http://www.flickr.com/photos/icathing/26603 225/ • SERVER RACK (Jamison_Judd) http://www.flickr.com/photos/jamisonjudd/24 33102356/ • GRAPH (tracer.ca) http://www.flickr.com/photos/tracer/3249533 12/ • STACK (Wonderlane) http://www.flickr.com/photos/wonderlane/23 63603984/ • TUNING (Crashmaster007) http://www.flickr.com/photos/crashmaster/33 44052447/ • ROAD END (Joseph Hatfield) http://www.flickr.com/photos/jhat/218880745 0/ • TORTOISE NAP (MaestroBen) http://www.flickr.com/photos/maestroben/36 9200383/ • CAMERA (Burnt Pixel) http://www.flickr.com/photos/keithwj/365098 384/ • QUESTIONS (Stefan Baudy) http://www.flickr.com/photos/- bast-/349497988/ • SERVER FARM (sugree) http://www.flickr.com/photos/sugree/302464 0027/ • CAT (fofurasfelinas) http://www.flickr.com/photos/fofurasfelinas/1 297744859/
  27. 27. Thanks for coming! Rate this talk http://joind.in/620 Download slides from slideshare @manarth

×