Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Site Performance, from Pinto to Ferrari

Avatar for josephscott josephscott
September 26, 2011

Site Performance, from Pinto to Ferrari

Avatar for josephscott

josephscott

September 26, 2011
Tweet

Other Decks in Technology

Transcript

  1. I Want My Site To Be Faster Less Like A

    Pinto Saturday, September 17, 2011
  2. I Want My Site To Be Faster More Like A

    Ferrari Saturday, September 17, 2011
  3. The Initial Request Get the source for the page 0.113

    seconds Saturday, September 17, 2011
  4. The Initial Request DNS Lookup: 5 ms Initial Connection: 47

    ms Time to First Byte: 57 ms Content Download: 4 ms Bytes In (downloaded): 9.6 KB Bytes Out (uploaded): 0.4 KB Saturday, September 17, 2011
  5. Average Lies pg3, Exhibit 1 List A List B 0.924

    0.796 0.928 0.798 0.954 0.802 0.957 0.823 0.961 0.919 0.965 0.977 0.972 1.076 0.979 1.216 0.987 1.273 1.373 1.320 Saturday, September 17, 2011
  6. Know Your Limits Calculate the theoretical best performance for your

    setup What ever you actually end up with will be slower than that Saturday, September 17, 2011
  7. Apache 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 Saturday, September 17, 2011
  8. HTTP - The Web Server HTTP Compression Keep-alive support Correctly

    Configured Caching Saturday, September 17, 2011
  9. ETag Survey ETags used by 136 of the top 1,000

    U.S. sites http://josephscott.org/archives/2011/09/etag-survey/ Saturday, September 17, 2011
  10. ETag Survey Of the 136 sites using ETags: 54 Worked

    Correctly (39.7%) 11 Sort of Worked (8%) 71 Broken/Useless (52.2%) Saturday, September 17, 2011
  11. Parse hello.php <?php echo "Hello, World!\n" Parse error: syntax error,

    unexpected $end, expecting ',' or ';' in /tmp/hello.php on line 3 Saturday, September 17, 2011
  12. foreach ( $tokens as $token ) { if ( is_array(

    $token ) ) { echo token_name( $token[0] ) . " ( {$token[2]} ) - {$token[1]}\n"; } else { echo "{$token}\n"; } } Saturday, September 17, 2011
  13. T_OPEN_TAG ( 1 ) - <?php T_ECHO ( 1 )

    - echo T_WHITESPACE ( 1 ) - T_CONSTANT_ENCAPSED_STRING ( 1 ) - "Hello, World!" ; Saturday, September 17, 2011
  14. Branch analysis from position: 0 Return found filename: /tmp/hello.php function

    name: (null) number of ops: 3 compiled vars: none line # op fetch ext return operands ------------------------------------------------------------------------------- 2 0 ECHO 'Hello%2C+World%21%0A' 3 1 RETURN 1 2* ZEND_HANDLE_EXCEPTION Saturday, September 17, 2011
  15. PHP - opcode caching APC requests per second - increased

    4x time per request - decreased 4x Saturday, September 17, 2011
  16. use an opcode cache (APC) use newer versions don’t use

    on static files (unless you really need to) consider output buffering be careful with preg_* functions profile your running code (Xdebug, VLD) don’t re-invent native PHP functions, they are likely faster than yours PHP Saturday, September 17, 2011
  17. use InnoDB table type (unless you have a really good

    reason not to) use the slow query log use EXPLAIN on queries, learn what the output means double triple check your indexes learn about quirks MySQL Saturday, September 17, 2011
  18. “Free & open source, high-performance, distributed memory object caching system”

    in memory only, won’t survive a reboot key/value data store Memcached http://memcached.org/ Saturday, September 17, 2011
  19. Memcached Object Cache Persistent data store for WordPress objects Reduces

    the number of database queries WordPress + Memcached http://wordpress.org/extend/plugins/memcached/ Saturday, September 17, 2011
  20. Batcache Persistent data store for rendered pages WordPress + Memcached

    http://wordpress.org/extend/plugins/batcache/ Saturday, September 17, 2011
  21. Master / Slave one way, asynchronous send writes to the

    master send reads to the slave supports multiple slaves, and chaining MySQL Replication Saturday, September 17, 2011
  22. Drop in replacement for default DB class distributed reads and

    writes partition data WordPress + HyperDB http://wordpress.org/extend/plugins/hyperdb/ Saturday, September 17, 2011
  23. What Could This Look Like? web db memcached memcached db

    web load balancer web Saturday, September 17, 2011
  24. slave just for backups multiple data centers task specific web

    servers Variations Saturday, September 17, 2011