PERFORMANCE & SCALABILITY      Where to Begin                            Brandon Lyon
Performance & Scalability                Define the Objective
Performance & Scalability                Define the Objective                    Minimize HTTP                     Reque...
Performance & Scalability                Define the Objective                    Minimize HTTP                     Reque...
Performance & Scalability                Define the Objective                    Minimize HTTP                     Reque...
Performance & Scalability                Define the Objective                    Minimize HTTP                     Reque...
Performance & Scalability                Define the Objective                    Minimize HTTP                     Reque...
Minimizing HTTP Requests               Aggregate &                Compress CSS Files
Minimizing HTTP Requests               Aggregate &                Compress CSS Files               Aggregate            ...
Minimizing HTTP Requests               Aggregate &                Compress CSS Files               Aggregate            ...
Performance & Scalability                Define the Objective                    Minimize HTTP                     Reque...
Minimize Server Processing   Alternative PHP    Cache (APC)   Memcached   Varnish Cache
Alternative PHP Cache (APC)   Make sure youve allocated enough memory.    apc.shm_segments=1    apc.shm_size=32   Check ...
Memcached   Basic Implementation    # memcached -m 24 -p 11211 -d    $conf = array(     memcache_servers => array(       ...
Memcached   Server Cluster?    $conf = array(     memcache_servers => array(          host1:port => cluster,          hos...
Varnish Cache   Toss your cookies!                                      Define Exceptions    if (req.url !~ "^/blog/.*/"...
Performance & Scalability                Define the Objective                    Minimize HTTP                     Reque...
Optimize Server Processing   Identify the Problem
Optimize Server Processing   Identify the Problem                           FIX IT
Optimize Server Processing   Identifying the Problem Areas       Network       Linux       Apache       MySQL       ...
Optimize Server Processing   Identifying the Problem Areas       Network       Linux       Apache       MySQL       ...
Optimize Server Processing   Performance Profiling       Apache Benchmarking (ab)       MySQL Slow Query Log & Profilin...
Apache Benchmarking (ab)# ab -n 100 -c 10 http://d7.blyon.lan/                      10 Concurrent Requests               ...
Apache Benchmarking (ab)   Compress Cached Pages   Aggregate and Compress CSS files   Aggregate JavaScript files
Apache Benchmarking (ab)# ab -n 100 -c 10 http://d7.blyon.lan/                      10 Concurrent Requests               ...
Apache Benchmarking (ab)   Install APC   Install APC Drupal Module
Apache Benchmarking (ab)# ab -n 100 -c 10 http://d7.blyon.lan/                      10 Concurrent Requests               ...
Optimize Server Processing   Performance Profiling       Apache Benchmarking (ab)       MySQL Slow Query Log & Profilin...
MySQL Slow Query Log/etc/mysql/my.cnf  log_slow_queries = /var/log/mysql/mysql-slow.log  long_query_time = 1# tail -f /var...
Optimize Server Processing   Performance Profiling       Apache Benchmarking (ab)       MySQL Slow Query Log & Profilin...
PHP Xdebug & KCachegrind   Xdebug Features       Stack Traces & Function Traces in Error        Messages       Memory A...
PHP Xdebug & KCachegrind   Xdebug Configuration       zend_extension="/usr/local/php/modules/xdebug.so"       xdebug.pr...
PHP Xdebug & KCachegrind   Kcachegrind       Profile data Visualization tool       Accepts ”Callgrind Profile” formatte...
PHP Xdebug & KCachegrind
Now FIX IT
Performance & Scalability                Define the Objective                    Minimize HTTP                     Reque...
Optimizing the Databasehttp://day32.com/MySQL/tuning-primer.sh   Analyzes current my.cnf   Analyzes resource usage   An...
PERFORMANCE & SCALABILITY      Where to Begin                            Brandon Lyon
Upcoming SlideShare
Loading in …5
×

Performance scalability brandonlyon

1,209 views

Published on

At SandCamp 2011, Brandon Lyon spoke about Performance & Scalability for Drupal websites. Unlike most Performance & Scalability talks he didn't just talk about the different resources available to enhance your site, but also gave instructions on how to identify the problem areas on your site as well. Brandon covered everything from the many layers of caching, to optimizing PHP, Apache, and MySQL and how to measure the performance of each in the following presentation.

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

No Downloads
Views
Total views
1,209
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Performance scalability brandonlyon

  1. 1. PERFORMANCE & SCALABILITY Where to Begin Brandon Lyon
  2. 2. Performance & Scalability  Define the Objective
  3. 3. Performance & Scalability  Define the Objective  Minimize HTTP Requests
  4. 4. Performance & Scalability  Define the Objective  Minimize HTTP Requests  Minimize Server Processing
  5. 5. Performance & Scalability  Define the Objective  Minimize HTTP Requests  Minimize Server Processing  Optimize Server Processing
  6. 6. Performance & Scalability  Define the Objective  Minimize HTTP Requests  Minimize Server Processing  Optimize Server Processing  Optimize the Database
  7. 7. Performance & Scalability  Define the Objective  Minimize HTTP Requests  Minimize Server Processing  Optimize Server Processing  Optimize the Database
  8. 8. Minimizing HTTP Requests  Aggregate & Compress CSS Files
  9. 9. Minimizing HTTP Requests  Aggregate & Compress CSS Files  Aggregate JavaScript Files
  10. 10. Minimizing HTTP Requests  Aggregate & Compress CSS Files  Aggregate JavaScript Files  Image Sprites
  11. 11. Performance & Scalability  Define the Objective  Minimize HTTP Requests  Minimize Server Processing  Optimize Server Processing  Optimize the Database
  12. 12. Minimize Server Processing Alternative PHP Cache (APC) Memcached Varnish Cache
  13. 13. Alternative PHP Cache (APC) Make sure youve allocated enough memory. apc.shm_segments=1 apc.shm_size=32 Check your script files on every request? apc.stat=0 Memory Fragmentation? apc.ttl=0
  14. 14. Memcached Basic Implementation # memcached -m 24 -p 11211 -d $conf = array( memcache_servers => array( localhost:11211 => default, ), memcache_bins => array( cache => default, ),
  15. 15. Memcached Server Cluster? $conf = array( memcache_servers => array( host1:port => cluster, hostN:port => cluster, ), memcache_bins => array( bin1 => cluster, binN => cluster, ),
  16. 16. Varnish Cache Toss your cookies!  Define Exceptions if (req.url !~ "^/blog/.*/") { if (req.url ~ "install.php|update.php") { set req.http.Cookie = return(pass); regsuball(req.http.Cookie, "comment_.*", ""); } }
  17. 17. Performance & Scalability  Define the Objective  Minimize HTTP Requests  Minimize Server Processing  Optimize Server Processing  Optimize the Database
  18. 18. Optimize Server Processing Identify the Problem
  19. 19. Optimize Server Processing Identify the Problem FIX IT
  20. 20. Optimize Server Processing Identifying the Problem Areas  Network  Linux  Apache  MySQL  PHP
  21. 21. Optimize Server Processing Identifying the Problem Areas  Network  Linux  Apache  MySQL  PHP
  22. 22. Optimize Server Processing Performance Profiling  Apache Benchmarking (ab)  MySQL Slow Query Log & Profiling  PHP Xdebug & KCachegrind
  23. 23. Apache Benchmarking (ab)# ab -n 100 -c 10 http://d7.blyon.lan/  10 Concurrent Requests  100 Requests  7.35 Requests/Second  50% of Requests served in under 1352ms
  24. 24. Apache Benchmarking (ab) Compress Cached Pages Aggregate and Compress CSS files Aggregate JavaScript files
  25. 25. Apache Benchmarking (ab)# ab -n 100 -c 10 http://d7.blyon.lan/  10 Concurrent Requests  100 Requests  46.32 Requests/Second  50% of Requests served in under 213ms
  26. 26. Apache Benchmarking (ab) Install APC Install APC Drupal Module
  27. 27. Apache Benchmarking (ab)# ab -n 100 -c 10 http://d7.blyon.lan/  10 Concurrent Requests  100 Requests  648.77 Requests/Second  50% of Requests served in under 12ms
  28. 28. Optimize Server Processing Performance Profiling  Apache Benchmarking (ab)  MySQL Slow Query Log & Profiling  PHP Xdebug & KCachegrind
  29. 29. MySQL Slow Query Log/etc/mysql/my.cnf log_slow_queries = /var/log/mysql/mysql-slow.log long_query_time = 1# tail -f /var/log/mysql/mysql-slow.log # User@Host: root[root] @ localhost [] # Query_time: 0.000427 Lock_time: 0.000037 Rows_sent: 50 Rows_examined: 50 SET timestamp=1294541182; select * from node;
  30. 30. Optimize Server Processing Performance Profiling  Apache Benchmarking (ab)  MySQL Slow Query Log & Profiling  PHP Xdebug & KCachegrind
  31. 31. PHP Xdebug & KCachegrind Xdebug Features  Stack Traces & Function Traces in Error Messages  Memory Allocation  Infinite Recursion Protection  PHP Profiling  Code Coverage Analysis  Interactive Debugging support
  32. 32. PHP Xdebug & KCachegrind Xdebug Configuration  zend_extension="/usr/local/php/modules/xdebug.so"  xdebug.profiler_enable_trigger = 1 Xdebug Usage  Append ”?XDEBUG_PROFILE=1” to URL  View cachegrind compatible profile log /tmp/cachegrind.out.10362
  33. 33. PHP Xdebug & KCachegrind Kcachegrind  Profile data Visualization tool  Accepts ”Callgrind Profile” formatted data  Requires KDE Libraries
  34. 34. PHP Xdebug & KCachegrind
  35. 35. Now FIX IT
  36. 36. Performance & Scalability  Define the Objective  Minimize HTTP Requests  Minimize Server Processing  Optimize Server Processing  Optimize the Database
  37. 37. Optimizing the Databasehttp://day32.com/MySQL/tuning-primer.sh Analyzes current my.cnf Analyzes resource usage Analyzes Caching Analyzes Tables and Queries Generates recommended my.cnf
  38. 38. PERFORMANCE & SCALABILITY Where to Begin Brandon Lyon

×