measuring web performance

87
Measuring Web Performance Dave Olsen, @dmolsen West Virginia University RWD Summit http://flic.kr/p/7A8xxN

Upload: dave-olsen

Post on 27-Jan-2015

16.997 views

Category:

Technology


0 download

DESCRIPTION

Today, a web page can be delivered to desktop computers, televisions, or handheld devices like tablets or phones. While a technique like responsive design helps ensure that our web sites look good across that spectrum of devices we may forget that we need to make sure that our web sites also perform well across that same spectrum. More and more of our users are shifting their Internet usage to these more varied platforms and connection speeds with some moving entirely to mobile Internet. In this session we’ll look at the tools that can help you understand, measure and improve the web performance of your web sites and applications. The talk will also discuss how new server-side techniques might help us optimize our front-end performance. Finally, since the best way to test is to have devices in your hand, we’ll discuss some tips for getting your hands on them cheaply. This presentation builds upon Dave’s “Optimization for Mobile” chapter in Smashing Magazine’s “The Mobile Book.” This talk was given at the Responsive Web Design Summit hosted by Environments for Humans.

TRANSCRIPT

Page 1: Measuring Web Performance

MeasuringWeb PerformanceDave Olsen, @dmolsenWest Virginia UniversityRWD Summithttp://flic.kr/p/7A8xxN

Page 2: Measuring Web Performance

slideshare.net/dmolsenwvu

Page 3: Measuring Web Performance

introduction about me@dmolsen

Page 4: Measuring Web Performance

What I’ll Talk About

• Quick Intro About Why We Should Care About Web Perf

• Tools for Measuring Web Performance

• Setting Up a Device Lab

• Responsive Design + Server-side Solutions

Page 5: Measuring Web Performance

WHY SHOULD WE CARE ABOUT WEB PERFORMANCE?

http://flic.kr/p/4JY1Yr

Page 6: Measuring Web Performance

brad’s iceberg

© Brad Frost

© Brad Frost

Page 7: Measuring Web Performance

The way in which CSS media queries have been promoted for

mobile hides tough problems and gives developers a false

promise of a simple solution for designing for small screens.

Source: Jason Grigsby on Speakerdeck

” - Jason Grigsby @grigs

Page 8: Measuring Web Performance

brad’s iceberg

© Brad Frost© Brad Frost

© Brad Frost

Page 9: Measuring Web Performance

The average weight of a web page today.

Source: HTTP Archive

Images JavaScript

Flash

HTM

LC

SSOther

77%

1.3 MB

Page 10: Measuring Web Performance

RWD sites whose small screen design weighs the same as the large screen design.

Source: Podjarny

72%

Page 12: Measuring Web Performance

Bounce Rate Conversion Rate Cart Size Page Views

200ms - - - -1.2%

500ms -4.7% -1.9% - -5.7%

1000ms -8.3% -3.5% -2.1% -9.4%

CASE STUDY: MOBILE PERFORMANCE EFFECT ON BUSINESS

Source: Web Performance Today

Page 13: Measuring Web Performance

Mobile first means performance first.

(start thinking about performance at the design stage)

Page 14: Measuring Web Performance

Over Downloading

Download & HideDownload & ShrinkDownload & Ignore

PRIMARY PERFORMANCE ISSUES FOR RWD

Poor Networks

High LatencyVariable Bandwidth

Packet Loss

Page 15: Measuring Web Performance

BREAKING DOWN A REQUEST

DNS (1ms)

Connecting (61ms)

Waiting (199ms)

Receiving (790ms)

Page 16: Measuring Web Performance

MOBILE OPTIMIZATION FOCUS

1. Reduce requests2. Reduce asset size3. Speed-up page

render

http://flic.kr/p/4zzKee

Page 17: Measuring Web Performance

Best request is no request. Worst request is one that

blocks the parser.

Source: Ilya Grigorik

” - Ilya Grigorik @ilyagrigorik

Page 18: Measuring Web Performance

Browser cache

The simplest way to reduce requests is to make sure the browser doesn’t need to make them. Make sure assets are bring cached on the browser.

ConcatenateJS & CSS

Combine similar files together in one or multiple larger files to reduce requests. May harm performance too.

Lazy load content

Don’t make requests until necessary. Filament Group’s AJAX Include Pattern or lazyBlock.

data: URI For small images & fonts try embedding them in your CSS file by using the data: URI.

Conditional loading

Use a resource loader like Modernizr.load to conditionally include JavaScript & CSS files.

1. REDUCE REQUESTS

Page 19: Measuring Web Performance

HTML & CSS compression

Use mod_deflate to make sure text-based assets are compressed for transfer.

Image compression

Use a service like kraken.io to optimize images. Also use CSS sprites as appropriate.

Try to avoid images

When possible think about avoiding images. Implement with CSS or Canvas. Or use SVG or Progressive JPEGs.

Minification Use a minifying service to make sure text-based assets are as small as possible. If using PHP use Minify.

MicroJS or, even better,

Vanilla JS

Avoid using bulky frameworks if you’re using them for simple tasks like selectors. Try microjs.com to find libraries that may be smaller & more suitable. JavaScript also blocks the rendering of the page.

2. REDUCE ASSET SIZE

Page 20: Measuring Web Performance

Avoid DOM reflows &

repaints

By using JS to modify the DOM you can cause unnecessary reflows & repaints of your browser. They slow down page render time as well as burn battery.

Defer loading of JavaScript

Use HTML5’s script defer & async attributes to delay downloading files. Can also insert script elements into the DOM using the onLoad event.

Lazy load JavaScript

Comment out JavaScript that isn’t required at page load. Uncomment & eval() when required.

Touch beats onClick

While not directly related to page render, by making sure your links use a Touch event rather than an onClick event user interactions will speed up by 300ms.

Avoid SM widgets

Try using simple links to services rather than utilizing the JavaScript widgets. They’re performance hogs.

3. SPEED-UP PAGE RENDER

Page 21: Measuring Web Performance

Testing Tools

toolbox, tools

WEB PERFORMANCE TOOLS

http://flic.kr/p/4BZsQJ

Page 22: Measuring Web Performance

DiagnosticTools

AutomatedTools

Page 23: Measuring Web Performance

DiagnosticTools

AutomatedTools

Page 24: Measuring Web Performance

LEARN TO LOVE THE INSPECTOR

Page 25: Measuring Web Performance

FOLLOW ALONG BY OPENING THE DEVELOPER TOOLS IN CHROME

Page 26: Measuring Web Performance

SAVE YOURSELF A HEADACHE &DISABLE CACHE WHEN TESTING

Page 27: Measuring Web Performance

EXPLAINING THE NETWORK PANEL:RESOURCE SIZE

transferred size

real size

re-order

Page 28: Measuring Web Performance

EXPLAINING THE NETWORK PANEL:LATENCY

latency + download

latency

re-order

Page 29: Measuring Web Performance

EXPLAINING THE NETWORK PANEL:EVENTS

domcontentloaded

onload

Page 30: Measuring Web Performance

EXPLAINING THE NETWORK PANEL:SAVING HAR FILES FOR COMPARISON

save HAR file locally

Page 31: Measuring Web Performance

A narrower, shorter waterfall is the goal.

Page 32: Measuring Web Performance

http://flic.kr/p/bMdzZ2

Page 33: Measuring Web Performance

Performance

http://timkadlec.com/2013/01/setting-a-performance-budget/http://flic.kr/p/7BBs6e

A guide, not a hard & fast limit. Performance tweaks are compromises.

Page 34: Measuring Web Performance

EXPLAINING THE TIMELINE PANEL

Page 35: Measuring Web Performance

EXPLAINING THE PROFILES PANEL:CSS SELECTORS

Page 36: Measuring Web Performance

EXPLAINING THE PROFILES PANEL:CSS SELECTORS

Page 37: Measuring Web Performance

EXPLAINING THE AUDITS PANEL

Page 38: Measuring Web Performance

PAGESPEED INSIGHTS EXTENSIONhttps://developers.google.com/speed/pagespeed/insights

Page 39: Measuring Web Performance

REMOTE DEBUGGING

Page 40: Measuring Web Performance

Google Analytics Site Speed

http://www.httpwatch.comIE & FIREFOX PERFORMANCE ISSUES

Page 41: Measuring Web Performance

Google Analytics Site Speed

GOOGLE ANALYTICS’ SITE SPEED

Page 42: Measuring Web Performance

PERFORMANCE TESTING PROXIES

MobitestWebPagetest

Page 44: Measuring Web Performance

Google Analytics Site Speed

CUSTOMIZING WebPagetest:CAPTURING EVENTS AFTER ONLOAD

Page 45: Measuring Web Performance

CUSTOMIZING WebPagetest:BLACKHOLES FOR REQUESTS

Page 46: Measuring Web Performance

Google Analytics Site Speed

CUSTOMIZING WebPagetest:SCRIPTING & CUSTOM VIEWPORTS

Page 47: Measuring Web Performance

CUSTOMIZING WebPageTest:VIDEO COMPARISON

Page 48: Measuring Web Performance

CUSTOMIZING WebPageTest:VIDEO COMPARISON - SMALL VIEWPORT

Page 49: Measuring Web Performance

mobile bookmarklet

THE ULTIMATE MOBILE PERFORMANCE BOOKMARKLET

Page 50: Measuring Web Performance

charlesproxy.com

SLOWING THINGS DOWN

ThrottleCharles

Page 51: Measuring Web Performance

USING CHARLES PROXYhttp://blog.cloudfour.com/using-charles-proxy-to-examine-ios-apps/

Page 52: Measuring Web Performance

TEST & OPTIMIZE JAVASCRIPT WITH JSPERFhttp://jsperf.com

Page 53: Measuring Web Performance

W3C’s NAVIGATION TIMINGhttp://www.w3.org/TR/navigation-timing/

http://www.html5rocks.com/en/tutorials/webperformance/basics/

Page 54: Measuring Web Performance

DiagnosticTools

AutomatedTools

Page 55: Measuring Web Performance

mod_pagespeed AUTOMATES A LOThttp://developers.google.com/speed/pagespeed/mod

  add_head  combine_css   convert_jpeg_to_progressive   convert_meta_tags   extend_cache   flatten_css_imports   inline_css   inline_import_to_link   inline_javascript   rewrite_css   rewrite_images   rewrite_javascript   rewrite_style_attributes_with_url

Default Filters

Page 56: Measuring Web Performance

CodeKit

CODEKIT: WEB PERF IN YOUR WORKFLOW

  Optimize Images  Combine & Minify

Features

http://incident57.com/codekit/

Page 57: Measuring Web Performance

DEVICES

http://flic.kr/p/cfkZhN

Page 58: Measuring Web Performance

charlesproxy.com

EMULATING MOBILE DEVICES

EmulatorsBrowserStack

Page 59: Measuring Web Performance

eBay MobileKarma.com Cellphone store leftoversOpen device labs

GET YOUR HANDS ON REAL DEVICES

http://flic.kr/p/7972f6

Page 60: Measuring Web Performance

OPENDEVICELAB.COM

Page 61: Measuring Web Performance

Base on:WiFi-capable, Analytics

Rank, OS, Screen Dimensions, & Cost

Suggested focus: iPod Touch, mid-level

Android, high-end Android, a tablet, Blackberry,

Windows Phone 7

HOW TO DECIDE WHICH TO GET

iPod TouchSamsung Fascinate +Google Nexus +

$438

Example:

Page 62: Measuring Web Performance

ADOBE EDGE INSPECT(THE APP FORMERLY KNOWN AS ADOBE SHADOW)

Page 63: Measuring Web Performance
Page 64: Measuring Web Performance

RESS* can be a scalpel for your responsive designs.

REsponsive Design + Server Side Components

http

://fli

c.kr

/p/a

4VsP

v

Page 65: Measuring Web Performance

One...

URL.Set of Mark-up.

Deployment.

WHY USE RWD

Page 66: Measuring Web Performance

futurefriend.ly

Page 67: Measuring Web Performance

balloons

http://flic.kr/p/h6McT

TIME TO PARTY!

Page 68: Measuring Web Performance

http://flic.kr/p/8x6b8X

NOT SO FAST, MY FRIENDS...

Page 69: Measuring Web Performance

Image & Video Media3rd Party Content

One Set of Mark-up

CHALLENGES FOR RWD

Page 70: Measuring Web Performance

STANDARDS ARE STILL DEVELOPING

Page 71: Measuring Web Performance

What is RESS?

Page 72: Measuring Web Performance

Responsive Web Design +Server Side Components

(I have no idea what becomes of the W, D, or C)

Page 73: Measuring Web Performance

- Luke Wroblewski @lukew

http://www.lukew.com/ff/entry.asp?1392

In a nutshell, RESS combines adaptive layouts with server side component (not full page) optimization. So a single set of page templates define an entire Web site for all devices but key components within that site have device-class specific implementations that are rendered server side.

Page 74: Measuring Web Performance

http://www.lukew.com/ff/entry.asp?1509

- Luke Wroblewski @lukew

• If you want layout adjustments across devices.• And optimization at the component level to

increase performance or tune user experience.• You trust server-side device detection with

sensible defaults.

Page 75: Measuring Web Performance

DES

KTO

P W

EBM

-AD

VAN

CED

ress.dmolsen.com

MO

BILE BA

SIC

Page 76: Measuring Web Performance

Infancy

http://flic.kr/p/7B7uyp

RESS IS IN ITS INFANCY

Page 77: Measuring Web Performance

ND data

http://weedygarden.net/2012/05/a-case-for-ress/

Large Screen: 136 requests @ 2.7MB

Small Screen: 23 requests @ 291K

Page 78: Measuring Web Performance

developers and designers

http://flic.kr/p/7Ma9n

DESIGNERS + DEVELOPERS?

Page 79: Measuring Web Performance

Two Possible Solutions

Server-sideSolutions

http://flic.kr/p/9jatna

Page 80: Measuring Web Performance

Browser Detection#1

Page 81: Measuring Web Performance

Server-side Feature Detection#2

Page 82: Measuring Web Performance

• Requires server-side languages.

• Server-side feature detection so it can be spoofed.

• RESS isn’t a silver bullet.

• Data needs to be separated from layout.

CHALLENGES FOR RESS

Page 83: Measuring Web Performance

- Jon Arnes Sæterås @jonarnes

http://mpulp.mobi/2011/05/next-steps-of-responsive-web-design/

It is not only the design of the web site and the layout of content that needs to be adapted or enhanced; the idea of being responsive, adaptive and enhancing, must be implemented in the whole value chain.

Page 84: Measuring Web Performance

WEB PERF TWEEPS TO FOLLOW

@ilyagrigorik

@andydavies

@souders @patmeenan

@stoyanstefanov

@joshuabixby @yoavweiss@scottjehl

just a sampling

Page 85: Measuring Web Performance

Doug GapinskiStrategistmStoner

@thedougco

SPECIAL THANKS TO...

Page 86: Measuring Web Performance

QUESTIONS?

Page 87: Measuring Web Performance

Dave OlsenProfessional TechnologistWest Virginia University

@dmolsen

THANKS FOR LISTENING