Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang...

49
Speeding up Web Page Loads with Shandian Sophia Wang University of Washington

Transcript of Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang...

Page 1: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Speeding up Web Page Loads with Shandian

Sophia WangUniversity of Washington

Page 2: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 2

Why is page load time (PLT) slow?

Page 3: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 3

<html><body onload=“done();”><link src=‘1.css’><script src=‘d3.js’></script><script src=‘2.js’></script><div id=“content”></div></body></html>

Page 4: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 4

Elapsed Time

Page 5: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 5Network Computation

html

Elapsed Time

Page 6: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 6Network Computation Dependency

html

Elapsed Time

css

Page 7: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 7Network Computation Dependency

html

Elapsed Time

css

js

Components thataccesstothesameresourcecan’texecuteatthesametime

Page 8: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 8Network Computation Dependency

html

Elapsed Time

css

js

js

Page 9: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 9Network Computation Dependency

html

Elapsed Time

Page load

css

js

js

A simple page incurs complex load process, mainly due to interactions between

HTML/JS/CSS.

Page 10: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 10

How much can SPDY help PLT?

Page 11: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 11

html

Elapsed Time

Page load

css

js

js

Page 12: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 12Network Computation Dependency

html

Elapsed Time

Page load

css

js

js

Page 13: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 13Network Computation Dependency

html

Elapsed Time

Page load

css

js

js

A technique that helps one factor of PLT is hard to help the overall PLT.

Page 14: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 14

What does the simplest dependency graph look like?

Page 15: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 15Network Computation Dependency

???

Elapsed Time

Page load

css

js

js

Page 16: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 16Network Computation Dependency

???

Elapsed Time

Page load

css

js

js

Time to interact

Can we make every Web page look like this?

Page 17: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

3/27/16 17

Yes, we want to make every page like this, automatically.

Page 18: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Approach: Split Browser

• Preprocess Web pages on a proxy server to simplify the client-side page load process

3/27/16 18

Page 19: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Approach: Split Browser

• Preprocess Web pages on a proxy server according to whether they are used initially

3/27/16 19

???

Elapsed Time

Page load

css

js

js

Time to interact

Load-timestate

• Usedinaninitialpageload

• Displayasfast aspossible

Page 20: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Approach: Split Browser

• Preprocess Web pages on a proxy server according to whether they are used initially

3/27/16 20

???

Elapsed Time

Page load

css

js

js

Time to interact

Post-loadstate

• Notusedinaninitialpageload

• Ensurecorrectness offutureinteractions,andcompatibility withexistingtechnologies

Page 21: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Outline

• Load-time state• Post-load state• Deployment and implementation• Evaluation

3/27/16 21

Page 22: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Outline

• Load-time state• Post-load state• Deployment and implementation• Evaluation

3/27/16 22

Page 23: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Load-time State

• Goal– Display as fast as possible

• Approach– Eliminate both contents and computation of JS

and CSS on the client as many as possible

3/27/16 23

Page 24: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Loading load-time state

3/27/16 24

{“loadTimeState”:{“css”:[“#main{font-size:12px;}"],“html”:{“children”: [{“tagName”:”body”, ...“children”: [..., {“tagName”:”div”,“id”:”main”,“css”:[0]

}]}]}}

Page 25: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Loading load-time state

3/27/16 25

{“loadTimeState”:{“css”:[“#main{font-size:12px;}"],“html”:{“children”: [{“tagName”:”body”, ...“children”: [..., {“tagName”:”div”,“id”:”main”,“css”:[0]

}]}]}}

AlistofmatchedCSSrules

Page 26: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Loading load-time state

3/27/16 26

{“loadTimeState”:{“css”:[“#main{font-size:12px;}"],“html”:{“children”: [{“tagName”:”body”, ...“children”: [..., {“tagName”:”div”,“id”:”main”,“css”:[0]

}]}]}}

VisibleHTMLelements

Page 27: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Loading load-time state

3/27/16 27

{“loadTimeState”:{“css”:[“#main{font-size:12px;}"],“html”:{“children”: [{“tagName”:”body”, ...“children”: [..., {“tagName”:”div”,“id”:”main”,“css”:[0]

}]}]}}

WhichHTMLelementmatcheswhichCSSrules

Page 28: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Loading load-time state

3/27/16 28Network Computation Dependency

???

Elapsed Time

Page load

css

js

js

Page 29: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Outline

• Load-time state• Post-load state• Deployment and implementation• Evaluation

3/27/16 29

Page 30: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Post-load state

• Goals– Correctness of future interactions

• Requirement: Post-load and load-time state contain full state of a Web page

– Compatibility• Requirement: Post-load state contains unmodified

JS/CSS snippets

3/27/16 30

Page 31: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Vanilla post-load state

• The entire Web page itself• Pros

– Easy to ensure correctness of interactions and compatibility with caching/CDN

• Cons– Redundant contents and computation from load-

time state

3/27/16 31

From here, how much can we improve?

Page 32: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

What’s equivalent to eval’ing this CSS?

3/27/16 32

#main {font-size:12px;

}#main {font-size:12px;

}#main {font-size:12px;

}

Page 33: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

What’s equivalent to eval’ing this CSS?

3/27/16 33

#main {font-size:12px;

}#main {font-size:12px;

}#main {font-size:12px;

}

#main {font-size:12px;

}

Page 34: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

What’s equivalent to eval’ing this JS?

3/27/16 34

a += “hello world!\n”

a += “hello world!\n”

a += “hello world!\n”

Page 35: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

What’s equivalent to eval’ing this JS?

3/27/16 35

a += “hello world!\n”

a += “hello world!\n”

a += “hello world!\n”

a += “hello world!\n”+ ”hello world!\n”+ ”hello world!\n”

Page 36: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

What’s equivalent to eval’ing this JS?

3/27/16 36

function add(a, b) {return a + b;

}function add(a, b) {return a + b;

}function add(a, b) {return a + b;

}

Page 37: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

What’s equivalent to eval’ing this JS?

3/27/16 37

function add(a, b) {return a + b;

}function add(a, b) {return a + b;

}function add(a, b) {return a + b;

}

function add(a, b) {return a + b;

}

Page 38: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Post-load state

• Exploit the idempotency of evaluating CSS rules and JavaScript functions/statements– Eliminate redundant content that appeared in

load-time state– Capture results of non-idempotent JS statements

3/27/16 38

Page 39: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Outline

• Load-time state• Post-load state• Deployment and implementation• Evaluation

3/27/16 39

Page 40: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Deployment

• How to fast load on the proxy server?– Use a beefy server– Co-locate with Web front ends

• As part of the website: reverse proxy• As a 3rd-party service: cloud servers

3/27/16 40

ClientWebserver Proxy

serverhtml

css

js CDNsEdgecache

image

video

Page 41: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Implementation

• Server extension– Chrome’s content_shell– Only handle HTML/JS/CSS

• Client browser– Chrome– JSON lexer, Blink, V8

3/27/16 41

Page 42: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Outline

• Load-time state• Post-load state• Deployment and implementation• Evaluation

3/27/16 42

Page 43: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Experimental setup

• Server: 2.4GHz 16 core CPU, 16GB memory• Clients

– Mobile: Nexus S, 1GHz Cortex-A8 CPU, 512MB RAM

– Desktop: Linux VM, 2GHz CPU, 1GB memory

• Top 100 Web pages

3/27/16 43

Page 44: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

PLT on mobile

0

5

10

15

20

25

30

0 50 100

Abso

lute

PLT

s (s

econ

ds) Chrome

SplitBrowser

3/27/16 44

Shandian helps 60% in the median case

Page 45: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

PLT w/ varying RTT

3/27/16 45

0

0.2

0.4

0.6

0.8

1

0 5 10 15 20 25 30

CD

F

PLT

0, Chrome0, SP

200ms, Chrome200ms, SP

Unlike Chrome, Shandian is not sensitive to RTT, due to simplified page load process

IncreasedgapforChrome

SmallgapforShandian

Page 46: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

PLT w/ varying CPU

3/27/16 46

0

0.2

0.4

0.6

0.8

1

0 10 20 30 40 50 60

CD

F

PLT

2GHz, Chrome2GHz, SP

1.5GHz, Chrome1.5GHz, SP

1GHz, Chrome1GHz, SP

CPU has the same amount of impact for both Chrome and Shandian

Page 47: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

More results

• PLT breakdowns– Time spent on proxy server is negligible– Most time is spent on client

• Page size– Shandian increases page size by 1% after

applying gzip compression

3/27/16 47

Page 48: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Difference from related work

• Amazon Silk, Opera mini– Our client can run JavaScript– We place proxy servers near Web servers

• Prioritizing resources (server push, Klotski)– We remove page load dependencies on the client

3/27/16 48

Page 49: Speeding up Web Page Loads with Shandian - USENIX up Web Page Loads with Shandian Sophia Wang University of Washington 3/27/16 2 Why is page load time (PLT) slow? 3/27/16 3

Summary

• Split the page state according to whether they are used for an initial page load

• The dependency graph until the page is loaded is fairly simple

• Improve PLT by more than half consistently for various settings

• Is compatible with caching/CDNs

3/27/16 49