Faster front end performance

75
Faster Front End Performance Dan Mouyard Matt Farina

description

Faster front end performance for Drupal sites from DrupalCon Chicago.

Transcript of Faster front end performance

Page 1: Faster front end performance

Faster Front End PerformanceDan MouyardMatt Farina

Page 2: Faster front end performance

VarnishWeb HeadsClusterWeb Heads

MySQL SlaveCDNOpcode CacheMemcache

Page 3: Faster front end performance
Page 4: Faster front end performance

Front End Performance?

Page 5: Faster front end performance
Page 6: Faster front end performance

Dan MouyardTerpSys

Accessibility & Performance Focused Themer

3 Years With Drupal

World Champion Old-Time Piano Player

(dcmouyard)

Page 7: Faster front end performance

Matt FarinaPalantir.net

Co-Author of Drupal 7 Module Development

Core Contributor

Over 5.5 Years With Drupal

(mfer)

Page 8: Faster front end performance

Who sees slow sites?

http://www.flickr.com/photos/valeriebb/3006348550/

Page 9: Faster front end performance

Internet Explorer Users

Page 10: Faster front end performance

44%

56%

Other Browsers Internet Explorer

http://en.wikipedia.org/wiki/Usage_share_of_web_browsers

Page 11: Faster front end performance

http://www.flickr.com/photos/tagzania/3117584313/

Mobile Users

Page 12: Faster front end performance

http://www.flickr.com/photos/csessums/4460821479/

Slow Connection Speeds

Page 13: Faster front end performance

Why Does It Matter?

Page 14: Faster front end performance

http://www.flickr.com/photos/vectorportal/4929890104/

Satisfied Users

Page 15: Faster front end performance

SEO

Page 16: Faster front end performance

Toolbox

http://www.flickr.com/photos/dipster1/1403240351/

Page 17: Faster front end performance

YSlow

Page 18: Faster front end performance

Page Speed

Page 19: Faster front end performance

Minify Savings (JSMin)

Page 20: Faster front end performance

Logged In

Page 21: Faster front end performance

Appearance Editor Yikes!

Page 22: Faster front end performance

JSMin

YUI Compressor

Google Closure Compiler

UglifyJS

Page 23: Faster front end performance

Waterfall Diagrams

Page 24: Faster front end performance
Page 25: Faster front end performance
Page 26: Faster front end performance

6 Connections Per Domain

Page 27: Faster front end performance

IE 6/7 Two Per Domain

Page 28: Faster front end performance

Slow High Speed Connections?

48 KiB/s384 kbps

Page 29: Faster front end performance

Real World Numbers

49 - 514 KiB/s392 - 4112 kbps

Page 30: Faster front end performance

Throttling Proxy Throttling Proxy

Page 31: Faster front end performance
Page 32: Faster front end performance

Pulling From Cache

Page 33: Faster front end performance

Under Slow 3G Speeds

Page 34: Faster front end performance

Images

Page 35: Faster front end performance

Quantity

Page 36: Faster front end performance

Filesize

Page 37: Faster front end performance

Graphics Interchange Format

GIF

Page 38: Faster front end performance

JPEG

Joint Photographic Experts Group

Page 39: Faster front end performance

PNG

Portable Network Graphics

Page 40: Faster front end performance

Graphics

Page 41: Faster front end performance

Graphics

PNG8, GIF

Page 42: Faster front end performance

Photographs

Page 43: Faster front end performance

Photographs

JPEG, PNG

Page 44: Faster front end performance
Page 45: Faster front end performance
Page 46: Faster front end performance

PNG Transparency

Page 47: Faster front end performance

PNG Transparency

No AlphaImageLoader for IE6!

Page 48: Faster front end performance

Image Compression

Page 49: Faster front end performance
Page 50: Faster front end performance

Image Styles

Page 51: Faster front end performance

CSS Sprites

Page 52: Faster front end performance

CSS Sprites

Page 53: Faster front end performance

CSS Sprites

Page 54: Faster front end performance
Page 55: Faster front end performance
Page 56: Faster front end performance
Page 57: Faster front end performance

269.6 kb

37 CSS Images

Page 58: Faster front end performance

88.7 kb

4 CSS Images

Page 59: Faster front end performance

Cache Theme Images

.htaccess, web.config

Page 60: Faster front end performance

CSS & JS

Page 61: Faster front end performance

page.tpl.php    <html>        <head>            $styles        </head>        <body>            $scripts            $closure        </body>    </html>

Placement in Drupal 6

Page 62: Faster front end performance

html.tpl.php    <html>        <head>            $styles        </head>        <body>            $scripts            $page_bottom        </body>    </html>

Placement in Drupal 7

Page 63: Faster front end performance

Selector Performance

Page 64: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

Quick! Get that link!

Page 65: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

div#nav  ul.nav-­‐list  li  a

Quick! Get that link!

Page 66: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

#nav  .nav-­‐list  li  a

Quick! Get that link!

Page 67: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

#nav  >  .nav-­‐list  >  li  >  a

Quick! Get that link!

Page 68: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

#nav  a

Quick! Get that link!

Page 69: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

#nav  a

Quick! Get that link!

* Never use the universal selector!

Page 70: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

#nav  .nav-­‐link

Quick! Get that link!

Page 71: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

#nav  #menu-­‐link-­‐42

Quick! Get that link!

Page 72: Faster front end performance

<div  id="nav">    <ul  class="nav-­‐list">        <li  class="nav-­‐item">            <a  id="menu-­‐link-­‐42"  class="nav-­‐link"></a>        </li>    </ul></div>

#menu-­‐link-­‐42

Quick! Get that link!

Page 73: Faster front end performance

People view web pages in browsershtml, images, css, jsserver side performance != seen performance for users

Resources

• Even Faster Websites by Steve Souders• Steve Souders blog - http://stevesouders.com/• Web Performance Best Practices - http://code.google.com/speed/page-speed/docs/rules_intro.html• YDN Performance - http://developer.yahoo.com/performance/

Page 74: Faster front end performance

Q&A

Page 75: Faster front end performance

What did you think?

Locate this session on the DCC website:http://chicago2011.drupal.org/sessions

Click the “Take the Survey” link.

Thanks!