Meta Refresh 2014

74
ALL ABOUT PERCEIVED PERFORMANCE Aakash Bapna UI Engineer, flipkart.com 1

Transcript of Meta Refresh 2014

Page 1: Meta Refresh 2014

ALL ABOUT PERCEIVED PERFORMANCE

Aakash BapnaUI Engineer flipkartcom

1

2

Arya

Abhilash

Me

I HATE SLOW WEBSITES

3

4

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

5

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

6

Basics Performance Rules

bull CSS on top JS at bottombull Use CDNbull Caching static resourcesbull Minify JS CSS gzipbull hellip Y slow rules

7

8

USERS STILL SAY YOUR SITE IS SLOW

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 2: Meta Refresh 2014

2

Arya

Abhilash

Me

I HATE SLOW WEBSITES

3

4

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

5

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

6

Basics Performance Rules

bull CSS on top JS at bottombull Use CDNbull Caching static resourcesbull Minify JS CSS gzipbull hellip Y slow rules

7

8

USERS STILL SAY YOUR SITE IS SLOW

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 3: Meta Refresh 2014

I HATE SLOW WEBSITES

3

4

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

5

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

6

Basics Performance Rules

bull CSS on top JS at bottombull Use CDNbull Caching static resourcesbull Minify JS CSS gzipbull hellip Y slow rules

7

8

USERS STILL SAY YOUR SITE IS SLOW

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 4: Meta Refresh 2014

4

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

5

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

6

Basics Performance Rules

bull CSS on top JS at bottombull Use CDNbull Caching static resourcesbull Minify JS CSS gzipbull hellip Y slow rules

7

8

USERS STILL SAY YOUR SITE IS SLOW

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 5: Meta Refresh 2014

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

5

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

6

Basics Performance Rules

bull CSS on top JS at bottombull Use CDNbull Caching static resourcesbull Minify JS CSS gzipbull hellip Y slow rules

7

8

USERS STILL SAY YOUR SITE IS SLOW

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 6: Meta Refresh 2014

ANYTHING YOU ADD- BROWSERS HAVE TO DOWNLOAD COMPUTE amp

RENDER

6

Basics Performance Rules

bull CSS on top JS at bottombull Use CDNbull Caching static resourcesbull Minify JS CSS gzipbull hellip Y slow rules

7

8

USERS STILL SAY YOUR SITE IS SLOW

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 7: Meta Refresh 2014

Basics Performance Rules

bull CSS on top JS at bottombull Use CDNbull Caching static resourcesbull Minify JS CSS gzipbull hellip Y slow rules

7

8

USERS STILL SAY YOUR SITE IS SLOW

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 8: Meta Refresh 2014

8

USERS STILL SAY YOUR SITE IS SLOW

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 9: Meta Refresh 2014

WHAT PERCEIVED PERFORMANCE

9

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 10: Meta Refresh 2014

10

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 11: Meta Refresh 2014

ITS ALL HOW USERS PERCEIVE YOUR PAGE LOAD

whether loads in a flash or takes ages to load

11

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 12: Meta Refresh 2014

YOU HAVE TO MAKE USERS BELIEVE ITS LOADING FAST

12

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 13: Meta Refresh 2014

HOW WE DO THIS

13

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 14: Meta Refresh 2014

14

Skeleton screens- Homepage (below fold)

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 15: Meta Refresh 2014

Progressively enhanced MotoG page

15

SLOW CONNECTION FAST CONNECTION

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 16: Meta Refresh 2014

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

16

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 17: Meta Refresh 2014

Other Techniques 1 Show precise progress loader when it

takes time (gmail)2 Optimistic actions (Instagram)3 Paint what they are seeing right now

17

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 18: Meta Refresh 2014

MEASURING PERCEIVED PERFORMANCE

HARD

18

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 19: Meta Refresh 2014

SYNTHETIC MONITORING

19

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 20: Meta Refresh 2014

WEBPAGETEST1 Shows load times2 Shows waterfall of requests of how

page loaded3 CPU network utilisation4 Filmstrips 5 etchellip

20

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 21: Meta Refresh 2014

21

Frames

Waterfall

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 22: Meta Refresh 2014

ldquoWhy is it taking 715ms to download a 5kb imagerdquo - A developer after running WPT

22

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 23: Meta Refresh 2014

Problem with WPT

bull Inconsistent results for load times on every run

bull Probably due to network conditions in India

23

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 24: Meta Refresh 2014

BIGGER QUESTION- HOW OFTEN ARE USERS SEEING THE PAGE WEBPAGETEST

IS SEEING

24

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 25: Meta Refresh 2014

REAL USER MONITORING

25

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 26: Meta Refresh 2014

windowonload1 so Web 102 Doesnrsquot tell you how page loaded 3 Above the fold might complete very

early4 This is the bare minimum you should

record

26

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 27: Meta Refresh 2014

27

NAVIGATION TIMING API

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 28: Meta Refresh 2014

28

NAVIGATION TIMING API

Server Time Very less for big sites

Client Time Very HighNEED MOAR DETAILS

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 29: Meta Refresh 2014

WHAT IF YOU COULD EXPORT REQUESTS WATERFALL FROM

REAL USERS

and reconstruct picture

29

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 30: Meta Refresh 2014

Resource Timing API

bull windowperformancegetEntries()bull Supported latest Chrome IE10bull DNSTCP connect times available

when cross origin headers are setbull under documented

30

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 31: Meta Refresh 2014

NAVIGATION TIMING API + RESOURCE TIMING API =

WINDOWONLOAD

complete end to end picture of network performance

31

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 32: Meta Refresh 2014

WE EXPORTED DATA FROM BROWSERS RAN HADOOP JOBS TO PROCESS THIS

32

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 33: Meta Refresh 2014

33

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 34: Meta Refresh 2014

34

Requests Waterfall from RUM

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 35: Meta Refresh 2014

35

Identify critical requests

Requests Waterfall from RUM

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 36: Meta Refresh 2014

36

Above the fold load time aim for getting this as low as possible

Requests Waterfall from RUM

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 37: Meta Refresh 2014

Findings (what was fast)

bull CSS JS are heavily cached over requests median under 100ms

bull Cleaning up CSSJS would hardly move metrics

bull Although CSS load times are less its a blocking resource and need to keep a check on its size

37

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 38: Meta Refresh 2014

Findings (what was slow)

bull Google Analytics Omniture tracking calls were taking 500ms (median)

bull Redirectsbull HTML document itself taking too long

to loadbull Images

38

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 39: Meta Refresh 2014

CRITICAL REQUESTS

Let browser handle make them discoverable to browsers as soon as possible via

markup itself

39

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 40: Meta Refresh 2014

NON-CRITICAL BELOW FOLD

Lazy load images lazy load modules via Ajax at DOM Ready

40

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 41: Meta Refresh 2014

3RD PARTY CODE SHARE BUTTONS

You donrsquot have control over these start at post onload

41

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 42: Meta Refresh 2014

42

All in all data by Resource Timing APIs is a gold mine There is lots to discover from it

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 43: Meta Refresh 2014

FIXING IMAGES

43

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 44: Meta Refresh 2014

DEVELOPER ldquoTHIS IMAGE IS HUGE GIMME A SMALLER ONErdquo

DESIGNER ldquoOKAY HOW SMALLrdquo

DEVELOPER (CONFUSED MAKES A RANDOM GUESShellip)

44

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 45: Meta Refresh 2014

DONrsquoT GUESS USE DATA

use data from Resource Timing APIs

45

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 46: Meta Refresh 2014

46

Example730px x 300px

50kb 380ms to load

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 47: Meta Refresh 2014

FIXING CAROUSELS

47

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 48: Meta Refresh 2014

48

An example carousel on site

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 49: Meta Refresh 2014

49

3 x 50kb images in parallelMedian load time of each 832msBUT we are showing only one image why load all three

Wrong way

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 50: Meta Refresh 2014

50

Median load time 380ms

Right way

Load via javascript after critical requests end

Load via ltimg src=rsquorsquordquo gt as a critical resource

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 51: Meta Refresh 2014

IMAGE REUSE

51

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 52: Meta Refresh 2014

52

Browse Page Product Page

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 53: Meta Refresh 2014

53

Browse Page Product Page

Same cached image from previous page upscaled and used as placeholder while big image loads

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 54: Meta Refresh 2014

THEMING

All developers hate it

54

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 55: Meta Refresh 2014

55

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 56: Meta Refresh 2014

Progressive festival theming1 Theme is non-critical should load after all

critical requests complete2 All functionality should work with base skin3 Limited to colours background images4 No new DOM elements use before after5 Packed in single themecss file6 Theme CSS file is loaded asyncly on DOM

ready

56

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 57: Meta Refresh 2014

FIXING HTML SIZE

Important as affects discovery on critical requests

57

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 58: Meta Refresh 2014

Our huuuge Nav menu

58

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 59: Meta Refresh 2014

MENU ON SLOW CONNECTION

59

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 60: Meta Refresh 2014

60

lthtmlgtltheadgt ltmdash css mdashgtltheadgtltbodygt ltdiv class=ldquoheaderrdquogt ltmdash search bar mdashgt ltmdash navigation menu and big fat submenus mdashgt helliphellip helliphellip ltdivgt ltimg src=ldquohelliprdquo gt ltimg src=ldquohelliprdquo gt hellipltbodygt

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 61: Meta Refresh 2014

HTML caching

bull Over 40 of our markup is flyout menu

bull Persisted on clientside with localStorage for 10 mins

bull Drastically reduced payload which was transferred for every request

bull 200ms improvement over median

61

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 62: Meta Refresh 2014

REDIRECTS

very costly

62

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 63: Meta Refresh 2014

IT ALL STARTS WITH A SHORTCUT

if (some condition) redirect()

63

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 64: Meta Refresh 2014

DECIDE URL STRATEGY BETWEEN MOBILEDESKTOP EARLY ON

64

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 65: Meta Refresh 2014

PREFER ONE URL BETWEEN MOBILEDESKTOP

wwwflipkartcom - goodwwwflipkartcomm - bad

65

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 66: Meta Refresh 2014

MOBILE SITE PERFORMANCE

66

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 67: Meta Refresh 2014

Mobile perf highlights

bull Much of users(~50) still come from 2G connections in India

bull Use touchStart event instead of click(~300ms delay)

bull AB tested heavily to find right mix of content

67

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 68: Meta Refresh 2014

TO SUSTAIN

Performance is a moving target

68

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 69: Meta Refresh 2014

To sustain1 Have a performance team2 Measure key performance metrics3 Use webpagetest in CI to keep an eye

on whats being checked in

69

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 70: Meta Refresh 2014

THE FUTUREPrefetching

70

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 71: Meta Refresh 2014

NATIVE APPS ARE CHEATING WITH PREFETCHING

71

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 72: Meta Refresh 2014

NATIVE APP 85MB WEB VIEW 0 BYTES

72

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 73: Meta Refresh 2014

Food for thought

bull Prefetching autosuggest next pageshellipbull Going offline with ServiceWorkers

[W3C proposal] bull Prefetching on hovertouchStart http

instantclickio

73

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74

Page 74: Meta Refresh 2014

THANK YOU

connecttwitter _aakash

mail aakashflipkartcom

74