TurboPressThe High Performance Guide to WordPress
Let’s start with some theory.
INTERWEBS AMIRITE?
Browser     sho vellingshovelling             Web Server                PHP                           shovelling          ...
0. The Browser
1. DNS “ bethesignal.org ”  Browser                 Router   ISP DNS“ 70 . 85 . 31 . 216 “                                ...
1. DNS “ bethesignal.org ”  Browser                10 ms    Router   160 ms                                               ...
1. DNS “ bethesignal.org ”  Browser                10 ms    Router     160 ms                                             ...
2. HTTP “ bethesignal.org “  Browser                     10 ms    Router   160 ms                                         ...
2. HTTP “ bethesignal.org “  Browser                       10 ms    Router   160 ms                                       ...
3. PHP “ bethesignal.org “  Browser                       10 ms    Router   160 ms                                        ...
3. PHP “ bethesignal.org “  Browser                       10 ms            Router   160 ms                                ...
4. MySQL “ bethesignal.org “  Browser                       10 ms   Router   160 ms                                       ...
5. Back to the browser!
Browser     sho vellingshovelling             Web Server                PHP                           shovelling          ...
Some gory detail…
GET / HTTP/1.1Host: bethesignal.orgConnection: keep-aliveUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleW...
10:32:16.084565   *   About to connect() to bethesignal.org port 80 (#0)10:32:16.084768   *     Trying 70.85.31.216... TCP...
Now you havesome <html> …
GET /wp-content/uploads/2011/04/strange-days.jpg HTTP/1.1Host: bethesignal.orgConnection: keep-aliveCache-Control: no-cach...
10:34:05.051972   *   About to connect() to bethesignal.org port 80 (#0)10:34:05.052162   *     Trying 70.85.31.216... TCP...
webpagetest.org            Sydney ADSL
webpagetest.org            Los Angeles Fibre
webpagetest.org            Los Angeles Fibre
The Network
Host DNS and webservices close to your  primary audience.
(This is one reason why global web sites use CDNs,particularly for static content.)
The Web Server
shovelling               Apache             mpm_prefork                                                                   ...
 and
 back
 again!
shovelling               Apache             mpm_prefork                                                                   ...
 and
 back
 again!
1 process per request10-100MB per process      (or more)
Right now, webservers around theplanet are wasting gobs of memoryserving static files.
Try a differentprocess model.
You could usempm_worker…
MASSIVEPHP FAIL
nginx
1 process per core request overheadmeasured in kilobytes
shovelling               nginx             php-fastcgi                                                                    ...
 and
 back
 again!
nginxshovelling             *.png   ...
 and
 back
 again!
Apache and nginxNetcraft Survey to May 2012
PHP
“There are only two hard things  in Computing Science: cacheinvalidation and naming things.”         - Phil Karlton
It’s turtles allthe way down.
Opcode cachingDon’t let PHP do the same work twice.
APC
APC  everywhere!
WordPress
Object cachingDon’t talk to the database if you don’t have to.
APC or memcachewp-content/object-cache.php
Output or page caching      Avoid PHP entirely…?
WP Super Cache
nginxshovelling             *.png   ...
Upcoming SlideShare
Loading in …5
×

TurboPress: The High Performance Guide to WordPress - Jeff Waugh - WordCamp Sydney 2012

1,003
-1

Published on

Jeff Waugh coaches WordCamp Sydney 2012 on turboboosting your WordPress site, and setting it up for Higher Performance #wcsyd

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,003
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

TurboPress: The High Performance Guide to WordPress - Jeff Waugh - WordCamp Sydney 2012

  1. 1. TurboPressThe High Performance Guide to WordPress
  2. 2. Let’s start with some theory.
  3. 3. INTERWEBS AMIRITE?
  4. 4. Browser sho vellingshovelling Web Server PHP shovelling WordPressshovelling MySQL
  5. 5. 0. The Browser
  6. 6. 1. DNS “ bethesignal.org ” Browser Router ISP DNS“ 70 . 85 . 31 . 216 “ DNS Host
  7. 7. 1. DNS “ bethesignal.org ” Browser 10 ms Router 160 ms ISP DNS“ 70 . 85 . 31 . 216 “ 210 ms DNS Host
  8. 8. 1. DNS “ bethesignal.org ” Browser 10 ms Router 160 ms ISP DNS“ 70 . 85 . 31 . 216 “ 210 ms DNS Host Google’s web performance team calculate the average DNS query takes 130ms!
  9. 9. 2. HTTP “ bethesignal.org “ Browser 10 ms Router 160 ms ISP DNS“ 70 . 85 . 31 . 216 “ 210 ms DNS Host 70 . 85 . 31 . 216 : 80 Web Ser ver
  10. 10. 2. HTTP “ bethesignal.org “ Browser 10 ms Router 160 ms ISP DNS“ 70 . 85 . 31 . 216 “ 210 ms 220 ms DNS Host 70 . 85 . 31 . 216 : 80 Web Ser ver
  11. 11. 3. PHP “ bethesignal.org “ Browser 10 ms Router 160 ms ISP DNS“ 70 . 85 . 31 . 216 “ 210 ms 220 ms DNS Host 70 . 85 . 31 . 216 : 80 Web Ser ver PHP
  12. 12. 3. PHP “ bethesignal.org “ Browser 10 ms Router 160 ms ISP DNS“ 70 . 85 . 31 . 216 “ 210 ms 220 ms DNS Host 70 . 85 . 31 . 216 : 80 650 ms Web Ser ver PHP
  13. 13. 4. MySQL “ bethesignal.org “ Browser 10 ms Router 160 ms ISP DNS“ 70 . 85 . 31 . 216 “ 210 ms 220 ms DNS Host 70 . 85 . 31 . 216 : 80 Web Ser ver PHP MySQL
  14. 14. 5. Back to the browser!
  15. 15. Browser sho vellingshovelling Web Server PHP shovelling WordPressshovelling MySQL
  16. 16. Some gory detail…
  17. 17. GET / HTTP/1.1Host: bethesignal.orgConnection: keep-aliveUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11(KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Encoding: gzip,deflate,sdchAccept-Language: en-AU,en;q=0.8,en-US;q=0.6Accept-Charset: UTF-8,*;q=0.5Cookie: wordpress_logged_in_...=jdub...If-Modified-Since: Thu, 12 Jul 2012 21:27:06 GMTHTTP/1.1 200 OKServer: nginx/1.2.1Date: Fri, 20 Jul 2012 23:48:04 GMTContent-Type: text/html; charset=UTF-8Transfer-Encoding: chunkedConnection: keep-aliveVary: Accept-EncodingVary: CookieX-Pingback: http://bethesignal.org/xmlrpc.phpExpires: Wed, 11 Jan 1984 05:00:00 GMTLast-Modified: Fri, 20 Jul 2012 23:48:03 GMTCache-Control: no-cache, must-revalidate, max-age=0Pragma: no-cacheContent-Encoding: gzip
  18. 18. 10:32:16.084565 * About to connect() to bethesignal.org port 80 (#0)10:32:16.084768 * Trying 70.85.31.216... TCP_NODELAY set10:32:16.283247 * connected10:32:16.283376 * Connected to bethesignal.org (70.85.31.216) port 80 (#0)10:32:16.283528 > GET / HTTP/1.110:32:16.283528 > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/...10:32:16.283528 > Host: bethesignal.org10:32:16.283528 > Accept: */*10:32:16.283528 > Accept-Encoding: deflate, gzip10:32:16.283528 > Cookie: wordpress_logged_in_...=jdub...10:32:16.283528 >10:32:16.995103 < HTTP/1.1 200 OK10:32:16.995216 < Server: nginx/1.2.110:32:16.995240 < Date: Sat, 21 Jul 2012 00:32:16 GMT10:32:16.995295 < Content-Type: text/html; charset=UTF-810:32:16.995374 < Transfer-Encoding: chunked10:32:16.995412 < Connection: keep-alive10:32:16.995447 < Vary: Accept-Encoding10:32:16.995482 < Vary: Cookie10:32:16.995515 < X-Pingback: http://bethesignal.org/xmlrpc.php10:32:16.995548 < Expires: Wed, 11 Jan 1984 05:00:00 GMT10:32:16.995601 < Last-Modified: Sat, 21 Jul 2012 00:32:16 GMT10:32:16.995642 < Cache-Control: no-cache, must-revalidate, max-age=010:32:16.995680 < Pragma: no-cache10:32:16.995717 < Content-Encoding: gzip10:32:16.995759 <10:32:16.995794 { [data not shown]10:32:17.393072 * Connection #0 to host bethesignal.org left intact10:32:17.393170 * Closing connection #0
  19. 19. Now you havesome <html> …
  20. 20. GET /wp-content/uploads/2011/04/strange-days.jpg HTTP/1.1Host: bethesignal.orgConnection: keep-aliveCache-Control: no-cachePragma: no-cacheUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11(KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Referer: http://bethesignal.org/Accept-Encoding: gzip,deflate,sdchAccept-Language: en-AU,en;q=0.8,en-US;q=0.6Accept-Charset: UTF-8,*;q=0.5Cookie: wordpress_logged_in_...=jdub...HTTP/1.1 200 OKServer: nginx/1.2.1Date: Fri, 20 Jul 2012 23:50:50 GMTContent-Type: image/jpegContent-Length: 180112Last-Modified: Fri, 08 Apr 2011 14:25:27 GMTConnection: keep-aliveExpires: Wed, 19 Jul 2017 23:50:50 GMTCache-Control: max-age=157680000Accept-Ranges: bytes
  21. 21. 10:34:05.051972 * About to connect() to bethesignal.org port 80 (#0)10:34:05.052162 * Trying 70.85.31.216... TCP_NODELAY set10:34:05.251898 * connected10:34:05.251989 * Connected to bethesignal.org (70.85.31.216) port 80 (#0)10:34:05.252123 > GET /wp-content/uploads/2011/04/strange-days.jpg HTTP/1.110:34:05.252123 > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/...10:34:05.252123 > Host: bethesignal.org10:34:05.252123 > Accept: */*10:34:05.252123 > Accept-Encoding: deflate, gzip10:34:05.252123 > Cookie: wordpress_logged_in_...=jdub...10:34:05.252123 >10:34:05.448816 < HTTP/1.1 200 OK10:34:05.448981 < Server: nginx/1.2.110:34:05.449045 < Date: Sat, 21 Jul 2012 00:34:05 GMT10:34:05.449091 < Content-Type: image/jpeg10:34:05.449131 < Content-Length: 18011210:34:05.449170 < Last-Modified: Fri, 08 Apr 2011 14:25:27 GMT10:34:05.449211 < Connection: keep-alive10:34:05.449250 < Expires: Thu, 20 Jul 2017 00:34:05 GMT10:34:05.449290 < Cache-Control: max-age=15768000010:34:05.449331 < Accept-Ranges: bytes10:34:05.449382 <10:34:05.449440 { [data not shown]10:34:06.443613 * Connection #0 to host bethesignal.org left intact10:34:06.443714 * Closing connection #0
  22. 22. webpagetest.org Sydney ADSL
  23. 23. webpagetest.org Los Angeles Fibre
  24. 24. webpagetest.org Los Angeles Fibre
  25. 25. The Network
  26. 26. Host DNS and webservices close to your primary audience.
  27. 27. (This is one reason why global web sites use CDNs,particularly for static content.)
  28. 28. The Web Server
  29. 29. shovelling Apache mpm_prefork sho velling mod_phpshovelling *.php ...
  30. 30.  and
  31. 31.  back
  32. 32.  again!
  33. 33. shovelling Apache mpm_prefork sho velling mod_phpshovelling *.png ...
  34. 34.  and
  35. 35.  back
  36. 36.  again!
  37. 37. 1 process per request10-100MB per process (or more)
  38. 38. Right now, webservers around theplanet are wasting gobs of memoryserving static files.
  39. 39. Try a differentprocess model.
  40. 40. You could usempm_worker…
  41. 41. MASSIVEPHP FAIL
  42. 42. nginx
  43. 43. 1 process per core request overheadmeasured in kilobytes
  44. 44. shovelling nginx php-fastcgi sho velling [worker]shovelling *.php ...
  45. 45.  and
  46. 46.  back
  47. 47.  again!
  48. 48. nginxshovelling *.png ...
  49. 49.  and
  50. 50.  back
  51. 51.  again!
  52. 52. Apache and nginxNetcraft Survey to May 2012
  53. 53. PHP
  54. 54. “There are only two hard things in Computing Science: cacheinvalidation and naming things.” - Phil Karlton
  55. 55. It’s turtles allthe way down.
  56. 56. Opcode cachingDon’t let PHP do the same work twice.
  57. 57. APC
  58. 58. APC everywhere!
  59. 59. WordPress
  60. 60. Object cachingDon’t talk to the database if you don’t have to.
  61. 61. APC or memcachewp-content/object-cache.php
  62. 62. Output or page caching Avoid PHP entirely…?
  63. 63. WP Super Cache
  64. 64. nginxshovelling *.png ...
  65. 65.  and
  66. 66.  back
  67. 67.  again!
  68. 68. Batcache
  69. 69. Reverse proxy cache,such as nginx, Varnish
  70. 70. MySQL
  71. 71. Query (or results) cache Don’t let MySQL do the same work twice.
  72. 72. Schema, index andbehavioural optimisation Don’t tell MySQL do stupid work in the first place.
  73. 73. Browser
  74. 74. Raw performance vs. Perception of performance
  75. 75. Measure twice, cut once.
  76. 76. “totes
  77. 77.  insan
  78. 78.  hosting
  79. 79.  guys!” -
  80. 80.  Peter

×