High Performance WordPress II

6,673 views
6,465 views

Published on

High Performance WordPress Presentation from WordCamp Orlando 2009

Published in: Technology, Business

High Performance WordPress II

  1. 1. High Performance WordPress II Fast and secure
  2. 2. What I LOVE About WordPress
  3. 3. About Me • Barry Abrahamson • Systems Wrangler, Automattic • http://barry.wordpress.com/contact-me/
  4. 4. WordPress.com
  5. 5. WordPress.com • Launched in August 2005
  6. 6. WordPress.com • Launched in August 2005 • ~9 million blogs today
  7. 7. WordPress.com • Launched in August 2005 • ~9 million blogs today • Billions of HTTP requests per day
  8. 8. WordPress.com • Launched in August 2005 • ~9 million blogs today • Billions of HTTP requests per day • Billions of MySQL queries per month
  9. 9. What is Performance?
  10. 10. What is Performance? • Fast
  11. 11. What is Performance? • Fast • Scalable
  12. 12. What is Performance? • Fast • Scalable • Secure
  13. 13. Lifecycle
  14. 14. Lifecycle • Shared hosting ( 95% )
  15. 15. Lifecycle • Shared hosting ( 95% ) • VPS (Virtual Private Server) ( < 5% )
  16. 16. Lifecycle • Shared hosting ( 95% ) • VPS (Virtual Private Server) ( < 5% ) • Dedicated Server ( < 2% )
  17. 17. Lifecycle • Shared hosting ( 95% ) • VPS (Virtual Private Server) ( < 5% ) • Dedicated Server ( < 2% ) • 2 Dedicated Servers ( < 1% )
  18. 18. Lifecycle • Shared hosting ( 95% ) • VPS (Virtual Private Server) ( < 5% ) • Dedicated Server ( < 2% ) • 2 Dedicated Servers ( < 1% ) • > 2 Dedicated Servers ( < 1% )
  19. 19. Upgrade!
  20. 20. Shared Hosting
  21. 21. Shared Hosting • FTP access (maybe SSH/SFTP)
  22. 22. Shared Hosting • FTP access (maybe SSH/SFTP) • No server management overhead
  23. 23. Shared Hosting • FTP access (maybe SSH/SFTP) • No server management overhead • Less control and fewer options
  24. 24. Shared Hosting • FTP access (maybe SSH/SFTP) • No server management overhead • Less control and fewer options • Cheap! ($4 - $20/month)
  25. 25. Shared Hosting
  26. 26. Shared Hosting • Run the latest version of WordPress (easy)
  27. 27. Shared Hosting • Run the latest version of WordPress (easy) • http://wordpress.org/hosting/
  28. 28. Shared Hosting • Run the latest version of WordPress (easy) • http://wordpress.org/hosting/ • Plugins and Themes directory - http:// wordpress.org/extend/
  29. 29. Shared Hosting
  30. 30. Shared Hosting • WP Super Cache
  31. 31. Shared Hosting • WP Super Cache • 25 - 50x capacity/throughput increase
  32. 32. Shared Hosting • WP Super Cache • 25 - 50x capacity/throughput increase • Digg, Slashdot,Yahoo Buzz
  33. 33. VPS
  34. 34. VPS • Virtual Private Server
  35. 35. VPS • Virtual Private Server • Between shared and dedicated
  36. 36. VPS • Virtual Private Server • Between shared and dedicated • Specific resources allocated to you (good and bad)
  37. 37. VPS • Virtual Private Server • Between shared and dedicated • Specific resources allocated to you (good and bad) • Usually have shell “root” access
  38. 38. VPS • Virtual Private Server • Between shared and dedicated • Specific resources allocated to you (good and bad) • Usually have shell “root” access • $20 - $50 / month
  39. 39. VPS
  40. 40. VPS • Run the latest version of WordPress
  41. 41. VPS • Run the latest version of WordPress • WP Super Cache
  42. 42. VPS • Run the latest version of WordPress • WP Super Cache • PHP Opcode Cache (APC)
  43. 43. VPS • Run the latest version of WordPress • WP Super Cache • PHP Opcode Cache (APC) • WordPress persistent object cache
  44. 44. VPS • Apache alternatives • CDN
  45. 45. 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
  46. 46. VPS
  47. 47. VPS • Apache alternatives
  48. 48. VPS • Apache alternatives • CDN
  49. 49. VPS • Apache alternatives • CDN • W3 Total Cache
  50. 50. VPS • Apache alternatives • CDN • W3 Total Cache • MySQL tweaking ( http:// blog.mysqltuner.com/ )
  51. 51. Dedicated Server
  52. 52. Dedicated Server • Full control
  53. 53. Dedicated Server • Full control • Lots of responsibility
  54. 54. Dedicated Server • Full control • Lots of responsibility • Sysadmining required
  55. 55. Dedicated Server • Full control • Lots of responsibility • Sysadmining required • Can be expensive ($100 - $1000 /month)
  56. 56. 2 Servers
  57. 57. 2 Servers • Relatively easy to implement
  58. 58. 2 Servers • Relatively easy to implement • 1 web server, 1 database server
  59. 59. 2 Servers • Relatively easy to implement • 1 web server, 1 database server • Web + database on each
  60. 60. 2 Servers • Relatively easy to implement • 1 web server, 1 database server • Web + database on each • Isolated resources
  61. 61. 2 Servers • Relatively easy to implement • 1 web server, 1 database server • Web + database on each • Isolated resources • Same as single server from an application perspective but now you have to worry about network bottlenecks
  62. 62. Server Farm
  63. 63. Server Farm • HyperDB
  64. 64. Server Farm • HyperDB • Object cache with memcached backend
  65. 65. Server Farm • HyperDB • Object cache with memcached backend • Can’t use file-based caches anymore
  66. 66. Server Farm • HyperDB • Object cache with memcached backend • Can’t use file-based caches anymore • Nananana...Batcache
  67. 67. Server Farm
  68. 68. Server Farm • Load Balancer - nginx
  69. 69. Server Farm • Load Balancer - nginx • Web Server - nginx
  70. 70. Server Farm • Load Balancer - nginx • Web Server - nginx • PHP - php-fpm (now an official PHP project!)
  71. 71. Server Farm • Load Balancer - nginx • Web Server - nginx • PHP - php-fpm (now an official PHP project!) • Database - Basic MySQL replication, leave all the complicated stuff to HyperDB.
  72. 72. Server Farm
  73. 73. Server Farm • High availability using spread and wackamole
  74. 74. Server Farm • High availability using spread and wackamole • Scaling from 3 to 300 is relatively easy compared to scaling from 2 to 3.
  75. 75. WordPress.com • ~ 850 servers in 3 datacenters • ~ 350 web servers • ~ 300 database servers • ~ 60 memcached servers (800GB of RAM)
  76. 76. Real World Numbers • APC • Empty cache - 33.5 MB RAM • Primed cache - 6.2 MB RAM • 60% reduction in CPU utilization • 210 8-core servers on WordPress.com
  77. 77. Scaling Tips
  78. 78. Scaling Tips • Most (all) things you do to scale WordPress apply to any web app
  79. 79. Scaling Tips • Most (all) things you do to scale WordPress apply to any web app • If your bottleneck is the database, something is wrong
  80. 80. Scaling Tips • Most (all) 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
  81. 81. Scaling Tips • Most (all) 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
  82. 82. Questions?

×