please don't touch the slow parts

56
Please Don’t Touch the Slow Parts [email protected] http://www.ideato.it/ [email protected] http://federico.galassi.net / Saturday, May 8, 2010

Upload: federico-galassi

Post on 05-Dec-2014

7.585 views

Category:

Technology


2 download

DESCRIPTION

Talk i gave at Better Software on May 5th 2010, together with Fullo of Ideato. It's about improving web applications speed. Based on Steve Souders work. I'll be giving a newer version of the talk at PHP Day 2010 Also http://www.ideato.it/ http://federico.galassi.net/ http://www.stevesouders.com/ http://www.bettersoftware.it/ http://www.phpday.it/ Follow me on Twitter https://twitter.com/federicogalassi

TRANSCRIPT

Page 2: Please Don't Touch the Slow Parts

Saturday, May 8, 2010

Page 3: Please Don't Touch the Slow Parts

faster

Saturday, May 8, 2010

Page 4: Please Don't Touch the Slow Parts

faster WEB

Saturday, May 8, 2010

Page 5: Please Don't Touch the Slow Parts

Faster == Better?

Saturday, May 8, 2010

Page 6: Please Don't Touch the Slow Parts

We have to wait

Saturday, May 8, 2010

Page 7: Please Don't Touch the Slow Parts

... All the time

Saturday, May 8, 2010

Page 8: Please Don't Touch the Slow Parts

“Savings in timefeels like simplicity”

Saturday, May 8, 2010

Page 9: Please Don't Touch the Slow Parts

“Time is the only commodity that matters”

Saturday, May 8, 2010

Page 10: Please Don't Touch the Slow Parts

Faster web, more clicks

http://www.stevesouders.com/blog/2009/07/27/wikia-fast-pages-retain-users/

Saturday, May 8, 2010

Page 11: Please Don't Touch the Slow Parts

Faster web, better SEO

http://googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html

Saturday, May 8, 2010

Page 12: Please Don't Touch the Slow Parts

Faster web is hot

Saturday, May 8, 2010

Page 13: Please Don't Touch the Slow Parts

Say web, Say browser

Saturday, May 8, 2010

Page 14: Please Don't Touch the Slow Parts

How browsers work

Saturday, May 8, 2010

Page 15: Please Don't Touch the Slow Parts

User clicks on a link

Saturday, May 8, 2010

Page 16: Please Don't Touch the Slow Parts

Browser resolves domain name

www.google.com

72.14.234.104

DNS

UDP

domain

Saturday, May 8, 2010

Page 17: Please Don't Touch the Slow Parts

Browser connects to web server

TCP/IP

72.14.234.104

WEB

domain connect

Saturday, May 8, 2010

Page 18: Please Don't Touch the Slow Parts

Browser sends arequest for a page

HTTP

GET /language_tools?hl=enHost: www.google.com

WEB

domain connect send

Saturday, May 8, 2010

Page 19: Please Don't Touch the Slow Parts

Browser receives a response with the page

HTTP

200 OK

WEB

domain connect send receive

Saturday, May 8, 2010

Page 20: Please Don't Touch the Slow Parts

Browser renders the new page

domain connect send receive render

Saturday, May 8, 2010

Page 21: Please Don't Touch the Slow Parts

Rendering is complexparse + paint

render

Saturday, May 8, 2010

Page 22: Please Don't Touch the Slow Parts

Rendering really complexparse + paint + resources

render

css

img

css

img

javascript

javascript

flash

Saturday, May 8, 2010

Page 23: Please Don't Touch the Slow Parts

Each resource is another web request

render

Saturday, May 8, 2010

Page 24: Please Don't Touch the Slow Parts

Requests areprocessed in parallel

render

Saturday, May 8, 2010

Page 25: Please Don't Touch the Slow Parts

Once upon a time...

Few resources

Static pages

Less javascript

Saturday, May 8, 2010

Page 26: Please Don't Touch the Slow Parts

Most time on serverdomain connect send receive render

Saturday, May 8, 2010

Page 27: Please Don't Touch the Slow Parts

Solution is faster serversidedomain connect send receive render

Saturday, May 8, 2010

Page 28: Please Don't Touch the Slow Parts

Ajax revolution

Saturday, May 8, 2010

Page 29: Please Don't Touch the Slow Parts

Most time on browserdomain connect send receive render

Saturday, May 8, 2010

Page 30: Please Don't Touch the Slow Parts

Golden rule of faster web

80% of the end user response time is spent

on the front-end

Saturday, May 8, 2010

Page 31: Please Don't Touch the Slow Parts

Golden rule of faster web

Start there.

Saturday, May 8, 2010

Page 32: Please Don't Touch the Slow Parts

Why webslow parts?

Saturday, May 8, 2010

Page 33: Please Don't Touch the Slow Parts

Easy to understand

Saturday, May 8, 2010

Page 34: Please Don't Touch the Slow Parts

Each part has its rules

Saturday, May 8, 2010

Page 35: Please Don't Touch the Slow Parts

Which parts are slow?

Saturday, May 8, 2010

Page 36: Please Don't Touch the Slow Parts

Network is slow

Saturday, May 8, 2010

Page 37: Please Don't Touch the Slow Parts

Less stuffFewer requests

Concatenate js/cssCss spritesLess dns requests

Pages have toomany resources

Saturday, May 8, 2010

Page 38: Please Don't Touch the Slow Parts

Less stuffCache requests

Expires headerRevving FilesExternal js/cssRemove etags

Browser downloadresources repeatedly

Saturday, May 8, 2010

Page 39: Please Don't Touch the Slow Parts

Smaller stuffCompress responses

Content-EncodingGzipDeflate

Resources aretoo big

Saturday, May 8, 2010

Page 40: Please Don't Touch the Slow Parts

Smaller stuffMinify responses

js, css, htmlremove formattingremove commentsuse tools

Resources aretoo big

Saturday, May 8, 2010

Page 41: Please Don't Touch the Slow Parts

Closer stuffUse a CDN

Resources aretoo far

reduce latency

Saturday, May 8, 2010

Page 42: Please Don't Touch the Slow Parts

Browser is slow

Saturday, May 8, 2010

Page 43: Please Don't Touch the Slow Parts

Scripts block loading

javascript

css

javascript

img

flash

document.writelocation.hrefscripts order

html

img

Saturday, May 8, 2010

Page 44: Please Don't Touch the Slow Parts

css

Put scripts at bottom

javascript

javascript

img

img

flash

html

Saturday, May 8, 2010

Page 45: Please Don't Touch the Slow Parts

css

Unloaded stylesblock page rendering

html

img

img

flash

Saturday, May 8, 2010

Page 46: Please Don't Touch the Slow Parts

css

html

img

img

flash

Put styles at top

Saturday, May 8, 2010

Page 47: Please Don't Touch the Slow Parts

Scripts and stylesside effects

dom reflowscss expression reflows

Saturday, May 8, 2010

Page 48: Please Don't Touch the Slow Parts

All that glittersis not gold

Saturday, May 8, 2010

Page 49: Please Don't Touch the Slow Parts

Everything is atradeoff

Saturday, May 8, 2010

Page 50: Please Don't Touch the Slow Parts

performance bringscomplexity

Saturday, May 8, 2010

Page 51: Please Don't Touch the Slow Parts

know the rules but...

Saturday, May 8, 2010

Page 52: Please Don't Touch the Slow Parts

leave complexityto computers

Saturday, May 8, 2010

Page 53: Please Don't Touch the Slow Parts

use librariesduring development

Saturday, May 8, 2010

Page 54: Please Don't Touch the Slow Parts

Use toolsat build time

Saturday, May 8, 2010

Page 55: Please Don't Touch the Slow Parts

http://abetterbrowser.org/Saturday, May 8, 2010

Page 56: Please Don't Touch the Slow Parts

Questions?

Saturday, May 8, 2010