• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Site Performance - From Pinto to Ferrari
 

Site Performance - From Pinto to Ferrari

on

  • 5,336 views

 

Statistics

Views

Total Views
5,336
Views on SlideShare
3,146
Embed Views
2,190

Actions

Likes
7
Downloads
39
Comments
1

7 Embeds 2,190

http://josephscott.org 2179
http://translate.googleusercontent.com 6
http://www.slideshare.net 1
https://www.facebookfirewall.com 1
http://213.8.145.171:82 1
http://web-notes.net 1
http://207.46.192.232 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \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

Site Performance - From Pinto to Ferrari Site Performance - From Pinto to Ferrari Presentation Transcript

  • Hello
  • This Slide Intentionally Left Blank
  • This One Too
  • Site Performancefrom Pinto to Ferrari Joseph Scott joseph@josephscott.org http://josephscott.org/
  • Find Mehttp://josephscott.org/joseph@josephscott.org@josephscott
  • The Pinto
  • http://www.flickr.com/photos/autohistorian/4439476737/
  • http://www.flickr.com/photos/autohistorian/4439476737/
  • http://www.flickr.com/photos/thomashawk/2466245846/
  • http://www.flickr.com/photos/autohistorian/4439476737/
  • http://www.flickr.com/photos/autohistorian/4439476737/
  • http://www.flickr.com/photos/autohistorian/4439476737/
  • http://www.flickr.com/photos/autohistorian/4439476737/
  • http://www.flickr.com/photos/autohistorian/4439476737/
  • The Ferrari
  • Steve Soudershttp://stevesouders.com/
  • 2007
  • 2009
  • Why Did I Choose This Topic?
  • I Want My Site To Be Faster
  • I Want My Site To Be Faster Less Like A Pinto
  • I Want My Site To Be Faster More Like A Ferrari
  • How Fast Is It Now?
  • How Fast Is It Now?Tools For Measuring Site Performance
  • Toolswebpagetest.orgpagespeed.googlelabs.comFirefox & FirebugChrome/Safari & Dev ToolsHttpWatch
  • Where To Start?
  • Where To Start?http://www.webpagetest.org/
  • webpagetest.orgTest LocationBrowserConnection SpeedVideo
  • Browsers IE 8 still most commonly used browser (26.5% / 28.5%)http://gs.statcounter.com/#browser_version-na-monthly-201106-201108-bar
  • Connection Speed FIOS 20Mbps
  • http://www.webpagetest.org/result/110827_KZ_1EBDB/1/details/
  • Which Part?
  • The Initial RequestGet the source for the page
  • The Initial RequestGet the source 0.113 seconds for the page
  • 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
  • Requests Per PageNovember 2010: 69August 2011: 76http://www.stevesouders.com/blog/2011/08/17/http-archive-nine-months/
  • Thinking Clearly About Performancehttp://carymillsap.blogspot.com/2010/02/thinking- clearly-about-performance.html
  • 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
  • Aim For Consistent Performance
  • Know Your LimitsCalculate the theoretical best performance for your setup
  • Know Your LimitsCalculate the theoretical best performance for your setup What ever you actually end up with will be slower than that
  • Moving Up The Stack
  • The Stack Network
  • The StackServer Hardware Network
  • The StackOperating SystemServer Hardware Network
  • The StackHTTP Operating System Server Hardware Network
  • The StackHTTP PHP Operating System Server Hardware Network
  • The StackHTTP PHP MySQL Operating System Server Hardware Network
  • The Stack WordPressHTTP PHP MySQL Operating System Server Hardware Network
  • The Stack WordPressHTTP PHP MySQL Operating System Server Hardware Network
  • 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
  • HTTP - The Web Server Apache - mod_pagespeedhttp://code.google.com/speed/page-speed/docs/module.html http://code.google.com/p/modpagespeed/
  • HTTP - The Web ServerConsider Alternatives Nginx
  • HTTP - The Web Server HTTP Compression Keep-alive supportCorrectly Configured Caching
  • ETag SurveyHTTP/1.1 200 OKETag: "cd7ac991ff11"
  • ETag SurveyIf-None-Match: "cd7ac991ff11"HTTP/1.1 304 NOT MODIFIED
  • ETag SurveyETags used by 136 of the top 1,000 U.S. sites http://josephscott.org/archives/2011/09/etag-survey/
  • ETag SurveyOf the 136 sites using ETags: 54 Worked Correctly (39.7%) 11 Sort of Worked (8%) 71 Broken/Useless (52.2%)
  • Understanding PHP
  • Understanding PHP Lifespan.phpRead Parse Compile Execute Output
  • Understanding PHP Lifespan.phpRead Parse Compile Execute Output Apache / mod_php
  • Understanding PHP.php LifespanRead Parse Compile Execute Output FastCGI Nginx
  • ReadingOpen Read Close
  • ReadingOpen Read Close Avoid co$tly services like NFS
  • Parsehello.php <?php echo "Hello, World!n"Parse error: syntax error, unexpected $end,expecting , or ; in /tmp/hello.php on line 3
  • Tokens <?php echo$tokens = token_get_all( "Hello, World!"; );
  • foreach ( $tokens as $token ) {    if ( is_array( $token ) ) {        echo token_name( $token[0] ) . " ( {$token[2]} ) - {$token[1]}n";    } else {        echo "{$token}n";    }}
  • T_OPEN_TAG ( 1 ) - <?phpT_ECHO ( 1 ) - echoT_WHITESPACE ( 1 ) -T_CONSTANT_ENCAPSED_STRING ( 1 ) - "Hello, World!";
  • Compile
  • 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
  • ExecuteDeceptively Simple Term•Includes all sorts of activity•Database / remote requests
  • Output•PHP can buffer output•Don’t forget about compression
  • Making PHP Faster
  • Making PHP Faster.phpRead Parse Compile Execute Output
  • Making PHP Faster.phpRead APC Parse Compile Execute Output
  • Making PHP Faster.phpRead APC Parse Compile Execute Output opcode cache
  • PHP - opcode caching APCrequests per second - increased 4x time per request - decreased 4x
  • Use An Opcode Cache (APC)
  • Use An Opcode Cache (APC)!
  • APC == Free Money
  • APC == Free Money
  • 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
  • The Stack WordPressHTTP PHP MySQL Operating System Server Hardware Network
  • 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
  • The Stack WordPressHTTP PHP MySQL Operating System Server Hardware Network
  • 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/
  • WordPress + Memcached Memcached Object Cache Persistent data store for WordPress objects Reduces the number of database querieshttp://wordpress.org/extend/plugins/memcached/
  • I’m Batcache
  • WordPress + Memcached Batcache Persistent data store for rendered pageshttp://wordpress.org/extend/plugins/batcache/
  • 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/
  • But Wait, There’s More!
  • MySQL ReplicationMaster / Slave one way, asynchronous send writes to the master send reads to the slave supports multiple slaves, and chaining
  • WordPress + HyperDB Drop in replacement for default DB class distributed reads and writes partition datahttp://wordpress.org/extend/plugins/hyperdb/
  • What Could This Look Like?
  • What Could This Look Like?Net web & database
  • What Could This Look Like?Net db web
  • What Could This Look Like? dbNet web memcached
  • What Could This Look Like? db dbNet web memcached memcached
  • What Could This Look Like? web db db load webbalancer web memcached memcached
  • Variationsslave just for backupsmultiple data centerstask specific web servers
  • When Things Go Wrong
  • Hire an Amazing SysAdmin
  • Questions?
  • Find Mehttp://josephscott.org/joseph@josephscott.org@josephscott