Your SlideShare is downloading. ×
Site Performance - From Pinto to Ferrari
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Site Performance - From Pinto to Ferrari

5,496
views

Published on

Published in: Technology

1 Comment
7 Likes
Statistics
Notes
No Downloads
Views
Total Views
5,496
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
41
Comments
1
Likes
7
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Hello
    • 2. This Slide Intentionally Left Blank
    • 3. This One Too
    • 4. Site Performancefrom Pinto to Ferrari Joseph Scott joseph@josephscott.org http://josephscott.org/
    • 5. Find Mehttp://josephscott.org/joseph@josephscott.org@josephscott
    • 6. The Pinto
    • 7. http://www.flickr.com/photos/autohistorian/4439476737/
    • 8. http://www.flickr.com/photos/autohistorian/4439476737/
    • 9. http://www.flickr.com/photos/thomashawk/2466245846/
    • 10. http://www.flickr.com/photos/autohistorian/4439476737/
    • 11. http://www.flickr.com/photos/autohistorian/4439476737/
    • 12. http://www.flickr.com/photos/autohistorian/4439476737/
    • 13. http://www.flickr.com/photos/autohistorian/4439476737/
    • 14. http://www.flickr.com/photos/autohistorian/4439476737/
    • 15. The Ferrari
    • 16. Steve Soudershttp://stevesouders.com/
    • 17. 2007
    • 18. 2009
    • 19. Why Did I Choose This Topic?
    • 20. I Want My Site To Be Faster
    • 21. I Want My Site To Be Faster Less Like A Pinto
    • 22. I Want My Site To Be Faster More Like A Ferrari
    • 23. How Fast Is It Now?
    • 24. How Fast Is It Now?Tools For Measuring Site Performance
    • 25. Toolswebpagetest.orgpagespeed.googlelabs.comFirefox & FirebugChrome/Safari & Dev ToolsHttpWatch
    • 26. Where To Start?
    • 27. Where To Start?http://www.webpagetest.org/
    • 28. webpagetest.orgTest LocationBrowserConnection SpeedVideo
    • 29. Browsers IE 8 still most commonly used browser (26.5% / 28.5%)http://gs.statcounter.com/#browser_version-na-monthly-201106-201108-bar
    • 30. Connection Speed FIOS 20Mbps
    • 31. http://www.webpagetest.org/result/110827_KZ_1EBDB/1/details/
    • 32. Which Part?
    • 33. The Initial RequestGet the source for the page
    • 34. The Initial RequestGet the source 0.113 seconds for the page
    • 35. The Initial RequestDNS Lookup: 5 msInitial Connection: 47 msTime to First Byte: 57 msContent Download: 4 msBytes In (downloaded): 9.6 KBBytes Out (uploaded): 0.4 KB
    • 36. Requests Per PageNovember 2010: 69August 2011: 76http://www.stevesouders.com/blog/2011/08/17/http-archive-nine-months/
    • 37. Thinking Clearly About Performancehttp://carymillsap.blogspot.com/2010/02/thinking- clearly-about-performance.html
    • 38. Average LiesList A List B0.924 0.7960.928 0.7980.954 0.8020.957 0.8230.961 0.9190.965 0.9770.972 1.0760.979 1.2160.987 1.2731.373 1.320 pg3, Exhibit 1
    • 39. Aim For Consistent Performance
    • 40. Know Your LimitsCalculate the theoretical best performance for your setup
    • 41. Know Your LimitsCalculate the theoretical best performance for your setup What ever you actually end up with will be slower than that
    • 42. Moving Up The Stack
    • 43. The Stack Network
    • 44. The StackServer Hardware Network
    • 45. The StackOperating SystemServer Hardware Network
    • 46. The StackHTTP Operating System Server Hardware Network
    • 47. The StackHTTP PHP Operating System Server Hardware Network
    • 48. The StackHTTP PHP MySQL Operating System Server Hardware Network
    • 49. The Stack WordPressHTTP PHP MySQL Operating System Server Hardware Network
    • 50. The Stack WordPressHTTP PHP MySQL Operating System Server Hardware Network
    • 51. HTTP - The Web ServerApache remove any modules you aren’t using turn off host name lookups turn off FollowSymLinks turn off .htaccess (if you can) turn on compression (mod_deflate) tweak MaxClients
    • 52. HTTP - The Web Server Apache - mod_pagespeedhttp://code.google.com/speed/page-speed/docs/module.html http://code.google.com/p/modpagespeed/
    • 53. HTTP - The Web ServerConsider Alternatives Nginx
    • 54. HTTP - The Web Server HTTP Compression Keep-alive supportCorrectly Configured Caching
    • 55. ETag SurveyHTTP/1.1 200 OKETag: "cd7ac991ff11"
    • 56. ETag SurveyIf-None-Match: "cd7ac991ff11"HTTP/1.1 304 NOT MODIFIED
    • 57. ETag SurveyETags used by 136 of the top 1,000 U.S. sites http://josephscott.org/archives/2011/09/etag-survey/
    • 58. ETag SurveyOf the 136 sites using ETags: 54 Worked Correctly (39.7%) 11 Sort of Worked (8%) 71 Broken/Useless (52.2%)
    • 59. Understanding PHP
    • 60. Understanding PHP Lifespan.phpRead Parse Compile Execute Output
    • 61. Understanding PHP Lifespan.phpRead Parse Compile Execute Output Apache / mod_php
    • 62. Understanding PHP.php LifespanRead Parse Compile Execute Output FastCGI Nginx
    • 63. ReadingOpen Read Close
    • 64. ReadingOpen Read Close Avoid co$tly services like NFS
    • 65. Parsehello.php <?php echo "Hello, World!n"Parse error: syntax error, unexpected $end,expecting , or ; in /tmp/hello.php on line 3
    • 66. Tokens <?php echo$tokens = token_get_all( "Hello, World!"; );
    • 67. foreach ( $tokens as $token ) {    if ( is_array( $token ) ) {        echo token_name( $token[0] ) . " ( {$token[2]} ) - {$token[1]}n";    } else {        echo "{$token}n";    }}
    • 68. T_OPEN_TAG ( 1 ) - <?phpT_ECHO ( 1 ) - echoT_WHITESPACE ( 1 ) -T_CONSTANT_ENCAPSED_STRING ( 1 ) - "Hello, World!";
    • 69. Compile
    • 70. Branch analysis from position: 0Return foundfilename: /tmp/hello.phpfunction name: (null)number of ops: 3compiled vars: noneline # op fetch ext return operands------------------------------------------------------------------------------- 2 0 ECHO Hello%2C+World%21%0A 3 1 RETURN 1 2* ZEND_HANDLE_EXCEPTION
    • 71. ExecuteDeceptively Simple Term•Includes all sorts of activity•Database / remote requests
    • 72. Output•PHP can buffer output•Don’t forget about compression
    • 73. Making PHP Faster
    • 74. Making PHP Faster.phpRead Parse Compile Execute Output
    • 75. Making PHP Faster.phpRead APC Parse Compile Execute Output
    • 76. Making PHP Faster.phpRead APC Parse Compile Execute Output opcode cache
    • 77. PHP - opcode caching APCrequests per second - increased 4x time per request - decreased 4x
    • 78. Use An Opcode Cache (APC)
    • 79. Use An Opcode Cache (APC)!
    • 80. APC == Free Money
    • 81. APC == Free Money
    • 82. PHPuse an opcode cache (APC)use newer versionsdon’t use on static files (unless you really need to)consider output bufferingbe careful with preg_* functionsprofile your running code (Xdebug, VLD)don’t re-invent native PHP functions, they are likelyfaster than yours
    • 83. The Stack WordPressHTTP PHP MySQL Operating System Server Hardware Network
    • 84. MySQLuse InnoDB table type (unless you have areally good reason not to)use the slow query loguse EXPLAIN on queries, learnwhat the output meansdouble triple check your indexeslearn about quirks
    • 85. The Stack WordPressHTTP PHP MySQL Operating System Server Hardware Network
    • 86. Memcached“Free & open source, high-performance,distributed memory object cachingsystem” in memory only, won’t survive a reboot key/value data store http://memcached.org/
    • 87. WordPress + Memcached Memcached Object Cache Persistent data store for WordPress objects Reduces the number of database querieshttp://wordpress.org/extend/plugins/memcached/
    • 88. I’m Batcache
    • 89. WordPress + Memcached Batcache Persistent data store for rendered pageshttp://wordpress.org/extend/plugins/batcache/
    • 90. WordPress Caching - Alternatives WP Super Cache http://wordpress.org/extend/plugins/wp-super-cache/ W3 Total Cache http://wordpress.org/extend/plugins/w3-total-cache/
    • 91. But Wait, There’s More!
    • 92. MySQL ReplicationMaster / Slave one way, asynchronous send writes to the master send reads to the slave supports multiple slaves, and chaining
    • 93. WordPress + HyperDB Drop in replacement for default DB class distributed reads and writes partition datahttp://wordpress.org/extend/plugins/hyperdb/
    • 94. What Could This Look Like?
    • 95. What Could This Look Like?Net web & database
    • 96. What Could This Look Like?Net db web
    • 97. What Could This Look Like? dbNet web memcached
    • 98. What Could This Look Like? db dbNet web memcached memcached
    • 99. What Could This Look Like? web db db load webbalancer web memcached memcached
    • 100. Variationsslave just for backupsmultiple data centerstask specific web servers
    • 101. When Things Go Wrong
    • 102. Hire an Amazing SysAdmin
    • 103. Questions?
    • 104. Find Mehttp://josephscott.org/joseph@josephscott.org@josephscott