"web performance optimization for everyone" por @abellonch

62
Webcat October ’12 @abellonch / #webcat 1

Upload: webcat

Post on 12-Jan-2015

314 views

Category:

Technology


0 download

DESCRIPTION

Presentación realizada en el #webcat Barcelona de Octubre del 2012 Autor: Albert Bellonch (@abellonch)

TRANSCRIPT

Page 1: "Web performance optimization for everyone" por @abellonch

Webcat October ’12

@abellonch/#webcat

1

Page 2: "Web performance optimization for everyone" por @abellonch

Web performance optimization

for everyone

2

Page 3: "Web performance optimization for everyone" por @abellonch

Albert Bellonch

@abellonch

/albertbellonch

[email protected]

CTO

3

Page 4: "Web performance optimization for everyone" por @abellonch

What’s WPO?Web performance optimization is the process by which

individual aspects of web pages are optimized,in order to achieve greater overall performance

4

Page 5: "Web performance optimization for everyone" por @abellonch

What’s WPO?Web performance optimization is the process by which

individual aspects of web pages are optimized,in order to achieve greater overall performance

“Make it faster”

4

Page 6: "Web performance optimization for everyone" por @abellonch

Advantages

•Less server load

•Better SEO

•Better user experience

5

Page 7: "Web performance optimization for everyone" por @abellonch

What’s in a web page?

6

Page 8: "Web performance optimization for everyone" por @abellonch

What’s in a web page?

HTML markup

6

Page 9: "Web performance optimization for everyone" por @abellonch

What’s in a web page?

HTML markup

CSS stylesheets

6

Page 10: "Web performance optimization for everyone" por @abellonch

What’s in a web page?

HTML markup

Javascript code

CSS stylesheets

6

Page 11: "Web performance optimization for everyone" por @abellonch

What’s in a web page?

HTML markup

Javascript code

CSS stylesheets

Images

6

Page 12: "Web performance optimization for everyone" por @abellonch

What’s in a web page?

HTML markup

Javascript code

CSS stylesheets

Images

Fonts

6

Page 13: "Web performance optimization for everyone" por @abellonch

What’s in a web page?

HTML markup

Javascript code

CSS stylesheets

Images

Fonts

much more

6

Page 14: "Web performance optimization for everyone" por @abellonch

WPO Techniques

7

Page 15: "Web performance optimization for everyone" por @abellonch

Request combination

8

Page 16: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

A wine store

9

Page 17: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

Home page CSS

A wine store

9

Page 18: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

Home page CSS

Wine list CSS

A wine store

9

Page 19: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

Home page CSS

Wine list CSS

A wine store

Wine details CSS

9

Page 20: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

Home page CSS

Wine list CSS

A wine store

Wine details CSS

...more CSS files

9

Page 21: "Web performance optimization for everyone" por @abellonch

Combine it!In HTTP requests, a considerable amount of time is used when asking

for the information, instead of transmitting this information.

10

Page 22: "Web performance optimization for everyone" por @abellonch

The lazy-boy-in-the-sofa example

11

Page 23: "Web performance optimization for everyone" por @abellonch

Improved scenario

Browser Server

A wine store

All CSS files combined

12

Page 24: "Web performance optimization for everyone" por @abellonch

Same for JavascriptAppliable with images: sprites

13

Page 25: "Web performance optimization for everyone" por @abellonch

Can we do it better?

14

Page 26: "Web performance optimization for everyone" por @abellonch

Can we do it better?Yes!

14

Page 27: "Web performance optimization for everyone" por @abellonch

Resource minification

15

Page 28: "Web performance optimization for everyone" por @abellonch

Typical scenario Uncompressed CSS (~56KB)

16

Page 29: "Web performance optimization for everyone" por @abellonch

Minify it!Send only the essential information.

This way, less data is sent, and thus less time is spent transferring it.

17

Page 30: "Web performance optimization for everyone" por @abellonch

The gibberish-conversation example

18

Page 31: "Web performance optimization for everyone" por @abellonch

Improved scenario Compressed CSS (~25KB)

19

Page 32: "Web performance optimization for everyone" por @abellonch

Similar for JavascriptMore complex with images

20

Page 33: "Web performance optimization for everyone" por @abellonch

Can we do it better?

21

Page 34: "Web performance optimization for everyone" por @abellonch

Can we do it better?Yes!

21

Page 35: "Web performance optimization for everyone" por @abellonch

Image optimization

22

Page 36: "Web performance optimization for everyone" por @abellonch

Typical scenario Unscaled picture

30 KB

23

Page 37: "Web performance optimization for everyone" por @abellonch

Typical scenario Unscaled picture

But the real image is

30 KB

150 KB

23

Page 38: "Web performance optimization for everyone" por @abellonch

Slim down the images!The images should have the same size as they are shown as,

and should be optimized too.

24

Page 39: "Web performance optimization for everyone" por @abellonch

The gigantic-field example

25

Page 40: "Web performance optimization for everyone" por @abellonch

Improved scenario Scaled picture

30 KB

26

Page 41: "Web performance optimization for everyone" por @abellonch

Improved scenario Scaled picture

And the real image is

30 KB 30 KB

26

Page 42: "Web performance optimization for everyone" por @abellonch

Can we do it better?

27

Page 43: "Web performance optimization for everyone" por @abellonch

Can we do it better?Yes!

27

Page 44: "Web performance optimization for everyone" por @abellonch

Caching

28

Page 45: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

A wine store, again

29

Page 46: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

Picture of 1787’ Chateau d’Yquern

A wine store, again

29

Page 47: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

Picture of 1787’ Chateau d’Yquern

Picture of 1787’ Chateau d’Yquern

A wine store, again

29

Page 48: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

Picture of 1787’ Chateau d’Yquern

Picture of 1787’ Chateau d’Yquern

A wine store, again

Picture of 1787’ Chateau d’Yquern

29

Page 49: "Web performance optimization for everyone" por @abellonch

Typical scenario

Browser Server

Picture of 1787’ Chateau d’Yquern

Picture of 1787’ Chateau d’Yquern

A wine store, again

Picture of 1787’ Chateau d’Yquern

Picture of 1787’ Chateau d’Yquern

29

Page 50: "Web performance optimization for everyone" por @abellonch

Ask only missing stuff!If you know something won’t change for some time,

don’t ask for it until it does.

30

Page 51: "Web performance optimization for everyone" por @abellonch

The I-wanna-know example

31

Page 52: "Web performance optimization for everyone" por @abellonch

Improved scenario

Browser Server

A wine store, again

32

Page 53: "Web performance optimization for everyone" por @abellonch

Improved scenario

Browser Server

Picture of 1787’ Chateau d’Yquern

A wine store, again

32

Page 54: "Web performance optimization for everyone" por @abellonch

Improved scenario

Browser Server

Picture of 1787’ Chateau d’Yquern

A wine store, again

OK, I have the picture of 1787’ Chateau d’Yquern, so I’ll show it directly.

32

Page 55: "Web performance optimization for everyone" por @abellonch

Can we do it better?

33

Page 56: "Web performance optimization for everyone" por @abellonch

Can we do it better?Yes!

33

Page 57: "Web performance optimization for everyone" por @abellonch

Other techniques

34

Page 58: "Web performance optimization for everyone" por @abellonch

Use GET in Ajax requests

Use JSON in AJAX requests

Reduce DOM elements

Reduce iframes

Prefer CSS over JS

Activate deflate

Font optimizing

Cache Control headers

Expiration headers

Reduce use of CNAME

JPEG and PNG codification

Lazy load for images

Content Delivery Networks

Avoid Flash files

Eager loading

Mobile-specific optimisations

35

Page 59: "Web performance optimization for everyone" por @abellonch

No time for much more...

36

Page 60: "Web performance optimization for everyone" por @abellonch

Be careful!

•There’s a lot of things to do

•Pick your critical weaknesses, and solve them first

•Go step by step

•Have your timing and resources into account

37

Page 61: "Web performance optimization for everyone" por @abellonch

Questions?I can’t bite you from this far!

38

Page 62: "Web performance optimization for everyone" por @abellonch

Thank you!

39