steve souders [email protected] disclaimer: this content does not necessarily reflect the opinions...

17
Steve Souders [email protected] http://stevesouders.com/ Disclaimer: This content does not necessarily reflect the opinions of my High Performance Web Sites Essential Knowledge for Frontend Engineers

Upload: hunter-graves

Post on 27-Mar-2015

228 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Steve [email protected]://stevesouders.com/

Disclaimer: This content does not necessarily reflect the opinions of my employer.

High Performance Web Sites

Essential Knowledge for Frontend Engineers

Page 2: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

17%

83%

iGoogle, primed cache

The Importance of Frontend Performance

9% 91%

iGoogle, empty cache

Page 3: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Time Spent on the Frontend

Empty Cache

Primed Cache

www.aol.com 97% 97%

www.ebay.com 95% 81%

www.facebook.com 95% 81%

www.google.com/search

47% 25%

search.live.com/results 67% 0%

www.msn.com 98% 94%

www.myspace.com 98% 98%

en.wikipedia.org/wiki 94% 91%

www.yahoo.com 97% 96%

www.youtube.com 98% 97%

Page 4: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

The Performance Golden Rule

80-90% of the end-user response time is spent on the frontend. Start there.

greater potential for improvement

simpler

proven to work

Page 5: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

14 Rules1. Make fewer HTTP

requests2. Use a CDN3. Add an Expires header4. Gzip components5. Put stylesheets at the

top6. Put scripts at the

bottom7. Avoid CSS expressions8. Make JS and CSS

external9. Reduce DNS lookups10.Minify JS11.Avoid redirects12.Remove duplicate

scripts13.Configure ETags14.Make AJAX cacheable

Page 6: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

High Performance Web Sites

YSlow

Page 7: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

http://conferences.oreilly.com/velocity/ 20% discount: vel08st

Page 8: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Rule 1: Make fewer HTTP requests

CSS sprites

combined scripts, combined stylesheets

image maps

inline images

Page 9: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

CSS Sprites

size of combined image is less

<span style="

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

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

</span>

Page 10: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Rule 3: Add an Expires header not just for images

Images

Stylesheets

Scripts

% with

Expires

Median 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

google.com/ig 8/14 1/1 2/3 65% 8 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

Page 11: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Rule 5: Put stylesheets at the top

stylesheets block rendering in IE

solution: put stylesheets in HEAD (per spec)

avoids Flash of Unstyled Content

use LINK (not @import)

Page 12: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Rule 6: Move scripts to the bottom

scripts block parallel downloads across all hostnames

scripts block rendering of everything below them in the page

move scripts as low in the page as possible

Page 13: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Even Faster Web Sites

1. Split the initial payload2. Load scripts without blocking3. Don't scatter scripts4. Split dominant content domains5. Make static content cookie-free6. Reduce cookie weight7. Minify CSS8. Optimize images9. Use iframes sparingly10.To www or not to www

Page 14: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

AOLeBayFacebookMySpaceWikipediaYahoo!YouTube

Why focus on JavaScript?

Page 15: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Live Analysis

Page 16: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Takeaways

focus on the frontend

run YSlow: http://developer.yahoo.com/yslow

Velocity: http://conferences.oreilly.com/velocity/

speed matters

you CAN make your site even faster!

Page 17: Steve Souders souders@google.com  Disclaimer: This content does not necessarily reflect the opinions of my employer. High Performance

Steve [email protected]://stevesouders.com/