SlideShare a Scribd company logo
1 of 49
Download to read offline
Polaris: Faster Page Loads Using
Fine-grained Dependency Tracking
Ravi Netravali, Ameesh Goyal, James Mickens*, Hari Balakrishnan
MIT CSAIL, *Harvard University
MIT Center for Wireless Networks and Mobile Computing
NSDI ‘16
“MIT develops a new technique to load
webpages faster”
“MIT's answer to cutting webpage load-
times? It's the Polaris compression-trumping
browser framework”
“MIT has a way to speed up web browsing
by 34 percent”
Outline
• Introduction
• Background
• Scout: Dependency Tracking
• Polaris: Dynamic Client-side Scheduling
• Evaluation
• Conclusion
Introduction
Web performance
• Users demand fast page loads
• Slow page loads lead to lost revenue and low
search rank
Load web pages
• A browser must resolve the page’s dependency
graph
• “load-before” relationships between HTML,
CSS, JavaScript, and images object
• only partially revealed to a browser
• use conservative algorithms
<script src="http://x.com/first.js"/>
<script src="http://x.com/second.js"/>
<link src="http://x.com/style.css"/>
synchronously fetch and evaluate
Contributions
• Scout: a new measurement infrastructure
• automatically tracks fine-grained data dependencies
• instruments web pages to track precise data flows
between and within JavaScript heap and the browser’s
internal HTML and CSS states
• e.g. track read/write dependencies for an individual
JavaScript variables
• 81% of real-world test cases have different critical
paths in new graphs
Contributions
• Polaris: a dynamic client-side scheduler
• use Scout’s fine-grained dependency graphs to reduce page
load times by 34% on unmodified commodity browsers
• the server returns a scheduler stub instead of the page’s
original HTML
• scheduler stub = Polaris JavaScript library + fine-grained
dependency graph generated by Scout + original HTML
• aggressively fetch and evaluate objects “out-of-order” with
respect to lexical constraints between HTML tags
• also considers network conditions
Background
Conventional page load
• Consider pure HTML
• downloads page’s top-level HTML
• parses HTML tags
• generates DOM (Document Object Model) tree
• constructs a render tree (with visual attributes)
• produces a layout tree (geometric properties)
• updates (or “paints”) the screen
Loading More Complicated Pages
• JavaScript
• <script> tag blocks the HTML parser, halting
the construction of the DOM tree.
• JavaScript can use document.write() to
dynamic change HTML after a <script> tag
• modern browsers enters speculation mode
when encountering a synchronous <script> tag
<script src="demo_async.js" async></script>
<script src="demo_defer.js" defer></script>
• async
• script downloaded in parallel with the HTML parse, but executed
synchronously in a parse-blocking manner.
• defer
• script executed once HTML parsing is complete (DOMContentLoaded)
• 98.3% of all JavaScript files in 200 popular sites do not use async or defer
attribute
Loading More Complicated Pages
• CSS
• CSS Object Model (CSSOM) tree
• To create the render tree, the browser uses the DOM tree to
enumerate a page’s visible HTML tags, and the CSSOM tree to
determine what those visible tags should look like.
• CSS tags do not block HTML parsing, but they do block
rendering, layout, painting, and JavaScript execution.
• Best practices encourage developers to place CSS tags at the
top of pages, to ensure that the CSSOM tree is built quickly.
• Images and other media files
The Pitfalls of Lexical Dependencies
• A script tag might read CSS style properties from the DOM
tree, so CSS evaluation must block JavaScript execution.
• A script tag might change downstream HTML, so when the
browser encounters a script tag, either HTML parsing must
block, or HTML parsing must transfer to a speculative
thread.
• Two script tags that are lexically adjacent might exhibit a
write/read dependency on JavaScript state. Thus, current
browsers must execute the script tags serially, in lexical
order.
Scout: Dependency
Tracking
Page State
• Objects in a web page interact with each other via
two kinds of state
• JavaScript heap managed by JavaScript runtime
• DOM state
Dependency Types
• Write/read
• arise when one object produces state (e.g. global variable) that another object
consumes
• Read/write
• occur when one object must read a piece of state before the value is updated
by another object
• Write/write
• arise when two objects update the same piece of state, and we must preserve
the relative ordering of the writes.
• CSS: later writer wins
• output devices, localStorage API
Dependency Types
• Traditional dependencies based on HTML tag
constraints can often be eliminated if finer-grained
dependencies are known
• For example, once we know the DOM
dependencies and JavaScript heap dependencies
for a <script> tag, the time at which the script
can be evaluated is completely decoupled from the
position of the <script> tag in the HTML — we
merely have to ensure that we evaluate the script
after its fine-grained dependencies are satisfied.
Capturing Dependencies with Scout
• record the content of the page using Mahimahi
• rewrite each JavaScript and HTML file in the page,
adding instrumentation to log fine-grained data
flows across the JavaScript heap and the DOM.
• load the instrumented page in a regular browser,
emits dependency logs to Scout analysis server,
then generates the fine-grained dependency graph.
Capturing Dependencies with Scout
• Tracking Javascript heap dependencies
• Scout leverages JavaScript proxy objects (wrapper),
allowing custom event handlers to fire whenever external
code tries to read or write the properties of the
underlying object.
• rewrite global variable access x with window.x, forcing
all accesses to the global namespace to go through
Scout’s window proxy
• recursive proxying for non-primitive global values (e.g.
window.x.y.z)
Capturing Dependencies with Scout
• Tracking DOM dependencies
• JavaScript code interacts with the DOM tree through the
window.document object (e.g. document.getElementById(id))
• Scout’s recursive proxy for window.document automatically creates
proxies for all DOM nodes that are returned to JavaScript code
• A write to a single DOM path may trigger cascading updates to other
paths (e.g. inserting a new node)
• The DOM tree can also be modified by the evaluation of CSS objects
that change node styles
• prepends inline JavaScript tag to log the current state of DOM tree
Capturing Dependencies with Scout
• Missing dependencies
• nondeterministic JavaScript behaviors (e.g.
Math.random())
• Scout must create a dependency graph which contains
the aggregate set of all possible dependencies
• A web server might personalize the graph in response
to a user’s cookie or user agent string. The server-side
logic must run Scout on each version of the
dependency graph.
Capturing Dependencies with Scout
• Implementation
• use Esprima, Estravers, Escodegen to rewrite
JavaScript code; use Beautiful Soup to rewrite
HTML
• current implementation does not support the
eval(sourceCode) statement
Dependency Graphs: Scout
vs. Prior Tools
treats CSS as a read/write
to all upstream HTML
Results
• (a) adds 29.8% additional edges at the median, and 118% more edges at the
95th percentile
• (b) adding fine-grained dependencies alters the critical path length for 80.8%
of the pages in their corpus
• (d) 86.6% of pages have a smaller fraction of slack nodes when fine-grained
dependencies are considered
29.8%
0.192
0.866
Polaris: Dynamic
Client-side Scheduling
Polaris
• Polaris is written completely in JavaScript, allowing
it to run on unmodified commodity browsers.
• Polaris accepts a Scout graph as input, but also
uses observations about current network conditions
to determine the dynamic critical path for a page.
Polaris scheduler stub
• The scheduler itself is just inline JavaScript code
• The Scout dependency graph for the page is represented as a
JavaScript variable inside the scheduler
• DNS prefetch hints indicate to the browser that the scheduler will be
contacting certain hostnames in the near future (for pre-warm)
• the stub contains the page’s original HTML, which is broken into
chunks as determined by Scout’s fine-grained dependency resolution
• src attributes in HTML tags are deleted
• the scheduler stub was 3% (36.5 KB) larger than a page’s original
HTML at the median
<link rel="dns-prefetch" href="http://domain.com">
Polaris scheduler
• uses XMLHttpRequests to dynamically fetch
object
• uses built-in eval() function to evaluate a
JavaScript file
• leverages DOM interfaces like
document.innerHTML to evaluate HTML, CSS,
and images
Browser network constraints
• Modern browsers limit a page to at most six
outstanding requests to a given origin
• maintains per-origin priority queues
• If fetching the next object along a critical path
would violate a per-origin network constraint,
Polaris examines its queues, and fetches the
highest priority object from an origin that has
available request slots.
Frames
• A single page may contain multiple iframes
• Scout generates a scheduler stub for each one, but
the browser’s per-origin request cap is a page-
wide limit.
• The scheduler in the top frame coordinates the
schedulers in child frames. Using postMessage()
calls, children ask the top-most parent for
permission to request particular objects.
URL matching
• An XMLHttpRequest URL may embed the current
date in its query string
• Polaris uses a matching heuristic to map dynamic
URLs to their equivalents in the static dependency
graph
Page-generated XHRs
• When Polaris evaluates a JavaScript file, the
executed code might try to fetch an object via
XMLHttpRequest.
• Polaris uses an XMLHttpRequest shim to
suppress autonomous XMLHttpRequests.
• Polaris issues those requests using its own
scheduling algorithm, and manually fires
XMLHttpRequest event handlers when the
associated data has arrived.
Evaluation
Methodology
• A page’s load time is normally defined with respect to
JavaScript events like navigationStart and
loadEventEnd.
• loadEventEnd is inaccurate for Polaris pages
• First loaded the original version of the page and used
tcpdump to capture the objects that were fetched
between navigationStart and loadEventEnd.
Then defined the load time of the Polaris page as the
time needed to fetch all of those objects.
Results
• performance improves by 34% and 59% for the
median and 95th percentile sites
• Polaris’ benefits grow as network latencies in-
crease, because higher RTTs increase the penalty
for bad fetch schedules.
Figure: Polaris’ average reduction in page load times, relative to
baseline load times with Firefox v40.0. Each bar is the average
reduction in load time across the entire 200 site corpus. Error bars
span one standard deviation in each direction of the average.
Figure: Polaris’ average reduction in page load times, relative to
baseline load times, for three sites with diverse dependency graph
structures. Each experiment used a link rate of 12 Mbits/s.
Figure: Request initiation times for the regular and Polaris-enabled
versions of StackOverflow. These results used a 12 Mbits/s link with
an RTT of 100 ms.
Figure: Polaris’ benefits with warm caches, normalized with respect
to Polaris’ gains with cold caches. Each data point represents one of
the 200 sites in our corpus. Pages were loaded over a 12 Mbits/s
link with an RTT of 100 ms.
SPDY
• Google proposed SPDY, a transport protocol for HTTP
messages, to remedy several problems with the HTTP/1.1
protocol.
• uses a single TCP connection to multiplex all of a browser’s
HTTP requests and responses involving a particular origin
• allows a browser to prioritize the fetches of certain objects
• compresses HTTP headers
• allows a server to proactively push objects to a browser if the
server believes that the browser will request those objects in
the near future
Figure: Average reductions in page load time using SPDY, Polaris
over HTTP/1.1, and Polaris over SPDY. The performance baseline
was load time using HTTP/1.1. The link rate was 12 Mbits/s.
Conclusion
• Prior load schedulers have used those lexical relationships to extract dependency
graphs
• Use a new tool called Scout to track the fine-grained data flows that arise during
a page’s load process
• Scout detects 30% more edges for the median page
• these additional edges actually give browsers more opportunities to reduce
load times
• Introduce a new client-side scheduler called Polaris which leverages Scout
graphs to assemble a page
• Polaris reduces load times by 34% for the median page
• prioritizing the fetches of objects along the dynamic critical path, Polaris
minimizes the number of RTTs needed to load a page.

More Related Content

What's hot

Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationWebStackAcademy
 
RESTful Web Services with Spring MVC
RESTful Web Services with Spring MVCRESTful Web Services with Spring MVC
RESTful Web Services with Spring MVCdigitalsonic
 
Drupal is not your Website
Drupal is not your Website Drupal is not your Website
Drupal is not your Website Phase2
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajaxNir Elbaz
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slidesSmithss25
 
[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile appsIvano Malavolta
 
HTML5 features & JavaScript APIs
HTML5 features & JavaScript APIsHTML5 features & JavaScript APIs
HTML5 features & JavaScript APIsFisnik Doko
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorialprathap kumar
 
Metadata Beyond ONIX: How Publishers can use Different Metadata Formats Throu...
Metadata Beyond ONIX: How Publishers can use Different Metadata Formats Throu...Metadata Beyond ONIX: How Publishers can use Different Metadata Formats Throu...
Metadata Beyond ONIX: How Publishers can use Different Metadata Formats Throu...BookNet Canada
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
 
Session 32 - Session Management using Cookies
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using CookiesPawanMM
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologiesjrodbx
 
Java Web services
Java Web servicesJava Web services
Java Web servicesSujit Kumar
 

What's hot (20)

Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase Integration
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
RESTful Web Services with Spring MVC
RESTful Web Services with Spring MVCRESTful Web Services with Spring MVC
RESTful Web Services with Spring MVC
 
Drupal is not your Website
Drupal is not your Website Drupal is not your Website
Drupal is not your Website
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
[2015/2016] Backbone JS
[2015/2016] Backbone JS[2015/2016] Backbone JS
[2015/2016] Backbone JS
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
 
[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
HTML5 features & JavaScript APIs
HTML5 features & JavaScript APIsHTML5 features & JavaScript APIs
HTML5 features & JavaScript APIs
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Metadata Beyond ONIX: How Publishers can use Different Metadata Formats Throu...
Metadata Beyond ONIX: How Publishers can use Different Metadata Formats Throu...Metadata Beyond ONIX: How Publishers can use Different Metadata Formats Throu...
Metadata Beyond ONIX: How Publishers can use Different Metadata Formats Throu...
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design Patterns
 
Session 32 - Session Management using Cookies
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using Cookies
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologies
 
Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
Java Web services
Java Web servicesJava Web services
Java Web services
 

Similar to Group meeting: Polaris - Faster Page Loads Using Fine-grained Dependency Tracking

Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applicationsEugene Lazutkin
 
JavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User ExperienceJavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User Experiencereeder29
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pagesNilesh Bafna
 
Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Chris Danford
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScriptkoppenolski
 
Drupal Is Not Your Web Site
Drupal Is Not Your Web SiteDrupal Is Not Your Web Site
Drupal Is Not Your Web SitePhase2
 
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax ApplicationsTSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applicationsguestc75cdc
 
Performance anti patterns in ajax applications
Performance anti patterns in ajax applicationsPerformance anti patterns in ajax applications
Performance anti patterns in ajax applicationsSergeyChernyshev
 
Performance-driven front-end development
Performance-driven front-end developmentPerformance-driven front-end development
Performance-driven front-end developmentyouth Overturn
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to JqueryGurpreet singh
 
High performance website
High performance websiteHigh performance website
High performance websiteChamnap Chhorn
 
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyChanghwan Yi
 
Vlad zelinschi optimizing the critical rendering path
Vlad zelinschi   optimizing the critical rendering pathVlad zelinschi   optimizing the critical rendering path
Vlad zelinschi optimizing the critical rendering pathCodecamp Romania
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentAkihiro Ikezoe
 

Similar to Group meeting: Polaris - Faster Page Loads Using Fine-grained Dependency Tracking (20)

Javascript for Wep Apps
Javascript for Wep AppsJavascript for Wep Apps
Javascript for Wep Apps
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
JavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User ExperienceJavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User Experience
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
 
Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
Drupal Is Not Your Web Site
Drupal Is Not Your Web SiteDrupal Is Not Your Web Site
Drupal Is Not Your Web Site
 
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax ApplicationsTSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
 
Performance anti patterns in ajax applications
Performance anti patterns in ajax applicationsPerformance anti patterns in ajax applications
Performance anti patterns in ajax applications
 
Performance (browser)
Performance (browser)Performance (browser)
Performance (browser)
 
Performance-driven front-end development
Performance-driven front-end developmentPerformance-driven front-end development
Performance-driven front-end development
 
Java script
Java scriptJava script
Java script
 
Java script
Java scriptJava script
Java script
 
Remix
RemixRemix
Remix
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
High performance website
High performance websiteHigh performance website
High performance website
 
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssembly
 
Vlad zelinschi optimizing the critical rendering path
Vlad zelinschi   optimizing the critical rendering pathVlad zelinschi   optimizing the critical rendering path
Vlad zelinschi optimizing the critical rendering path
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
 
Web Pages
Web PagesWeb Pages
Web Pages
 

More from Yu-Hsin Hung

Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for LinuxYu-Hsin Hung
 
Project meeting: Android Graphics Architecture Overview
Project meeting: Android Graphics Architecture OverviewProject meeting: Android Graphics Architecture Overview
Project meeting: Android Graphics Architecture OverviewYu-Hsin Hung
 
Project meeting: SVMP - Secure Virtual Mobile Platform
Project meeting: SVMP - Secure Virtual Mobile PlatformProject meeting: SVMP - Secure Virtual Mobile Platform
Project meeting: SVMP - Secure Virtual Mobile PlatformYu-Hsin Hung
 
Group meeting: UniSan - Proactive Kernel Memory Initialization to Eliminate D...
Group meeting: UniSan - Proactive Kernel Memory Initialization to Eliminate D...Group meeting: UniSan - Proactive Kernel Memory Initialization to Eliminate D...
Group meeting: UniSan - Proactive Kernel Memory Initialization to Eliminate D...Yu-Hsin Hung
 
Group meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Group meeting: TaintPipe - Pipelined Symbolic Taint AnalysisGroup meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Group meeting: TaintPipe - Pipelined Symbolic Taint AnalysisYu-Hsin Hung
 
Group meeting: Identifying Information Disclosure in Web Applications with Re...
Group meeting: Identifying Information Disclosure in Web Applications with Re...Group meeting: Identifying Information Disclosure in Web Applications with Re...
Group meeting: Identifying Information Disclosure in Web Applications with Re...Yu-Hsin Hung
 
DockerVC Hackathon Presentation
DockerVC Hackathon PresentationDockerVC Hackathon Presentation
DockerVC Hackathon PresentationYu-Hsin Hung
 

More from Yu-Hsin Hung (8)

IoT/M2M Security
IoT/M2M SecurityIoT/M2M Security
IoT/M2M Security
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for Linux
 
Project meeting: Android Graphics Architecture Overview
Project meeting: Android Graphics Architecture OverviewProject meeting: Android Graphics Architecture Overview
Project meeting: Android Graphics Architecture Overview
 
Project meeting: SVMP - Secure Virtual Mobile Platform
Project meeting: SVMP - Secure Virtual Mobile PlatformProject meeting: SVMP - Secure Virtual Mobile Platform
Project meeting: SVMP - Secure Virtual Mobile Platform
 
Group meeting: UniSan - Proactive Kernel Memory Initialization to Eliminate D...
Group meeting: UniSan - Proactive Kernel Memory Initialization to Eliminate D...Group meeting: UniSan - Proactive Kernel Memory Initialization to Eliminate D...
Group meeting: UniSan - Proactive Kernel Memory Initialization to Eliminate D...
 
Group meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Group meeting: TaintPipe - Pipelined Symbolic Taint AnalysisGroup meeting: TaintPipe - Pipelined Symbolic Taint Analysis
Group meeting: TaintPipe - Pipelined Symbolic Taint Analysis
 
Group meeting: Identifying Information Disclosure in Web Applications with Re...
Group meeting: Identifying Information Disclosure in Web Applications with Re...Group meeting: Identifying Information Disclosure in Web Applications with Re...
Group meeting: Identifying Information Disclosure in Web Applications with Re...
 
DockerVC Hackathon Presentation
DockerVC Hackathon PresentationDockerVC Hackathon Presentation
DockerVC Hackathon Presentation
 

Recently uploaded

What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Recently uploaded (20)

What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

Group meeting: Polaris - Faster Page Loads Using Fine-grained Dependency Tracking

  • 1. Polaris: Faster Page Loads Using Fine-grained Dependency Tracking Ravi Netravali, Ameesh Goyal, James Mickens*, Hari Balakrishnan MIT CSAIL, *Harvard University MIT Center for Wireless Networks and Mobile Computing NSDI ‘16
  • 2. “MIT develops a new technique to load webpages faster” “MIT's answer to cutting webpage load- times? It's the Polaris compression-trumping browser framework” “MIT has a way to speed up web browsing by 34 percent”
  • 3. Outline • Introduction • Background • Scout: Dependency Tracking • Polaris: Dynamic Client-side Scheduling • Evaluation • Conclusion
  • 5. Web performance • Users demand fast page loads • Slow page loads lead to lost revenue and low search rank
  • 6. Load web pages • A browser must resolve the page’s dependency graph • “load-before” relationships between HTML, CSS, JavaScript, and images object • only partially revealed to a browser • use conservative algorithms
  • 7. <script src="http://x.com/first.js"/> <script src="http://x.com/second.js"/> <link src="http://x.com/style.css"/> synchronously fetch and evaluate
  • 8.
  • 9.
  • 10. Contributions • Scout: a new measurement infrastructure • automatically tracks fine-grained data dependencies • instruments web pages to track precise data flows between and within JavaScript heap and the browser’s internal HTML and CSS states • e.g. track read/write dependencies for an individual JavaScript variables • 81% of real-world test cases have different critical paths in new graphs
  • 11. Contributions • Polaris: a dynamic client-side scheduler • use Scout’s fine-grained dependency graphs to reduce page load times by 34% on unmodified commodity browsers • the server returns a scheduler stub instead of the page’s original HTML • scheduler stub = Polaris JavaScript library + fine-grained dependency graph generated by Scout + original HTML • aggressively fetch and evaluate objects “out-of-order” with respect to lexical constraints between HTML tags • also considers network conditions
  • 13. Conventional page load • Consider pure HTML • downloads page’s top-level HTML • parses HTML tags • generates DOM (Document Object Model) tree • constructs a render tree (with visual attributes) • produces a layout tree (geometric properties) • updates (or “paints”) the screen
  • 14.
  • 15. Loading More Complicated Pages • JavaScript • <script> tag blocks the HTML parser, halting the construction of the DOM tree. • JavaScript can use document.write() to dynamic change HTML after a <script> tag • modern browsers enters speculation mode when encountering a synchronous <script> tag
  • 16. <script src="demo_async.js" async></script> <script src="demo_defer.js" defer></script> • async • script downloaded in parallel with the HTML parse, but executed synchronously in a parse-blocking manner. • defer • script executed once HTML parsing is complete (DOMContentLoaded) • 98.3% of all JavaScript files in 200 popular sites do not use async or defer attribute
  • 17. Loading More Complicated Pages • CSS • CSS Object Model (CSSOM) tree • To create the render tree, the browser uses the DOM tree to enumerate a page’s visible HTML tags, and the CSSOM tree to determine what those visible tags should look like. • CSS tags do not block HTML parsing, but they do block rendering, layout, painting, and JavaScript execution. • Best practices encourage developers to place CSS tags at the top of pages, to ensure that the CSSOM tree is built quickly. • Images and other media files
  • 18. The Pitfalls of Lexical Dependencies • A script tag might read CSS style properties from the DOM tree, so CSS evaluation must block JavaScript execution. • A script tag might change downstream HTML, so when the browser encounters a script tag, either HTML parsing must block, or HTML parsing must transfer to a speculative thread. • Two script tags that are lexically adjacent might exhibit a write/read dependency on JavaScript state. Thus, current browsers must execute the script tags serially, in lexical order.
  • 20. Page State • Objects in a web page interact with each other via two kinds of state • JavaScript heap managed by JavaScript runtime • DOM state
  • 21. Dependency Types • Write/read • arise when one object produces state (e.g. global variable) that another object consumes • Read/write • occur when one object must read a piece of state before the value is updated by another object • Write/write • arise when two objects update the same piece of state, and we must preserve the relative ordering of the writes. • CSS: later writer wins • output devices, localStorage API
  • 22.
  • 23. Dependency Types • Traditional dependencies based on HTML tag constraints can often be eliminated if finer-grained dependencies are known • For example, once we know the DOM dependencies and JavaScript heap dependencies for a <script> tag, the time at which the script can be evaluated is completely decoupled from the position of the <script> tag in the HTML — we merely have to ensure that we evaluate the script after its fine-grained dependencies are satisfied.
  • 24. Capturing Dependencies with Scout • record the content of the page using Mahimahi • rewrite each JavaScript and HTML file in the page, adding instrumentation to log fine-grained data flows across the JavaScript heap and the DOM. • load the instrumented page in a regular browser, emits dependency logs to Scout analysis server, then generates the fine-grained dependency graph.
  • 25. Capturing Dependencies with Scout • Tracking Javascript heap dependencies • Scout leverages JavaScript proxy objects (wrapper), allowing custom event handlers to fire whenever external code tries to read or write the properties of the underlying object. • rewrite global variable access x with window.x, forcing all accesses to the global namespace to go through Scout’s window proxy • recursive proxying for non-primitive global values (e.g. window.x.y.z)
  • 26. Capturing Dependencies with Scout • Tracking DOM dependencies • JavaScript code interacts with the DOM tree through the window.document object (e.g. document.getElementById(id)) • Scout’s recursive proxy for window.document automatically creates proxies for all DOM nodes that are returned to JavaScript code • A write to a single DOM path may trigger cascading updates to other paths (e.g. inserting a new node) • The DOM tree can also be modified by the evaluation of CSS objects that change node styles • prepends inline JavaScript tag to log the current state of DOM tree
  • 27. Capturing Dependencies with Scout • Missing dependencies • nondeterministic JavaScript behaviors (e.g. Math.random()) • Scout must create a dependency graph which contains the aggregate set of all possible dependencies • A web server might personalize the graph in response to a user’s cookie or user agent string. The server-side logic must run Scout on each version of the dependency graph.
  • 28. Capturing Dependencies with Scout • Implementation • use Esprima, Estravers, Escodegen to rewrite JavaScript code; use Beautiful Soup to rewrite HTML • current implementation does not support the eval(sourceCode) statement
  • 29. Dependency Graphs: Scout vs. Prior Tools treats CSS as a read/write to all upstream HTML
  • 30. Results • (a) adds 29.8% additional edges at the median, and 118% more edges at the 95th percentile • (b) adding fine-grained dependencies alters the critical path length for 80.8% of the pages in their corpus • (d) 86.6% of pages have a smaller fraction of slack nodes when fine-grained dependencies are considered 29.8% 0.192 0.866
  • 32.
  • 33. Polaris • Polaris is written completely in JavaScript, allowing it to run on unmodified commodity browsers. • Polaris accepts a Scout graph as input, but also uses observations about current network conditions to determine the dynamic critical path for a page.
  • 34. Polaris scheduler stub • The scheduler itself is just inline JavaScript code • The Scout dependency graph for the page is represented as a JavaScript variable inside the scheduler • DNS prefetch hints indicate to the browser that the scheduler will be contacting certain hostnames in the near future (for pre-warm) • the stub contains the page’s original HTML, which is broken into chunks as determined by Scout’s fine-grained dependency resolution • src attributes in HTML tags are deleted • the scheduler stub was 3% (36.5 KB) larger than a page’s original HTML at the median <link rel="dns-prefetch" href="http://domain.com">
  • 35. Polaris scheduler • uses XMLHttpRequests to dynamically fetch object • uses built-in eval() function to evaluate a JavaScript file • leverages DOM interfaces like document.innerHTML to evaluate HTML, CSS, and images
  • 36. Browser network constraints • Modern browsers limit a page to at most six outstanding requests to a given origin • maintains per-origin priority queues • If fetching the next object along a critical path would violate a per-origin network constraint, Polaris examines its queues, and fetches the highest priority object from an origin that has available request slots.
  • 37. Frames • A single page may contain multiple iframes • Scout generates a scheduler stub for each one, but the browser’s per-origin request cap is a page- wide limit. • The scheduler in the top frame coordinates the schedulers in child frames. Using postMessage() calls, children ask the top-most parent for permission to request particular objects.
  • 38. URL matching • An XMLHttpRequest URL may embed the current date in its query string • Polaris uses a matching heuristic to map dynamic URLs to their equivalents in the static dependency graph
  • 39. Page-generated XHRs • When Polaris evaluates a JavaScript file, the executed code might try to fetch an object via XMLHttpRequest. • Polaris uses an XMLHttpRequest shim to suppress autonomous XMLHttpRequests. • Polaris issues those requests using its own scheduling algorithm, and manually fires XMLHttpRequest event handlers when the associated data has arrived.
  • 41. Methodology • A page’s load time is normally defined with respect to JavaScript events like navigationStart and loadEventEnd. • loadEventEnd is inaccurate for Polaris pages • First loaded the original version of the page and used tcpdump to capture the objects that were fetched between navigationStart and loadEventEnd. Then defined the load time of the Polaris page as the time needed to fetch all of those objects.
  • 42. Results • performance improves by 34% and 59% for the median and 95th percentile sites • Polaris’ benefits grow as network latencies in- crease, because higher RTTs increase the penalty for bad fetch schedules.
  • 43. Figure: Polaris’ average reduction in page load times, relative to baseline load times with Firefox v40.0. Each bar is the average reduction in load time across the entire 200 site corpus. Error bars span one standard deviation in each direction of the average.
  • 44. Figure: Polaris’ average reduction in page load times, relative to baseline load times, for three sites with diverse dependency graph structures. Each experiment used a link rate of 12 Mbits/s.
  • 45. Figure: Request initiation times for the regular and Polaris-enabled versions of StackOverflow. These results used a 12 Mbits/s link with an RTT of 100 ms.
  • 46. Figure: Polaris’ benefits with warm caches, normalized with respect to Polaris’ gains with cold caches. Each data point represents one of the 200 sites in our corpus. Pages were loaded over a 12 Mbits/s link with an RTT of 100 ms.
  • 47. SPDY • Google proposed SPDY, a transport protocol for HTTP messages, to remedy several problems with the HTTP/1.1 protocol. • uses a single TCP connection to multiplex all of a browser’s HTTP requests and responses involving a particular origin • allows a browser to prioritize the fetches of certain objects • compresses HTTP headers • allows a server to proactively push objects to a browser if the server believes that the browser will request those objects in the near future
  • 48. Figure: Average reductions in page load time using SPDY, Polaris over HTTP/1.1, and Polaris over SPDY. The performance baseline was load time using HTTP/1.1. The link rate was 12 Mbits/s.
  • 49. Conclusion • Prior load schedulers have used those lexical relationships to extract dependency graphs • Use a new tool called Scout to track the fine-grained data flows that arise during a page’s load process • Scout detects 30% more edges for the median page • these additional edges actually give browsers more opportunities to reduce load times • Introduce a new client-side scheduler called Polaris which leverages Scout graphs to assemble a page • Polaris reduces load times by 34% for the median page • prioritizing the fetches of objects along the dynamic critical path, Polaris minimizes the number of RTTs needed to load a page.