AjaxScope & Doloto: Towards Optimizing Client-side Web 2.0 App Performance Ben Livshits Microsoft Research (joint work with Emre.

Slides:



Advertisements
Similar presentations
Lecture 8: Memory Hierarchy Cache Performance Kai Bu
Advertisements

WEAVING CODE EXTENSIONS INTO JAVASCRIPT Benjamin Lerner, Herman Venter, and Dan Grossman University of Washington, Microsoft Research.
Client side performance in Web based Banking applications Divakar Prabhu Infosys Limited (NASDAQ: INFY)
® IBM Software Group © 2010 IBM Corporation What’s New in Profiling & Code Coverage RAD V8 April 21, 2011 Kathy Chan
1 Content Delivery Networks iBAND2 May 24, 1999 Dave Farber CTO Sandpiper Networks, Inc.
 Emre Kıcıman Researcher Microsoft Corporation  Ethan Jackson Post Doc Researcher Microsoft Corporation.
An Analysis of Internet Content Delivery Systems Stefan Saroiu, Krishna P. Gommadi, Richard J. Dunn, Steven D. Gribble, and Henry M. Levy Proceedings of.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
S ECURING WEB 2.0 APPLICATIONS THROUGH REPLICATED EXECUTION Ben Livshits Microsoft Research K. Vikram Cornell University Abhishek Prateek IIT Delhi.
Ben Livshits and Emre Kiciman Microsoft Research Redmond, WA.
Improving Proxy Cache Performance: Analysis of Three Replacement Policies Dilley, J.; Arlitt, M. A journal paper of IEEE Internet Computing, Volume: 3.
WHAT IS AJAX? Zack Sheppard [zts2101] WHIM April 19, 2011.
Web Page Behavior IS 373—Web Standards Todd Will.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
Client/Server Architectures
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Active Network Applications Tom Anderson University of Washington.
DHTML - Introduction Introduction to DHTML, the DOM, JS review.
REAL WORLD SPA A KNOCKOUT CASE STUDY Cory House | bitnative.com | speakerrate.com/talks/27181.
1 Responsive Design Gilbane Boston 28 November Peter Marsh SVP, Sales & Marketing Atex Group Ltd.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
 Zhichun Li  The Robust and Secure Systems group at NEC Research Labs  Northwestern University  Tsinghua University 2.
JavaScript & jQuery the missing manual Chapter 11
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Ruth Betcher Ruth Christie
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
AJAX Without the “J” George Lawniczak. What is Ajax?
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Intro to Ajax Fred Stluka Jan 25, /25/2006Intro to AjaxFred Stluka2 What is Ajax? "Asynchronous JavaScript and XML" New name for an old technique:
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
AJAX and Atlas in ASP.NET 2.0 William J. Steele MSDN Developer Evangelist Microsoft Corporation
Mobile Consumer Experience: designing for fast response time OSCON 2013 David Elfi Intel.
Ideas to Improve SharePoint Usage 4. What are these 4 Ideas? 1. 7 Steps to check SharePoint Health 2. Avoid common Deployment Mistakes 3. Analyze SharePoint.
Computer Science Detecting Memory Access Errors via Illegal Write Monitoring Ongoing Research by Emre Can Sezer.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Web Applications BIS4430 – unit 8. Learning Objectives Explain the uses of web application frameworks Relate the client-side, server-side architecture.
Procrastinator: Pacing Mobile Apps’ Usage of the Network mobisys 2014.
Random Logic l Forum.NET l AJAX Behind the buzz word Forum.NET ● January 23, 2006.
Computing Infrastructure for Large Ecommerce Systems -- based on material written by Jacob Lindeman.
Monitoring the acquisition process by web widgets Leonardo Tininini and Antonino Virgillito ISTAT Meeting on the Management of Statistical Information.
DynaRIA: a Tool for Ajax Web Application Comprehension Dipartimento di Informatica e Sistemistica University of Naples “Federico II”, Italy Domenico Amalfitano.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
REAL WORLD AJAX MARCH TIBCO USER CONFERENCE / 2004 Enterprise Rich Internet Applications with AJAX Real World Case Studies with TIBCO General Interface™
AFTERCOLLEGE SELF- SERVICE SCRAPE CONFIGURATION AND POSTING UTILITY Kai Hu Haiyan Wu March 17, Cowell 416 Midterm Presentation.
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
© 2006, National Research Council Canada © 2006, IBM Corporation Solving performance issues in OTS-based systems Erik Putrycz Software Engineering Group.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Event Handling & AJAX IT210 Web Systems. Question How do we enable users to dynamically interact with a website? Answer: Use mouse and keyboard to trigger.
IE Developer Tools Jonathan Seitel Program Manager.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
SpyProxy SpyProxy Execution-based Detection of MaliciousWeb Content Execution-based Detection of MaliciousWeb Content Hongjin, Lee.
Pinpoint: Problem Determination in Large, Dynamic Internet Services Mike Chen, Emre Kıcıman, Eugene Fratkin {emrek,
A UTOMATICALLY SECURING WEB 2.0 APPLICATIONS THROUGH REPLICATED EXECUTION Ben Livshits Microsoft Research.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
Basics Components of Web Design & Development Basics, Components, Design and Development.
FASTER PERFORMANCE FOR DYNAMIC HTML PAGES BY SHARAD JAISWAL.
Enhance Your Page Load Speed And Improve Traffic.
Constraint Framework, page 1 Collaborative learning for security and repair in application communities MIT site visit April 10, 2007 Constraints approach.
Google Maps API v3: Built First for Mobile Susannah Raub Google June 24, 2010.
Google Web Toolkit Tutorial
Viewbiquity HTML5 Tom Shafron Developer’s Blog CEO, Viewbiquity
Doloto: Code Splitting for Web 2.0 Applications
Michael Robertson Yuta Takayama Google Closure Tools.
Application with Cross-Platform GUI
Doloto: Code Splitting for Web 2.0 Applications
Doloto: Code Splitting for AJAX Applications
JavaScript CS 4640 Programming Languages for Web Applications
Yale Digital Conference 2019
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

AjaxScope & Doloto: Towards Optimizing Client-side Web 2.0 App Performance Ben Livshits Microsoft Research (joint work with Emre Kıcıman)

Motivation Improve applications we use daily Take research ideas and techniques from – Compilers and program analysis – Distributed systems – Networking Web 2.0 apps: a natural choice – Tons of new AJAX apps being developed: bleeding edge – Ability to influence things: new AJAX frameworks Two projects – AjaxScope: instrumentation platform for AJAX-based Web apps – Doloto: dynamic code loading for faster Web 2.0 apps

A Web 2.0 Application 70,000+ lines of JavaScript code downloaded to client 2,855 Functions ~ 1 MB code Talks to >14 backend services (traffic, images, search, directions, ads, …) Talks to >14 backend services (traffic, images, search, directions, ads, …)

Web 1.0 → Web 2.0 Server-side computation Client-side rendering Static HTML

Web 1.0 → Web 2.0 Server-side computation Client-side rendering Static HTML JavaScript + DHTML Client-side computation Complex distributed apps

Outline 1.Web 2.0 Apps 2.AjaxScope Platform 3.AjaxScope Policies: – Adaptive performance profiling – Debugging: finding memory leaks 4.Doloto: Code Splitting & Download Latency 5.Conclusions

AjaxScope Approach Goal: Detailed visibility into app behavior in the client Approach: On-the-fly rewriting to add instrumentation Key Enabler: Instant re-deployability of web apps

AjaxScope Proxy Rewriting Engine JS Parser Web Page Rewritten Web Page Log Collector Logs Instrumentation #2 Instrumentation #1 Pluggable policies Controls rewriting based on incoming logs Platform support for adaptive and distributed instrumentation Pluggable policies Controls rewriting based on incoming logs Platform support for adaptive and distributed instrumentation

Performance Optimization Performance profiling (no browser changes required) String optimization; cache placement; … Code splitting and joining, data prefetching Debugging Report function arguments, app state, errors Memory leak checking Statistical debugging Test Code coverage A/B tests Operations Measure RPC network latencies What features are being used / discovered? Monitoring Goals

Server-side Deployment Logs Users

Our Prototype (Client-side) Logs Researcher/ Developer

Why “On-the-fly” Rewriting Service has tight control over code running at client – Clients always download new version – Cache-ability controlled by service Enables dynamic instrumentation Use to reduce performance overhead 1.Adaptive instrumentation 2.Distributed Instrumentation

Outline 1.Web Apps 2.AjaxScope Platform 3.AjaxScope Policies – Adaptive performance profiling – Debugging: finding memory leaks 4.Doloto: Code Splitting & Download Latency 5.Conclusions

Experimental Setup Profile 90 web sites’ “startup”, client-side AjaxScope + 6 more JS-heavy news & game sites + 78 sites randomly chosen, weighted by popularity

Observe, Analyze, Update Code Auto-drill-down performance profiling Iteratively add logging only where needed LogTime(); FastFunc1(); FastFunc2(); SlowFunc(); LogTime(); LogTime(); FastFunc1(); LogTime(); FastFunc2(); LogTime(); SlowFunc(); LogTime(); If it’s slow FastFunc1(); FastFunc2(); SlowFunc(); … function SlowFunc() { // drill-down continues } Found it!

Expt: Adaptative Perf Profiling Average 30% reduction in CPU Overhead 95% Average Reduction in Logging Bandwidth

Monitoring for JS Memory Leaks Memory leaks: major problem for complex apps in older browsers – Caused by circular references across DOM + JavaScript memory heaps – Not a big deal for Web 1.0, but matter for long- running apps DOM object DOM object JavaScript object JavaScript object

Example: CNN.com var pipelineContainers = document.getElementById("cnnPipelineModule"). getElementsByTagName("div");... for (var i=0; i<pipelineContainers.length; i++){ var pipelineContainer = pipelineContainers[i]; if(pipelineContainer.id.substr(0,9) == "plineCntr") { pipelineContainer.onmouseover = function () {CNN_changeBackground(this,1); return false;} } First, get DOM elements Then, set their event handlers to a new function

Example: CNN.com var pipelineContainers = document.getElementById("cnnPipelineModule"). getElementsByTagName("div");... for (var i=0; i<pipelineContainers.length; i++){ var pipelineContainer = pipelineContainers[i]; if(pipelineContainer.id.substr(0,9) == "plineCntr") { pipelineContainer.onmouseover = function () {CNN_changeBackground(this,1); return false;} } function closure references pipelineContainer DOM object DOM object JavaScript object JavaScript object

Checking for Memory Leaks a.b = c; a.b = c TraverseHeapAndCheckForCycles(c, a); Check all object assignments for potential cycles Distribute expensive traversals across users Each user gets random N% of checks Controls per-user overhead

Expt: Distributing Expensive Tests Baseline Allows fine-grained control over per-user overhead Trade-off detection time

Outline 1.Web Apps 2.AjaxScope Platform 3.AjaxScope Policies: – Adaptive performance profiling – Debugging: finding memory leaks 4.Doloto: Download Latency & Code Splitting 5.Conclusions

Doloto: Code Splitting and Loading Client-side code is used to reduce latency and improve user experience Takes a while to transfer code to the client Idea behind Doloto: – Start with a small piece of code on the client – Transfer code on demand or – When the bandwidth becomes available Leads to better responsiveness

Web 2.0 Application Code Gmail Bunny Hunt Drop Things Google Maps Live.Com Pageflakes Hotmail Tons and tons of JavaScript code

All-at-once Loading: Bunny Hunt It’s an arcade game Explicitly download all resources before starting the game – Images, CSS, JS – 16KB JavaScript – 272KB total

Dynamic Loading: PageFlakes Mash-up gadget/portal page >1MB total download (including 640kb JavaScript) – Initial page loads quickly – First loads only small code stub – Rest loaded in the background

Dynamic Loading: Let Everyone Do It Problem: this is hard to do well manually! Mechanism itself is simple: – E.g., var myFunc = eval(xmlhttp.responseText) – Or dojo.require(“dojo.widget.*”) But, have to architect app for splitting – Componentize by expected execution time… – Hard to maintain code splits as app & workload changes Goal: perform automatic code splitting

Automated Splitting (1) 1. Capture function-level workloads of app Cluster functions that are called together – could also be done w/static analysis; except for ‘eval’ Learn what functions are likely to be called when – workload dependent

Automated Splitting (2) 2. Automatically rewrite code for split Replace unloaded functions with a stub Use language tricks to allow fine-grained splits Support closures, optimize runtime cost var g = 10; function f1(){ var x=g+1; … return …; } var g = 10; function f1(){ var x=g+1; … return …; }

Automated Splitting (2) 2. Automatically rewrite code for split Replace unloaded functions with a stub Use language tricks to allow fine-grained splits Support closures, optimize runtime cost var g = 10; function f1(){ var x=g+1; … return …; } var g = 10; function f1(){ var x=g+1; … return …; } var g=10; var real_f1; function f1() { if(!real_f1){ var code=load(“f1”); real_f1=this.eval(code); f1 = real_f1; } return real_f1.apply(this, arguments); } var g=10; var real_f1; function f1() { if(!real_f1){ var code=load(“f1”); real_f1=this.eval(code); f1 = real_f1; } return real_f1.apply(this, arguments); }

Small End-to-end Test-case Word puzzle – 107kb JavaScript 212kb total By default, loads all at startup Reduced to 88kb (18%) JavaScript initial download Rest downloaded in background / on-demand Reduced to 88kb (18%) JavaScript initial download Rest downloaded in background / on-demand

Next Steps Testing on larger applications: Apply static analysis to avoid injecting all stubs Adapt code splits to changing workloads

Doloto Demo (sort of)

Questions? Download AjaxScope/Ajax View prototype: