O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

High Performance WordPress - WordCamp Jerusalem 2010

4.118 visualizações

Publicada em

Publicada em: Tecnologia
  • Login to see the comments

High Performance WordPress - WordCamp Jerusalem 2010

  1. 1. High Performance WordPress WordCamp Jerusalem September 5, 2010
  2. 2. About Me Barry Abrahamson Systems Wrangler, Automattic http://barry.wordpress.com/contact-me/
  3. 3. WordPress.com
  4. 4. WordPress.com Launched in August 2005
  5. 5. WordPress.com Launched in August 2005 ~13.5 million sites and 16 million users today
  6. 6. WordPress.com Launched in August 2005 ~13.5 million sites and 16 million users today Over 2 billion HTTP requests per day
  7. 7. WordPress.com Launched in August 2005 ~13.5 million sites and 16 million users today Over 2 billion HTTP requests per day Billions of MySQL queries per month
  8. 8. WordPress.com Launched in August 2005 ~13.5 million sites and 16 million users today Over 2 billion HTTP requests per day Billions of MySQL queries per month 500TB of bandwidth per week
  9. 9. What is Performance?
  10. 10. What is Performance? Speed - Serve each request as quickly as possible
  11. 11. What is Performance? Speed - Serve each request as quickly as possible Scaling - Serve many concurrent requests
  12. 12. Speed
  13. 13. Speed Server
  14. 14. Speed Server Generating the content
  15. 15. Speed Server Generating the content Client
  16. 16. Speed Server Generating the content Client Downloading
  17. 17. Speed Server Generating the content Client Downloading Parsing
  18. 18. Speed Server Generating the content Client Downloading Parsing Displaying
  19. 19. Speed Server Generating the content Client Downloading Parsing Displaying
  20. 20. Client Side Performance
  21. 21. Client Side Performance 80%+ of the total load time
  22. 22. Client Side Performance 80%+ of the total load time Tools
  23. 23. Client Side Performance 80%+ of the total load time Tools YSlow - http://developer.yahoo.com/yslow/
  24. 24. Client Side Performance 80%+ of the total load time Tools YSlow - http://developer.yahoo.com/yslow/ Page Speed - http://code.google.com/speed/ page-speed/
  25. 25. Client Side Performance
  26. 26. Client Side Performance Reduce number of HTTP Requests
  27. 27. Client Side Performance Reduce number of HTTP Requests Compress (gzip)
  28. 28. Client Side Performance Reduce number of HTTP Requests Compress (gzip) Optimize images (resize, pngcrush, jpegtran)
  29. 29. Server Side Performance
  30. 30. Server Side Performance More important than client side performance
  31. 31. Server Side Performance More important than client side performance Tools aren’t as advanced / fancy as client tools
  32. 32. Server Side Performance
  33. 33. Server Side Performance Possible problems
  34. 34. Server Side Performance Possible problems Slow database queries
  35. 35. Server Side Performance Possible problems Slow database queries PHP (CPU)
  36. 36. Server Side Performance Possible problems Slow database queries PHP (CPU) Network
  37. 37. Server Side Performance Possible problems Slow database queries PHP (CPU) Network Tools
  38. 38. Server Side Performance Possible problems Slow database queries PHP (CPU) Network Tools WordPress Plugins - Search for “debug”
  39. 39. WordPress.com Debug Tools
  40. 40. Server Side Performance
  41. 41. Server Side Performance Tools
  42. 42. Server Side Performance Tools MySQL Slow query log
  43. 43. Server Side Performance Tools MySQL Slow query log http://www.maatkit.org/doc/mk-query-digest.html
  44. 44. Server Side Performance Tools MySQL Slow query log http://www.maatkit.org/doc/mk-query-digest.html Strace / lsof / gdb
  45. 45. Server Side Performance Tools MySQL Slow query log http://www.maatkit.org/doc/mk-query-digest.html Strace / lsof / gdb Many times plugins are the culprit.
  46. 46. How can I improve performance?
  47. 47. As a User
  48. 48. As a User Make sure you are running the latest WordPress!
  49. 49. As a User Make sure you are running the latest WordPress! Constant performance improvements being made. Many from things found on WordPress.com
  50. 50. As a User Make sure you are running the latest WordPress! Constant performance improvements being made. Many from things found on WordPress.com Show a reasonable number of posts per page. 10-25 seems to be good
  51. 51. As a User Make sure you are running the latest WordPress! Constant performance improvements being made. Many from things found on WordPress.com Show a reasonable number of posts per page. 10-25 seems to be good Monitor site performance
  52. 52. As a Sysadmin
  53. 53. As a Sysadmin Opcode cache (APC)
  54. 54. As a Sysadmin Opcode cache (APC) Caching plugins (Batcache, WP super cache)
  55. 55. As a Sysadmin Opcode cache (APC) Caching plugins (Batcache, WP super cache) Make sure you are running the latest PHP
  56. 56. As a Sysadmin Opcode cache (APC) Caching plugins (Batcache, WP super cache) Make sure you are running the latest PHP HipHop
  57. 57. As a Sysadmin Opcode cache (APC) Caching plugins (Batcache, WP super cache) Make sure you are running the latest PHP HipHop Apache + mod_php < Nginx + php-fpm.
  58. 58. Real World Numbers
  59. 59. Real World Numbers APC
  60. 60. Real World Numbers APC Empty cache - 33.5 MB RAM
  61. 61. Real World Numbers APC Empty cache - 33.5 MB RAM Primed cache - 6.2 MB RAM
  62. 62. Real World Numbers APC Empty cache - 33.5 MB RAM Primed cache - 6.2 MB RAM 60% reduction in CPU utilization ( 2160 CPUs )
  63. 63. Real World Numbers APC Empty cache - 33.5 MB RAM Primed cache - 6.2 MB RAM 60% reduction in CPU utilization ( 2160 CPUs ) PHP 5.3.3 10% CPU reduction ( 360 CPUs )
  64. 64. Real World Numbers
  65. 65. Real World Numbers HipHop
  66. 66. Real World Numbers HipHop 40% faster ( http://huichen.org/en/2010/06/ wordpress-3-benchmark/ )
  67. 67. Real World Numbers HipHop 40% faster ( http://huichen.org/en/2010/06/ wordpress-3-benchmark/ ) 270% faster ( http://huichen.org/en/2010/06/ wordpress-3-benchmark-part-2/ )
  68. 68. Real World Numbers
  69. 69. Apache + mod_php 1 request requiring php Using mod_php, php is loaded for every request even if not needed Most scaling problems are because of this
  70. 70. As a Developer
  71. 71. As a Developer Only perform write operations when needed. Example is flushing rewrite rules on every page load
  72. 72. As a Developer Only perform write operations when needed. Example is flushing rewrite rules on every page load Use WordPress functions when possible.
  73. 73. WordPress.com
  74. 74. WordPress.com ~ 1100 servers in 3 datacenters ~ 450 web servers (8 CPU cores) ~ 400 database servers (lots of SSDs) ~ 75 memcached servers (800GB of RAM)
  75. 75. Scaling Tips
  76. 76. Scaling Tips Most things you do to scale WordPress apply to any web app
  77. 77. Scaling Tips Most things you do to scale WordPress apply to any web app If your bottleneck is the database, something is wrong
  78. 78. Scaling Tips Most things you do to scale WordPress apply to any web app If your bottleneck is the database, something is wrong Measure twice, cut once, measure again
  79. 79. Scaling Tips Most things you do to scale WordPress apply to any web app If your bottleneck is the database, something is wrong Measure twice, cut once, measure again Don’t optimize if you don’t need to
  80. 80. Questions?

×