SlideShare a Scribd company logo
1 of 126
Download to read offline
High Performance
   Web Sites
Tips for faster pages




                       Nate Koechley
                    natek@yahoo-inc.com
                   nate.koechley.com/blog
                  developer.yahoo.com/yui
Y! Performance Research
    Engineering Team

ā€¢ Tenni Theurer, Nicole Sullivan,
  Philip Tellis, Stoyan Stefanov,
  Swapni Shinde, Wayne Shea,
  Anand Kishore (Intern)
Why talk about
performance?
1: Because fast is better
5
8
9
10
11
2: Because sites are bigger
Modern web sites &
applications have changed
      architecturally.
From 2003 to 2008:
   97K to 312K.
25.7 to 49.9 objects.
In past 12 months, Top 1000 sites:
       From 250K to 310.4K.
WebSiteOptimization.com/speed/tweak/average-web-page
What is performance?
Two Flavors:
 Response Time
       &
System Efļ¬ciency
Our focus is
the response
time of web
  products
Foundational Research:
1
Perception
perceived response time

                slow crawl boring snail
       performance speed enjoyable stagnant
                     unexceptional
       urgent instant accelerate yawn
    perceptionunresponsive impatient delay
                 snap achievement
               moderate blah subdue
       better improve action pleasant drag apathetic
               prolong slack load sluggish sleepy
    pace quick promote swift cool
                  late unexciting reduced lag
    maximum drive prompt advance
                 complex heavy unmemorable
     fast hurry rush satisfying feel
                             obscure
                  brisk rapid exciting
    exceptional
                                   wait
                             why
perceived response time

                                     slow crawl boring snail stagnant
   performance speed enjoyable
                                         unexceptional yawn
   urgent instant accelerate
                                     unresponsive impatient delay
perception snap achievement
                                     moderate blah subdue drag apathetic
   better improve action pleasant
                                     prolong slack load sluggish sleepy
pace quick promote swift cool
                                       late unexciting reduced lag
maximum drive prompt advance
                                      complex heavy unmemorable
 fast hurry rush satisfying feel
                                             obscure
              brisk rapid exciting
exceptional
                                                        wait
                                                  why




what is the end userā€™s experience?
Itā€™s in the eye of the beholder
 ā€¢   Perception and usability are important
     performance metrics.
 ā€¢   More relevant than actual unload-to-onload
     time.
 ā€¢   Deļ¬nition of quot;user onloadquot; is undeļ¬ned or
     varies from one web page to the next.
2
ā€œ80% of consequences come from
                 20% of causesā€
                   ā€”Vilfredo Pareto
The Importance of Front-End Performance
The Importance of Front-End Performance



Back-end

= 5%
The Importance of Front-End Performance



                               Front-end

                               = 95%
The Importance of Front-End Performance




        Even here, front-end = 88%
Back-end vs. Front-end
                Empty Cache   Full Cache
amazon.com         82%           86%
   aol.com         94%           86%
  cnn.com          81%           92%
  ebay.com         98%           92%
 google.com        86%           64%
  msn.com          97%           95%
myspace.com        96%           86%
wikipedia.org      80%           88%
 yahoo.com         95%           88%
youtube.com        97%           95%
Until now our
optimization efforts
have targeted the tip
of the iceberg.
http://yuiblog.com/blog/2006/11/28/performance-research-part-1/
http://yuiblog.com/blog/2006/11/28/performance-research-part-1/
3
Cache
Empty vs. Full Cache
                      2                 3
    1
                                   user re-requests
 user requests    user requests
                                   www.yahoo.com
www.yahoo.com    other web pages
Empty vs. Full Cache
                           2                                       3
       1
                          dns lookup
                                 html
                               image
                               image
                          dns lookup
                                script
                               image
                               image
                               image
                               image
                                                             user re-requests
   user requests       user requests
                               image
                               image
                                                             www.yahoo.com
  www.yahoo.com       other web pages
                               image
                               image
                                script
                               image
                               image
                               image
                               image
                               image
                               image
                               image
                               image
                                script
                          dns lookup
                               image
                               image
                               image
                               image
                               image
                          dns lookup
                                script
                                script
                           stylesheet
                               image

with an empty cache                      0   0.5   1   1.5     2    2.5   3
Empty vs. Full Cache
                           2                                       3
       1
                          dns lookup
                                 html
                               image
                               image
                          dns lookup
                                script
                               image
                               image
                               image
                               image
                                                             user re-requests
   user requests       user requests
                               image
                               image
                                                             www.yahoo.com
  www.yahoo.com       other web pages
                               image
                               image
                                script
                               image
                               image
                               image
                               image
                               image
                               image
                               image
                               image
                                script
                          dns lookup
                               image
                               image
                               image
                               image
                               image
                          dns lookup
                                script
                                script
                           stylesheet
                               image

with an empty cache                      0   0.5   1   1.5     2    2.5   3
Empty vs. Full Cache
                      2                 3
    1
                                   user re-requests
 user requests    user requests
                                   www.yahoo.com
www.yahoo.com    other web pages
Empty vs. Full Cache
                      2                 3
    1
                                   user re-requests
 user requests    user requests
                                   www.yahoo.com
www.yahoo.com    other web pages
Empty vs. Full Cache
                      2                 3
    1
                                   user re-requests
 user requests    user requests
                                   www.yahoo.com
www.yahoo.com    other web pages
Empty vs. Full Cache
Empty vs. Full Cache




empty = 2.4 seconds
full = 0.9 second
full = 83% fewer bytes.
full = 90% fewer HTTP requests.
3b
  (sadly, the cache
doesnā€™t work as well
 as we wish it did.)
How much does caching
  beneļ¬t our users?
How much does caching
  beneļ¬t our users?
Q1: What % of unique users
view a page with an empty cache?
How much does caching
  beneļ¬t our users?
Q1: What % of unique users
view a page with an empty cache?


Q2: What % of page views are
with an empty cache?
Browser Cache Experiment

           Add a new image to your page
<img src=quot;image/blank.gifquot; height=quot;1quot; width=quot;1quot;/>



                   }1 px


        with the following response headers:
    Expires: Thu, 15 Apr 2004 20:00:00 GMT
    Last-Modified: Wed, 28 Sep 2006 23:49:57 GMT
Browser Cache Experiment

           Add a new image to your page
<img src=quot;image/blank.gifquot; height=quot;1quot; width=quot;1quot;/>

                          }1 px




        with the following response headers:
    Expires: Thu, 15 Apr 2004 20:00:00 GMT
    Last-Modified: Wed, 28 Sep 2006 23:49:57 GMT
Browser Cache Experiment
Two possible response codes:

  200 ā€“ The browser does not have the
         image in its cache.

  304 ā€“ The browser has the image in its
         cache, but needs to verify the last
         modiļ¬ed date.
Browser Cache Experiment
                        # unique users with at least
Q1: What % of
                             one 200 response
unique users view          total # unique users
with an empty cache?


                          total # of 200 responses
Q2: What % of page
                       # of 200 + # of 304 responses
views are with an
empty cache?

                                      }1 px
Surprising Results
1.00



0.75



0.50



0.25




       1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17

                           uu w/ empty cache
                           pv w/ empty cache
Surprising Results
1.00



0.75



0.50



0.25




       1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17

                           uu w/ empty cache
                           pv w/ empty cache
40-60% UUs w/ empty cache
20% PVs w/ empty cache
Experiment Takeaways

   1. The empty cache user
      experience is more
      prevalent than you think!
   2. Therefore, optimize for
      both full cache and
      empty cache experience.
http://yuiblog.com/blog/2007/01/04/performance-research-part-2/
http://yuiblog.com/blog/2007/01/04/performance-research-part-2/
4

Cookies
Set Scope Correctly
         1
      user requests
     www.yahoo.com




HTTP response header sent by the web server:
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Set-Cookie: C=abcdefghijklmnopqrstuvwxyz; domain=.yahoo.com
Because broad scope adds up
                                                   2
        1
                                              user requests
     user requests
                                           finance.yahoo.com
    www.yahoo.com




HTTP request header sent by the browser:
GET / HTTP/1.1
Host: finance.yahoo.com
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; ā€¦
Cookie: C=abcdefghijklmnopqrstuvwxyz;
Impact on Response Time
   Cookie Size    Time   Delta

   0 bytes       78 ms    0 ms

   500 bytes     79 ms   +1 ms

   1000 bytes    94 ms +16 ms

   1500 bytes    109 ms +31 ms

   2000 bytes    125 ms +47 ms

   2500 bytes    141 ms +63 ms

   3000 bytes    156 ms +78 ms
Cookie Sizes across the Web

            Total Cookie Size
 Amazon              60 bytes
 Google              72 bytes
 Yahoo             122 bytes
 CNN               184 bytes
 YouTube           218 bytes
 MSN               268 bytes
 eBay              331 bytes
 MySpace           500 bytes
Experiment Takeaways

ā€¢ eliminate unnecessary cookies
ā€¢ keep cookie sizes low
ā€¢ set cookies at the appropriate
  domain (or sub-domain) level
ā€¢ set Expires date appropriately
http://yuiblog.com/blog/2007/03/01/performance-research-part-3
http://yuiblog.com/blog/2007/03/01/performance-research-part-3
Parallel Downloads
Two components    in parallel   per hostname




                     GIF
                                         GIF
GIF    GIF
                                         GIF

                     GIF




                 per HTTP/1.1
Parallel Downloads
Parallel Downloads
                         html
                    component
                    component


Two in parallel
                    component
                    component
                    component
                    component
                    component
                    component
                    component
                    component

                                0   0.425   0.850   1.275   1.700




Four in parallel



Eight in parallel
Parallel Downloads
                         html
                    component
                    component


Two in parallel
                    component
                    component
                    component
                    component
                    component
                    component
                    component
                    component

                                0   0.425   0.850   1.275   1.700
                         html
                    component
                    component
                    component


Four in parallel    component
                    component
                    component
                    component
                    component
                    component
                    component

                                0   0.375   0.750   1.125   1.500




Eight in parallel
Parallel Downloads
                         html
                    component
                    component


Two in parallel
                    component
                    component
                    component
                    component
                    component
                    component
                    component
                    component

                                0   0.425   0.850   1.275   1.700
                         html
                    component
                    component
                    component


Four in parallel    component
                    component
                    component
                    component
                    component
                    component
                    component

                                0   0.375   0.750   1.125   1.500

                         html
                    component
                    component
                    component
                    component
                    component



Eight in parallel
                    component
                    component
                    component
                    component
                    component

                                0   0.375   0.750   1.125   1.500
Maximizing Parallel Downloads


response time
  (seconds)




                aliases
Maximizing Parallel Downloads
                1.4       36 x 36 px (0.9 Kb)      116 x 61 px (3.4 Kb)
                1.2

                1.0

                0.8
response time
  (seconds)
                0.6

                0.4

                0.2

                 0
                      1       2            4            5            10


                                         aliases
Maximizing Parallel Downloads
            1.4
                        36 x 36 px (0.9 Kb)   116 x 61 px (3.4 Kb)   average


            1.2




            1.0




            0.8
response time
  (seconds)
            0.6




            0.4




            0.2




                0
                    1            2                4                  5         10



                                                 aliases
Maximizing Parallel Downloads
            1.4
                        36 x 36 px (0.9 Kb)   116 x 61 px (3.4 Kb)   average


            1.2




            1.0




            0.8
response time
  (seconds)
            0.6




            0.4




            0.2




                0
                    1            2                4                  5         10



  rule of thumb: use at least 2 but no more than 4 aliases
Experiment Takeaways

ā€¢   beware the effects of CPU thrashing
ā€¢   DNS lookup times vary across ISPs and
    geographic locations
ā€¢   domain names may not be cached
http://yuiblog.com/blog/2007/04/11/performance-research-part-4/
http://yuiblog.com/blog/2007/04/11/performance-research-part-4/
Summary
What the 80/20 Rule Tells Us about
 Reducing HTTP Requests

   http://yuiblog.com/blog/2006/11/28/performance-research-part-1/

Browser Cache Usage ā€“ Exposed!

   http://yuiblog.com/blog/2007/01/04/performance-research-part-2/

When the Cookie Crumbles

   http://yuiblog.com/blog/2007/03/01/performance-research-part-3/

Maximizing Parallel Downloads in the
 Carpool Lane

   http://yuiblog.com/blog/2007/04/11/performance-research-part-4/
Performance Fruit
(some low, some high)
Rule: Make fewer HTTP
       requests.

ā€¢   CSS sprites
ā€¢   Combined / concatenated JS and CSS ļ¬les
ā€¢   image maps
ā€¢   inline (data) images
CSS Sprites



                  <span style=quot;

                  background-image: url('sprites.gif');

                  background-position: -260px -90px;quot;>

                  </span>

size of combined image is less
http://alistapart.com/articles/sprites
Combined Scripts,
   Combined Stylesheets
                      Scripts Stylesheets

amazon.com                 3            1
aol.com                   18            1
cnn.com                   11            2
ebay.com                   7            2
froogle.google.com         1            1
msn.com                    9            1
myspace.com                2            2
wikipedia.org              3            1
yahoo.com                  4            1
youtube.com                7            3
            Average      6.5          1.5
(This could well be)
   The End.
Rule: Use a CDN
       amazon.com            Akamai
       aol.com               Akamai
       cnn.com
       ebay.com        Akamai, Mirror Image
       google.com
       msn.com               SAVVIS
       myspace.com      Akamai, Limelight
       wikipedia.org
       yahoo.com             Akamai
       youtube.com


distribute your static content before
  distributing your dynamic content
Rule: Add an Expires header
                     (not just for images)
                                                          Median
                     Images Stylesheets Scripts     %
                                                            Age
amazon.com             0/62        0/1     0/3     0%    114 days
aol.com               23/43        1/1    6/18    48%    217 days
cnn.com               0/138        0/2    2/11     1%    227 days
ebay.com              16/20        0/2     0/7    55%    140 days
froogle.google.com     1/23        0/1     0/1     4%    454 days
msn.com               32/35        1/1     3/9    80%     34 days
myspace.com            0/18        0/2     0/2     0%       1 day
wikipedia.org           6/8        1/1     2/3    75%       1 day
yahoo.com             23/23        1/1     4/4    100%       n/a
youtube.com            0/32        0/3     0/7     0%     26 days
Rule: Gzip components
Rule: Gzip components
ā€¢ you can aect users'
  download times
ā€¢ 90%+ of browsers
  support compression
Gzip: not just for HTML
                      HTML   Scripts   Stylesheets
 amazon.com            x
 aol.com               x     some         some
 cnn.com
 ebay.com              x
 froogle.google.com    x       x           x
 msn.com               x     deļ¬‚ate      deļ¬‚ate
 myspace.com           x       x           x
 wikipedia.org         x       x           x
 yahoo.com             x       x           x
 youtube.com           x     some         some

gzip scripts, stylesheets, XML, JSON
 (not images, PDF)
YUIā€™s Free Hosting:

ā€¢   Aggregated ļ¬les
ā€¢   With Expires headers
ā€¢   On a CDN
ā€¢   Gzipped
Rule: Put CSS at the top

ā€¢   stylesheets block rendering in IE
ā€¢   solution: put stylesheets in HEAD (per spec)
ā€¢   avoids Flash of Unstyled Content


    use link (not @import)
Slowest is
actually the
   Fastest
Rule: Choose link
      over @import


ā€¢   When you use @import you override the
    browsersā€™ native performance assistance.
Rule: Move scripts to the
        bottom
ā€¢   scripts block rendering of everything below
    them in the page
ā€¢   scripts block parallel downloads across all
    hostnames
What about defer?


script defer attribute is not a solution
  ā€¢   blocks rendering and downloads in FF
  ā€¢   slight blocking in IE
Rule: Avoid CSS expressions
Can be used to set CSS properties dynamically
 in IE
  width: expression(
    document.body.clientWidth  600 ?
    ā€œ600pxā€ : ā€œautoā€ );
But problematic because expressions execute
  many times
  ā€“ mouse move, key press, resize, scroll, etc.
Rule: Make JS  CSS external
Inline: bigger HTML but no HTTP request
External: cachable but extra HTTP
Variables:
  ā€“ page views per user (per session)
  ā€“ empty vs. full cache stats
  ā€“ component re-use
External is typically better
  ā€“ home pages may be an exception due to cache
    behavior of browserā€™s startpage.
Rule: Reduce DNS lookups
typically 20-120 ms
block parallel downloads
OS and browser both have DNS caches



                        Best practice:
                        Max 2-4 hosts
                        Use keep-alive
Rule: Minify JavaScript
                       Minify      Minify Inline?
                      External?
www.amazon.com           no             no
www.aol.com              no             no
www.cnn.com              no             no
www.ebay.com             yes            no
froogle.google.com       yes            yes
www.msn.com              yes            yes
www.myspace.com          no             no
www.wikipedia.org        no             no
www.yahoo.com            yes            yes
www.youtube.com          no             no

      donā€™t forget to minify inline scripts, too
Which Compressor?


ā€¢   YUI Compressor is highly regarded
ā€¢   web search ā€œCompressorRaterā€
Rule: Avoid redirects
3xx status codes ā€“ mostly 301 and 302
   HTTP/1.1 301 Moved Permanently
   Location: http://yahoo.com/newuri

add Expires headers so redirect headers are
  cached
Redirects are worst form of blocking




http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Rule: Make AJAX
    cacheable and small

ā€¢   XHR, JSON, iframe, dynamic scripts can still
    be cached, miniļ¬ed, and gzipped
ā€¢   a personalized response should still be
    cacheable by that person
Rule: Use GET for AJAX
       Requests

ā€¢   POST is a two-step process.
ā€¢   GET can send in one packet. Use if possible.
ā€¢   Max payload is 2K in IE.
Rule: Post-load
            Components

ā€¢   Delay all non-crucial elements.
    ā€¢   YUI Image Loader offers precise control.
    ā€¢   YUI Get makes on-the-ļ¬‚y JS  CSS easy.
ā€¢   Used on www.yahoo.com homepage.
Rule: Preload
             Components
ā€¢   Unconditional preload - all following onload
    ā€¢   Ex: google.comā€™s sprite
ā€¢   Conditional preload - based on user action
    ā€¢   Ex: search.yahoo.comā€™s Search Assist
ā€¢   Anticipated preload - give redesigns a boost
Rule: Minimize iFrames


ā€¢   Costly even if blank
ā€¢   Blocks page onload
ā€¢   Questionable semantic value
Rule: Smart Event
             Handles

ā€¢   Event Delegation to reduce total number
ā€¢   onAvailable (etc) for earlier access
    ā€¢   YUI Event has onAvailable,
        onContentReady,  onDomReady
Rule: Optimize CSS
              Sprites
ā€¢   Horizontal alignment is usually smaller than
    vertical.
ā€¢   Combine similar colors in a sprite to
    minimize color count.
    ā€¢   Only 256 colors can ļ¬t in a PNG8.
ā€¢   Be mobile-friendly. Avoid big gaps between
    images. Minimal impact on k-size, but takes
    more memory to decompress.
Rule: favicon.ico
ā€¢   Always provide a favicon.ico so the request
    doesnā€™t 404
ā€¢   And the request carries cookies
ā€¢   Mitigate by setting an expires header,
    ā€¢   (but NOT forever since you canā€™t rename
        the ļ¬le.)
ā€¢   Keep under 1K
Rule: iPhone-Friendly Tip

ā€¢   iPhone will not cache assets larger than 25K
    ā€¢   Thatā€™s 25K uncompressed.
ā€¢   http://yuiblog.com/blog/2008/02/06/iphone-
    cacheability/
Tools for your own
      analysis
IBM Page
         Detailer
 Packet sniffer. Windows only (IE,
FF, any .exe). Free trial, $300 license

 http://alphaworks.ibm.com/tech/
            pagedetailer
LiveHTTPHeaders
 View HTTP headers. Firefox
      extension. Free.
Firebug

ā€¢   web development evolved
ā€¢   inspect and edit HTML, tweak and visualize
    CSS, debug and proļ¬le JavaScript
ā€¢   monitor network activity (caveat: caching)
ā€¢   Free Firefox extension
http://getļ¬rebug.com/
YSlow

ā€¢   Extension for Firebug extension
ā€¢   Performance report card
ā€¢   HTTP/HTML summary
ā€¢   List of components in the page
ā€¢   Tools including JSLint
Conclusion
Takeaways
ā€¢   focus on the front-end
ā€¢   harvest the low-hanging fruit
    ā€¢ reduce HTTP requests
    ā€¢ enable caching
ā€¢   you do control user response times
ā€¢   LOFNO ā€“ be an advocate for your users
For more information:
High Performance
   Web Sites
 Essential Knowledge for
   Front-End Engineers

     by Steve Souders,
  with research from Yahoo!ā€™s
 Performance Engineering team.
Exceptional
Performance on
     YDN
 http://developer.yahoo.com/
         performance
Articles on
 YUIBlog
http://yuiblog.com/blog/
 category/performance
Letā€™s keep talking...

         nate@koechley.com
  http://nate.koechley.com/blog
        ā€œnatekoechleyā€


Thanks again to Yahoo!ā€™s Exceptional Performance Engineering Team
Links
book: http://www.oreilly.com/catalog/9780596514211/
examples: http://stevesouders.com/examples/
image maps: http://www.w3.org/TR/html401/struct/objects.html#h-13.6
CSS sprites: http://alistapart.com/articles/sprites
inline images: http://tools.ietf.org/html/rfc2397
jsmin: http://crockford.com/javascript/jsmin
dojo compressor: http://dojotoolkit.org/docs/shrinksafe
HTTP status codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
IBM Page Detailer: http://alphaworks.ibm.com/tech/pagedetailer
Fasterfox: http://fasterfox.mozdev.org/
LiveHTTPHeaders: http://livehttpheaders.mozdev.org/
Firebug: http://getļ¬rebug.com/
YUIBlog: http://yuiblog.com/blog/2006/11/28/performance-research-part-1/
          http://yuiblog.com/blog/2007/01/04/performance-research-part-2/
          http://yuiblog.com/blog/2007/03/01/performance-research-part-3/
          http://yuiblog.com/blog/2007/04/11/performance-research-part-4/
YDN: http://developer.yahoo.net/blog/archives/2007/03/high_performanc.html
      http://developer.yahoo.net/blog/archives/2007/04/rule_1_make_few.html
CC Images Used
ā€œZipper Pocketā€ by jogales: http://www.ļ¬‚ickr.com/photos/jogales/11519576/
ā€œNeed for Speedā€ by Amnemona: http://www.ļ¬‚ickr.com/photos/marinacvinhal/379111290/
ā€œI wonder what ļ¬‚avour it is?ā€ by blather: http://www.ļ¬‚ickr.com/photos/deadlyphoto/411770353/
ā€œtakeout boxes from Grand Shanghaiā€ by massdistraction: http://www.ļ¬‚ickr.com/photos/sharynmorrow/
     11263821/
ā€œtakeoutā€ by dotpolka : http://www.ļ¬‚ickr.com/photos/dotpolka/249129144/
ā€œice cream cone melting/romeā€ by Megandavid : http://www.ļ¬‚ickr.com/photos/megandavid/189332042/
ā€œnikon em bokehā€ by dsevilla: http://www.ļ¬‚ickr.com/photos/dsevilla/249202834/
ā€œmaybeā€ by Tal Bright: http://www.ļ¬‚ickr.com/photos/bright/118197469/
ā€œhow do they do thatā€ by Fort Photo: http://www.ļ¬‚ickr.com/photos/fortphoto/388825145/
ā€œGorgeous iceberg 7 [Le Toit du Monde]ā€ by Adventure Addict http://www.ļ¬‚ickr.com/photos/
    adventureaddict/35290307/
ā€œmolasses-spice cookiesā€ ilmungo: http://www.ļ¬‚ickr.com/photos/ilmungo/65345233/
ā€œDriving is funā€ by Ben McLeod: http://www.ļ¬‚ickr.com/photos/benmcleod/59948935/
ā€œDozen eggsā€ by aeA: http://www.ļ¬‚ickr.com/photos/raeallen/96238870/
ā€œMax speed 15kmhā€ by xxxtoff: http://www.ļ¬‚ickr.com/photos/xxxtoff/219781763/
ā€œStairway to heavenā€ ognita: http://www.ļ¬‚ickr.com/photos/ognita/503915547/
ā€œļ¬‚aps upā€ by http://www.ļ¬‚ickr.com/photos/jurvetson/74274113/
ā€œFast Catā€ by http://www.ļ¬‚ickr.com/photos/raylopez/708023176/
nate@koechley.com
http://nate.koechley.com/blog

               natekoechley    = twitter,
delicious, flickr, tripit, last.fm, linkedin,
fireeagle, friendfeed, ... everywhere.




  Thanks again to Yahoo!ā€™s Exceptional Performance Engineering Team

More Related Content

Viewers also liked

Building Cordova plugins for iOS
Building Cordova plugins for iOSBuilding Cordova plugins for iOS
Building Cordova plugins for iOS
Grgur Grisogono
Ā 

Viewers also liked (20)

Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Client Side Performance for Back End Developers - Camb Expert Talks, Nov 2016
Ā 
Sencha Space review
Sencha Space reviewSencha Space review
Sencha Space review
Ā 
Give Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance BoostGive Responsive Design a Mobile Performance Boost
Give Responsive Design a Mobile Performance Boost
Ā 
Has Anyone Asked a Customer?
Has Anyone Asked a Customer?Has Anyone Asked a Customer?
Has Anyone Asked a Customer?
Ā 
A better CSS: Sass and Less - CC FE & UX
A better CSS: Sass and Less - CC FE & UXA better CSS: Sass and Less - CC FE & UX
A better CSS: Sass and Less - CC FE & UX
Ā 
What's Coming Next in Sencha Frameworks
What's Coming Next in Sencha FrameworksWhat's Coming Next in Sencha Frameworks
What's Coming Next in Sencha Frameworks
Ā 
Building Cordova plugins for iOS
Building Cordova plugins for iOSBuilding Cordova plugins for iOS
Building Cordova plugins for iOS
Ā 
ModUX keynote
ModUX keynoteModUX keynote
ModUX keynote
Ā 
Exploring the Possibilities of Sencha and WebRTC
Exploring the Possibilities of Sencha and WebRTCExploring the Possibilities of Sencha and WebRTC
Exploring the Possibilities of Sencha and WebRTC
Ā 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
Ā 
Googleā€™s PRPL Web development pattern
Googleā€™s PRPL Web development patternGoogleā€™s PRPL Web development pattern
Googleā€™s PRPL Web development pattern
Ā 
Webpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ StepsWebpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ Steps
Ā 
PRPL Pattern with Webpack and React
PRPL Pattern with Webpack and ReactPRPL Pattern with Webpack and React
PRPL Pattern with Webpack and React
Ā 
Frustration-Free Packaging of Ext JS 5 Applications
Frustration-Free Packaging of Ext JS 5 ApplicationsFrustration-Free Packaging of Ext JS 5 Applications
Frustration-Free Packaging of Ext JS 5 Applications
Ā 
Back to the Future with ES.next
Back to the Future with ES.nextBack to the Future with ES.next
Back to the Future with ES.next
Ā 
Measuring Web Performance
Measuring Web Performance Measuring Web Performance
Measuring Web Performance
Ā 
Technology stack behind Airbnb
Technology stack behind Airbnb Technology stack behind Airbnb
Technology stack behind Airbnb
Ā 
Responsive Images and Performance
Responsive Images and PerformanceResponsive Images and Performance
Responsive Images and Performance
Ā 
La Web Salta al Mundo FĆ­sico - Web meets Physical World (spanish)
La Web Salta al Mundo FĆ­sico - Web meets Physical World (spanish)La Web Salta al Mundo FĆ­sico - Web meets Physical World (spanish)
La Web Salta al Mundo FĆ­sico - Web meets Physical World (spanish)
Ā 
Extreme Web Performance for Mobile Devices - Velocity NY
Extreme Web Performance for Mobile Devices - Velocity NYExtreme Web Performance for Mobile Devices - Velocity NY
Extreme Web Performance for Mobile Devices - Velocity NY
Ā 

Similar to High Performance Web Sites - 2008

č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
fish_yy
Ā 
14 Tips For Faster Web Apps
14 Tips For Faster Web Apps14 Tips For Faster Web Apps
14 Tips For Faster Web Apps
ashok kumar
Ā 
Web Performance 101 - Gil Givati
Web Performance 101 - Gil GivatiWeb Performance 101 - Gil Givati
Web Performance 101 - Gil Givati
Mika Josting
Ā 
Capacity Planning For Web Operations Presentation
Capacity Planning For Web Operations PresentationCapacity Planning For Web Operations Presentation
Capacity Planning For Web Operations Presentation
jward5519
Ā 
Capacity Planning For Web Operations Presentation
Capacity Planning For Web Operations PresentationCapacity Planning For Web Operations Presentation
Capacity Planning For Web Operations Presentation
jward5519
Ā 
Rails Performance Tricks and Treats
Rails Performance Tricks and TreatsRails Performance Tricks and Treats
Rails Performance Tricks and Treats
Marshall Yount
Ā 
Web前ē«Æę€§čƒ½åˆ†ęžå·„å…·åƼ引
Web前ē«Æę€§čƒ½åˆ†ęžå·„å…·åƼ引Web前ē«Æę€§čƒ½åˆ†ęžå·„å…·åƼ引
Web前ē«Æę€§čƒ½åˆ†ęžå·„å…·åƼ引
冰 郭
Ā 

Similar to High Performance Web Sites - 2008 (20)

č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
Ā 
č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
č…¾č®Æå¤§č®²å ‚09 如何å»ŗč®¾é«˜ę€§čƒ½ē½‘ē«™
Ā 
14 Tips For Faster Web Apps
14 Tips For Faster Web Apps14 Tips For Faster Web Apps
14 Tips For Faster Web Apps
Ā 
Web Performance 101 - Gil Givati
Web Performance 101 - Gil GivatiWeb Performance 101 - Gil Givati
Web Performance 101 - Gil Givati
Ā 
Front End page speed performance improvements for Drupal
Front End page speed performance improvements for DrupalFront End page speed performance improvements for Drupal
Front End page speed performance improvements for Drupal
Ā 
Front End page speed performance improvements for Drupal
Front End page speed performance improvements for DrupalFront End page speed performance improvements for Drupal
Front End page speed performance improvements for Drupal
Ā 
Scaling Drupal: Not IF... HOW
Scaling Drupal: Not IF... HOWScaling Drupal: Not IF... HOW
Scaling Drupal: Not IF... HOW
Ā 
Page Performance
Page PerformancePage Performance
Page Performance
Ā 
Web Performance 101
Web Performance 101Web Performance 101
Web Performance 101
Ā 
ėøŒė¼ģš°ģ €ģ— ė‚ ź°œė„¼ ė‹¬ģž
ėøŒė¼ģš°ģ €ģ— ė‚ ź°œė„¼ ė‹¬ģžėøŒė¼ģš°ģ €ģ— ė‚ ź°œė„¼ ė‹¬ģž
ėøŒė¼ģš°ģ €ģ— ė‚ ź°œė„¼ ė‹¬ģž
Ā 
Capacity Planning For Web Operations Presentation
Capacity Planning For Web Operations PresentationCapacity Planning For Web Operations Presentation
Capacity Planning For Web Operations Presentation
Ā 
Capacity Planning For Web Operations Presentation
Capacity Planning For Web Operations PresentationCapacity Planning For Web Operations Presentation
Capacity Planning For Web Operations Presentation
Ā 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimization
Ā 
Voices that matter: High Performance Web Sites
Voices that matter: High Performance Web SitesVoices that matter: High Performance Web Sites
Voices that matter: High Performance Web Sites
Ā 
My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013
Ā 
Site Performance Optimization - Joomla!
Site Performance Optimization - Joomla!Site Performance Optimization - Joomla!
Site Performance Optimization - Joomla!
Ā 
Rails Performance Tricks and Treats
Rails Performance Tricks and TreatsRails Performance Tricks and Treats
Rails Performance Tricks and Treats
Ā 
Web前ē«Æę€§čƒ½åˆ†ęžå·„å…·åƼ引
Web前ē«Æę€§čƒ½åˆ†ęžå·„å…·åƼ引Web前ē«Æę€§čƒ½åˆ†ęžå·„å…·åƼ引
Web前ē«Æę€§čƒ½åˆ†ęžå·„å…·åƼ引
Ā 
Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)
Ā 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
Ā 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(ā˜Žļø+971_581248768%)**%*]'#abortion pills for sale in dubai@
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
Ā 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Ā 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
Ā 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
Ā 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Ā 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Ā 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
Ā 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Ā 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Ā 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Ā 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
Ā 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
Ā 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Ā 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Ā 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Ā 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
Ā 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Ā 

High Performance Web Sites - 2008

  • 1. High Performance Web Sites Tips for faster pages Nate Koechley natek@yahoo-inc.com nate.koechley.com/blog developer.yahoo.com/yui
  • 2. Y! Performance Research Engineering Team ā€¢ Tenni Theurer, Nicole Sullivan, Philip Tellis, Stoyan Stefanov, Swapni Shinde, Wayne Shea, Anand Kishore (Intern)
  • 4. 1: Because fast is better
  • 5. 5
  • 6.
  • 7.
  • 8. 8
  • 9. 9
  • 10. 10
  • 11. 11
  • 12. 2: Because sites are bigger
  • 13. Modern web sites & applications have changed architecturally.
  • 14. From 2003 to 2008: 97K to 312K. 25.7 to 49.9 objects.
  • 15. In past 12 months, Top 1000 sites: From 250K to 310.4K. WebSiteOptimization.com/speed/tweak/average-web-page
  • 17. Two Flavors: Response Time & System Efļ¬ciency
  • 18. Our focus is the response time of web products
  • 21. perceived response time slow crawl boring snail performance speed enjoyable stagnant unexceptional urgent instant accelerate yawn perceptionunresponsive impatient delay snap achievement moderate blah subdue better improve action pleasant drag apathetic prolong slack load sluggish sleepy pace quick promote swift cool late unexciting reduced lag maximum drive prompt advance complex heavy unmemorable fast hurry rush satisfying feel obscure brisk rapid exciting exceptional wait why
  • 22. perceived response time slow crawl boring snail stagnant performance speed enjoyable unexceptional yawn urgent instant accelerate unresponsive impatient delay perception snap achievement moderate blah subdue drag apathetic better improve action pleasant prolong slack load sluggish sleepy pace quick promote swift cool late unexciting reduced lag maximum drive prompt advance complex heavy unmemorable fast hurry rush satisfying feel obscure brisk rapid exciting exceptional wait why what is the end userā€™s experience?
  • 23. Itā€™s in the eye of the beholder ā€¢ Perception and usability are important performance metrics. ā€¢ More relevant than actual unload-to-onload time. ā€¢ Deļ¬nition of quot;user onloadquot; is undeļ¬ned or varies from one web page to the next.
  • 24. 2 ā€œ80% of consequences come from 20% of causesā€ ā€”Vilfredo Pareto
  • 25. The Importance of Front-End Performance
  • 26. The Importance of Front-End Performance Back-end = 5%
  • 27. The Importance of Front-End Performance Front-end = 95%
  • 28. The Importance of Front-End Performance Even here, front-end = 88%
  • 29.
  • 30. Back-end vs. Front-end Empty Cache Full Cache amazon.com 82% 86% aol.com 94% 86% cnn.com 81% 92% ebay.com 98% 92% google.com 86% 64% msn.com 97% 95% myspace.com 96% 86% wikipedia.org 80% 88% yahoo.com 95% 88% youtube.com 97% 95%
  • 31. Until now our optimization efforts have targeted the tip of the iceberg.
  • 35. Empty vs. Full Cache 2 3 1 user re-requests user requests user requests www.yahoo.com www.yahoo.com other web pages
  • 36. Empty vs. Full Cache 2 3 1 dns lookup html image image dns lookup script image image image image user re-requests user requests user requests image image www.yahoo.com www.yahoo.com other web pages image image script image image image image image image image image script dns lookup image image image image image dns lookup script script stylesheet image with an empty cache 0 0.5 1 1.5 2 2.5 3
  • 37. Empty vs. Full Cache 2 3 1 dns lookup html image image dns lookup script image image image image user re-requests user requests user requests image image www.yahoo.com www.yahoo.com other web pages image image script image image image image image image image image script dns lookup image image image image image dns lookup script script stylesheet image with an empty cache 0 0.5 1 1.5 2 2.5 3
  • 38. Empty vs. Full Cache 2 3 1 user re-requests user requests user requests www.yahoo.com www.yahoo.com other web pages
  • 39. Empty vs. Full Cache 2 3 1 user re-requests user requests user requests www.yahoo.com www.yahoo.com other web pages
  • 40. Empty vs. Full Cache 2 3 1 user re-requests user requests user requests www.yahoo.com www.yahoo.com other web pages
  • 42. Empty vs. Full Cache empty = 2.4 seconds full = 0.9 second full = 83% fewer bytes. full = 90% fewer HTTP requests.
  • 43. 3b (sadly, the cache doesnā€™t work as well as we wish it did.)
  • 44. How much does caching beneļ¬t our users?
  • 45. How much does caching beneļ¬t our users? Q1: What % of unique users view a page with an empty cache?
  • 46. How much does caching beneļ¬t our users? Q1: What % of unique users view a page with an empty cache? Q2: What % of page views are with an empty cache?
  • 47. Browser Cache Experiment Add a new image to your page <img src=quot;image/blank.gifquot; height=quot;1quot; width=quot;1quot;/> }1 px with the following response headers: Expires: Thu, 15 Apr 2004 20:00:00 GMT Last-Modified: Wed, 28 Sep 2006 23:49:57 GMT
  • 48. Browser Cache Experiment Add a new image to your page <img src=quot;image/blank.gifquot; height=quot;1quot; width=quot;1quot;/> }1 px with the following response headers: Expires: Thu, 15 Apr 2004 20:00:00 GMT Last-Modified: Wed, 28 Sep 2006 23:49:57 GMT
  • 49. Browser Cache Experiment Two possible response codes: 200 ā€“ The browser does not have the image in its cache. 304 ā€“ The browser has the image in its cache, but needs to verify the last modiļ¬ed date.
  • 50. Browser Cache Experiment # unique users with at least Q1: What % of one 200 response unique users view total # unique users with an empty cache? total # of 200 responses Q2: What % of page # of 200 + # of 304 responses views are with an empty cache? }1 px
  • 51. Surprising Results 1.00 0.75 0.50 0.25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 uu w/ empty cache pv w/ empty cache
  • 52. Surprising Results 1.00 0.75 0.50 0.25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 uu w/ empty cache pv w/ empty cache
  • 53. 40-60% UUs w/ empty cache 20% PVs w/ empty cache
  • 54. Experiment Takeaways 1. The empty cache user experience is more prevalent than you think! 2. Therefore, optimize for both full cache and empty cache experience.
  • 58. Set Scope Correctly 1 user requests www.yahoo.com HTTP response header sent by the web server: HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Set-Cookie: C=abcdefghijklmnopqrstuvwxyz; domain=.yahoo.com
  • 59. Because broad scope adds up 2 1 user requests user requests finance.yahoo.com www.yahoo.com HTTP request header sent by the browser: GET / HTTP/1.1 Host: finance.yahoo.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; ā€¦ Cookie: C=abcdefghijklmnopqrstuvwxyz;
  • 60. Impact on Response Time Cookie Size Time Delta 0 bytes 78 ms 0 ms 500 bytes 79 ms +1 ms 1000 bytes 94 ms +16 ms 1500 bytes 109 ms +31 ms 2000 bytes 125 ms +47 ms 2500 bytes 141 ms +63 ms 3000 bytes 156 ms +78 ms
  • 61. Cookie Sizes across the Web Total Cookie Size Amazon 60 bytes Google 72 bytes Yahoo 122 bytes CNN 184 bytes YouTube 218 bytes MSN 268 bytes eBay 331 bytes MySpace 500 bytes
  • 62. Experiment Takeaways ā€¢ eliminate unnecessary cookies ā€¢ keep cookie sizes low ā€¢ set cookies at the appropriate domain (or sub-domain) level ā€¢ set Expires date appropriately
  • 65. Parallel Downloads Two components in parallel per hostname GIF GIF GIF GIF GIF GIF per HTTP/1.1
  • 67. Parallel Downloads html component component Two in parallel component component component component component component component component 0 0.425 0.850 1.275 1.700 Four in parallel Eight in parallel
  • 68. Parallel Downloads html component component Two in parallel component component component component component component component component 0 0.425 0.850 1.275 1.700 html component component component Four in parallel component component component component component component component 0 0.375 0.750 1.125 1.500 Eight in parallel
  • 69. Parallel Downloads html component component Two in parallel component component component component component component component component 0 0.425 0.850 1.275 1.700 html component component component Four in parallel component component component component component component component 0 0.375 0.750 1.125 1.500 html component component component component component Eight in parallel component component component component component 0 0.375 0.750 1.125 1.500
  • 70. Maximizing Parallel Downloads response time (seconds) aliases
  • 71. Maximizing Parallel Downloads 1.4 36 x 36 px (0.9 Kb) 116 x 61 px (3.4 Kb) 1.2 1.0 0.8 response time (seconds) 0.6 0.4 0.2 0 1 2 4 5 10 aliases
  • 72. Maximizing Parallel Downloads 1.4 36 x 36 px (0.9 Kb) 116 x 61 px (3.4 Kb) average 1.2 1.0 0.8 response time (seconds) 0.6 0.4 0.2 0 1 2 4 5 10 aliases
  • 73. Maximizing Parallel Downloads 1.4 36 x 36 px (0.9 Kb) 116 x 61 px (3.4 Kb) average 1.2 1.0 0.8 response time (seconds) 0.6 0.4 0.2 0 1 2 4 5 10 rule of thumb: use at least 2 but no more than 4 aliases
  • 74. Experiment Takeaways ā€¢ beware the effects of CPU thrashing ā€¢ DNS lookup times vary across ISPs and geographic locations ā€¢ domain names may not be cached
  • 77. Summary What the 80/20 Rule Tells Us about Reducing HTTP Requests http://yuiblog.com/blog/2006/11/28/performance-research-part-1/ Browser Cache Usage ā€“ Exposed! http://yuiblog.com/blog/2007/01/04/performance-research-part-2/ When the Cookie Crumbles http://yuiblog.com/blog/2007/03/01/performance-research-part-3/ Maximizing Parallel Downloads in the Carpool Lane http://yuiblog.com/blog/2007/04/11/performance-research-part-4/
  • 79. Rule: Make fewer HTTP requests. ā€¢ CSS sprites ā€¢ Combined / concatenated JS and CSS ļ¬les ā€¢ image maps ā€¢ inline (data) images
  • 80. CSS Sprites <span style=quot; background-image: url('sprites.gif'); background-position: -260px -90px;quot;> </span> size of combined image is less http://alistapart.com/articles/sprites
  • 81. Combined Scripts, Combined Stylesheets Scripts Stylesheets amazon.com 3 1 aol.com 18 1 cnn.com 11 2 ebay.com 7 2 froogle.google.com 1 1 msn.com 9 1 myspace.com 2 2 wikipedia.org 3 1 yahoo.com 4 1 youtube.com 7 3 Average 6.5 1.5
  • 82. (This could well be) The End.
  • 83. Rule: Use a CDN amazon.com Akamai aol.com Akamai cnn.com ebay.com Akamai, Mirror Image google.com msn.com SAVVIS myspace.com Akamai, Limelight wikipedia.org yahoo.com Akamai youtube.com distribute your static content before distributing your dynamic content
  • 84. Rule: Add an Expires header (not just for images) Median Images Stylesheets Scripts % Age amazon.com 0/62 0/1 0/3 0% 114 days aol.com 23/43 1/1 6/18 48% 217 days cnn.com 0/138 0/2 2/11 1% 227 days ebay.com 16/20 0/2 0/7 55% 140 days froogle.google.com 1/23 0/1 0/1 4% 454 days msn.com 32/35 1/1 3/9 80% 34 days myspace.com 0/18 0/2 0/2 0% 1 day wikipedia.org 6/8 1/1 2/3 75% 1 day yahoo.com 23/23 1/1 4/4 100% n/a youtube.com 0/32 0/3 0/7 0% 26 days
  • 86. Rule: Gzip components ā€¢ you can aect users' download times ā€¢ 90%+ of browsers support compression
  • 87. Gzip: not just for HTML HTML Scripts Stylesheets amazon.com x aol.com x some some cnn.com ebay.com x froogle.google.com x x x msn.com x deļ¬‚ate deļ¬‚ate myspace.com x x x wikipedia.org x x x yahoo.com x x x youtube.com x some some gzip scripts, stylesheets, XML, JSON (not images, PDF)
  • 88.
  • 89. YUIā€™s Free Hosting: ā€¢ Aggregated ļ¬les ā€¢ With Expires headers ā€¢ On a CDN ā€¢ Gzipped
  • 90. Rule: Put CSS at the top ā€¢ stylesheets block rendering in IE ā€¢ solution: put stylesheets in HEAD (per spec) ā€¢ avoids Flash of Unstyled Content use link (not @import)
  • 92. Rule: Choose link over @import ā€¢ When you use @import you override the browsersā€™ native performance assistance.
  • 93. Rule: Move scripts to the bottom ā€¢ scripts block rendering of everything below them in the page ā€¢ scripts block parallel downloads across all hostnames
  • 94. What about defer? script defer attribute is not a solution ā€¢ blocks rendering and downloads in FF ā€¢ slight blocking in IE
  • 95. Rule: Avoid CSS expressions Can be used to set CSS properties dynamically in IE width: expression( document.body.clientWidth 600 ? ā€œ600pxā€ : ā€œautoā€ ); But problematic because expressions execute many times ā€“ mouse move, key press, resize, scroll, etc.
  • 96. Rule: Make JS CSS external Inline: bigger HTML but no HTTP request External: cachable but extra HTTP Variables: ā€“ page views per user (per session) ā€“ empty vs. full cache stats ā€“ component re-use External is typically better ā€“ home pages may be an exception due to cache behavior of browserā€™s startpage.
  • 97. Rule: Reduce DNS lookups typically 20-120 ms block parallel downloads OS and browser both have DNS caches Best practice: Max 2-4 hosts Use keep-alive
  • 98. Rule: Minify JavaScript Minify Minify Inline? External? www.amazon.com no no www.aol.com no no www.cnn.com no no www.ebay.com yes no froogle.google.com yes yes www.msn.com yes yes www.myspace.com no no www.wikipedia.org no no www.yahoo.com yes yes www.youtube.com no no donā€™t forget to minify inline scripts, too
  • 99. Which Compressor? ā€¢ YUI Compressor is highly regarded ā€¢ web search ā€œCompressorRaterā€
  • 100. Rule: Avoid redirects 3xx status codes ā€“ mostly 301 and 302 HTTP/1.1 301 Moved Permanently Location: http://yahoo.com/newuri add Expires headers so redirect headers are cached Redirects are worst form of blocking http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
  • 101. Rule: Make AJAX cacheable and small ā€¢ XHR, JSON, iframe, dynamic scripts can still be cached, miniļ¬ed, and gzipped ā€¢ a personalized response should still be cacheable by that person
  • 102. Rule: Use GET for AJAX Requests ā€¢ POST is a two-step process. ā€¢ GET can send in one packet. Use if possible. ā€¢ Max payload is 2K in IE.
  • 103. Rule: Post-load Components ā€¢ Delay all non-crucial elements. ā€¢ YUI Image Loader offers precise control. ā€¢ YUI Get makes on-the-ļ¬‚y JS CSS easy. ā€¢ Used on www.yahoo.com homepage.
  • 104. Rule: Preload Components ā€¢ Unconditional preload - all following onload ā€¢ Ex: google.comā€™s sprite ā€¢ Conditional preload - based on user action ā€¢ Ex: search.yahoo.comā€™s Search Assist ā€¢ Anticipated preload - give redesigns a boost
  • 105. Rule: Minimize iFrames ā€¢ Costly even if blank ā€¢ Blocks page onload ā€¢ Questionable semantic value
  • 106. Rule: Smart Event Handles ā€¢ Event Delegation to reduce total number ā€¢ onAvailable (etc) for earlier access ā€¢ YUI Event has onAvailable, onContentReady, onDomReady
  • 107. Rule: Optimize CSS Sprites ā€¢ Horizontal alignment is usually smaller than vertical. ā€¢ Combine similar colors in a sprite to minimize color count. ā€¢ Only 256 colors can ļ¬t in a PNG8. ā€¢ Be mobile-friendly. Avoid big gaps between images. Minimal impact on k-size, but takes more memory to decompress.
  • 108. Rule: favicon.ico ā€¢ Always provide a favicon.ico so the request doesnā€™t 404 ā€¢ And the request carries cookies ā€¢ Mitigate by setting an expires header, ā€¢ (but NOT forever since you canā€™t rename the ļ¬le.) ā€¢ Keep under 1K
  • 109. Rule: iPhone-Friendly Tip ā€¢ iPhone will not cache assets larger than 25K ā€¢ Thatā€™s 25K uncompressed. ā€¢ http://yuiblog.com/blog/2008/02/06/iphone- cacheability/
  • 110. Tools for your own analysis
  • 111. IBM Page Detailer Packet sniffer. Windows only (IE, FF, any .exe). Free trial, $300 license http://alphaworks.ibm.com/tech/ pagedetailer
  • 112. LiveHTTPHeaders View HTTP headers. Firefox extension. Free.
  • 113. Firebug ā€¢ web development evolved ā€¢ inspect and edit HTML, tweak and visualize CSS, debug and proļ¬le JavaScript ā€¢ monitor network activity (caveat: caching) ā€¢ Free Firefox extension
  • 115. YSlow ā€¢ Extension for Firebug extension ā€¢ Performance report card ā€¢ HTTP/HTML summary ā€¢ List of components in the page ā€¢ Tools including JSLint
  • 116.
  • 118. Takeaways ā€¢ focus on the front-end ā€¢ harvest the low-hanging fruit ā€¢ reduce HTTP requests ā€¢ enable caching ā€¢ you do control user response times ā€¢ LOFNO ā€“ be an advocate for your users
  • 120. High Performance Web Sites Essential Knowledge for Front-End Engineers by Steve Souders, with research from Yahoo!ā€™s Performance Engineering team.
  • 121. Exceptional Performance on YDN http://developer.yahoo.com/ performance
  • 123. Letā€™s keep talking... nate@koechley.com http://nate.koechley.com/blog ā€œnatekoechleyā€ Thanks again to Yahoo!ā€™s Exceptional Performance Engineering Team
  • 124. Links book: http://www.oreilly.com/catalog/9780596514211/ examples: http://stevesouders.com/examples/ image maps: http://www.w3.org/TR/html401/struct/objects.html#h-13.6 CSS sprites: http://alistapart.com/articles/sprites inline images: http://tools.ietf.org/html/rfc2397 jsmin: http://crockford.com/javascript/jsmin dojo compressor: http://dojotoolkit.org/docs/shrinksafe HTTP status codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html IBM Page Detailer: http://alphaworks.ibm.com/tech/pagedetailer Fasterfox: http://fasterfox.mozdev.org/ LiveHTTPHeaders: http://livehttpheaders.mozdev.org/ Firebug: http://getļ¬rebug.com/ YUIBlog: http://yuiblog.com/blog/2006/11/28/performance-research-part-1/ http://yuiblog.com/blog/2007/01/04/performance-research-part-2/ http://yuiblog.com/blog/2007/03/01/performance-research-part-3/ http://yuiblog.com/blog/2007/04/11/performance-research-part-4/ YDN: http://developer.yahoo.net/blog/archives/2007/03/high_performanc.html http://developer.yahoo.net/blog/archives/2007/04/rule_1_make_few.html
  • 125. CC Images Used ā€œZipper Pocketā€ by jogales: http://www.ļ¬‚ickr.com/photos/jogales/11519576/ ā€œNeed for Speedā€ by Amnemona: http://www.ļ¬‚ickr.com/photos/marinacvinhal/379111290/ ā€œI wonder what ļ¬‚avour it is?ā€ by blather: http://www.ļ¬‚ickr.com/photos/deadlyphoto/411770353/ ā€œtakeout boxes from Grand Shanghaiā€ by massdistraction: http://www.ļ¬‚ickr.com/photos/sharynmorrow/ 11263821/ ā€œtakeoutā€ by dotpolka : http://www.ļ¬‚ickr.com/photos/dotpolka/249129144/ ā€œice cream cone melting/romeā€ by Megandavid : http://www.ļ¬‚ickr.com/photos/megandavid/189332042/ ā€œnikon em bokehā€ by dsevilla: http://www.ļ¬‚ickr.com/photos/dsevilla/249202834/ ā€œmaybeā€ by Tal Bright: http://www.ļ¬‚ickr.com/photos/bright/118197469/ ā€œhow do they do thatā€ by Fort Photo: http://www.ļ¬‚ickr.com/photos/fortphoto/388825145/ ā€œGorgeous iceberg 7 [Le Toit du Monde]ā€ by Adventure Addict http://www.ļ¬‚ickr.com/photos/ adventureaddict/35290307/ ā€œmolasses-spice cookiesā€ ilmungo: http://www.ļ¬‚ickr.com/photos/ilmungo/65345233/ ā€œDriving is funā€ by Ben McLeod: http://www.ļ¬‚ickr.com/photos/benmcleod/59948935/ ā€œDozen eggsā€ by aeA: http://www.ļ¬‚ickr.com/photos/raeallen/96238870/ ā€œMax speed 15kmhā€ by xxxtoff: http://www.ļ¬‚ickr.com/photos/xxxtoff/219781763/ ā€œStairway to heavenā€ ognita: http://www.ļ¬‚ickr.com/photos/ognita/503915547/ ā€œļ¬‚aps upā€ by http://www.ļ¬‚ickr.com/photos/jurvetson/74274113/ ā€œFast Catā€ by http://www.ļ¬‚ickr.com/photos/raylopez/708023176/
  • 126. nate@koechley.com http://nate.koechley.com/blog natekoechley = twitter, delicious, flickr, tripit, last.fm, linkedin, fireeagle, friendfeed, ... everywhere. Thanks again to Yahoo!ā€™s Exceptional Performance Engineering Team