Horcrux: Automatic JavaScript Parallelism for Resource-Efficient Web Computation

Web pages today commonly include large amounts of JavaScript code in order to offer users a dynamic experience. These scripts often make pages slow to load, partly due to a fundamental inefficiency in how browsers process JavaScript content: browsers make it easy for web developers to reason about page state by serially executing all scripts on any frame in a page, but as a result, fail to leverage the multiple CPU cores that are readily available even on low-end phones. In this paper, we show how to address this inefficiency without requiring pages to be rewritten or browsers to be modified. The key to our solution, Horcrux, is to account for the non-determinism intrinsic to web page loads and the constraints placed by the browser’s API for parallelism. Horcrux-compliant web servers perform offline analysis of all the JavaScript code on any frame they serve to conservatively identify, for every JavaScript function, the union of the page state that the function could access across all loads of that page. Horcrux’s JavaScript scheduler then uses this information to judiciously parallelize JavaScript execution on the client-side so that the end-state is identical to that of a serial execution, while minimizing coordination and offloading overheads. Across a wide range of pages, phones, and mobile networks covering web workloads in both developed and emerging regions, Horcrux reduces median browser computation delays by 31-44% and page load times by 18-37%.

[1]  Ravi Netravali,et al.  Prophecy: Accelerating Mobile Page Loads Using Final-state Write Logs , 2018, NSDI.

[2]  Jeffrey C. Mogul,et al.  Using predictive prefetching to improve World Wide Web latency , 1996, CCRV.

[3]  Michael Ferdman,et al.  Impact of Device Performance on Mobile Internet QoE , 2018, Internet Measurement Conference.

[4]  Allan Kuchinsky,et al.  Quality is in the eye of the beholder: meeting users' requirements for Internet quality of service , 2000, CHI.

[5]  Soumyadeep Ghosh,et al.  Speculatively exploiting cross-invocation parallelism , 2016, 2016 International Conference on Parallel Architecture and Compilation Techniques (PACT).

[6]  Nikhil Kansal,et al.  Alohamora: Reviving HTTP/2 Push and Preload by Adapting Policies On the Fly , 2021, NSDI.

[7]  Hari Balakrishnan,et al.  Vesper: Measuring Time-to-Interactivity for Web Pages , 2018, NSDI.

[8]  Seungjoon Lee,et al.  PARCEL: Proxy Assisted BRowsing in Cellular networks for Energy and Latency reduction , 2014, CoNEXT.

[9]  B. Maggs,et al.  On Landing and Internal Web Pages , 2020 .

[10]  Koushik Sen,et al.  DART: directed automated random testing , 2005, PLDI '05.

[11]  Samuel T. King,et al.  A case for parallelizing web pages , 2012, HotPar'12.

[12]  James Mickens,et al.  Pivot: Fast, Synchronous Mashup Isolation Using Generator Chains , 2014, 2014 IEEE Symposium on Security and Privacy.

[13]  David Wetherall,et al.  Speeding up Web Page Loads with Shandian , 2016, NSDI.

[14]  Zachary S. Bischof,et al.  AMP up your Mobile Web Experience: Characterizing the Impact of Google's Accelerated Mobile Project , 2019, MobiCom.

[15]  Johannes Kinder,et al.  ExpoSE: practical symbolic execution of standalone JavaScript , 2017, SPIN.

[16]  Hari Balakrishnan,et al.  WatchTower: Fast, Secure Mobile Page Loads Using Remote Dependency Resolution , 2019, MobiSys.

[17]  Koushik Sen,et al.  CUTE: a concolic unit testing engine for C , 2005, ESEC/FSE-13.

[18]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.

[19]  Hari Balakrishnan,et al.  Polaris: Faster Page Loads Using Fine-grained Dependency Tracking , 2016, NSDI.

[20]  Ravi Netravali,et al.  Reverb: Speculative Debugging for Web Applications , 2019, SoCC.

[21]  David I. August,et al.  Perspective: A Sensible Approach to Speculative Automatic Parallelization , 2020, ASPLOS.

[22]  Ramesh K. Sitaraman,et al.  The Akamai network: a platform for high-performance internet applications , 2010, OPSR.

[23]  Ravi Netravali,et al.  Fawkes: Faster Mobile Page Loads via App-Inspired Static Templating , 2020, NSDI.

[24]  Jon Howell,et al.  Mugshot: Deterministic Capture and Replay for JavaScript Applications , 2010, NSDI.

[25]  Hari Balakrishnan,et al.  Mahimahi: Accurate Record-and-Replay for HTTP , 2015, USENIX Annual Technical Conference.

[26]  Aruna Balasubramanian,et al.  An In-depth Study of Mobile Browser Performance , 2016, WWW.

[27]  Calin Cascaval,et al.  ZOOMM: a parallel web browser engine for multicore mobile devices , 2013, PPoPP '13.

[28]  Guohong Cao,et al.  Energy-Efficient Computation Offloading for Multicore-Based Mobile Devices , 2018, IEEE INFOCOM 2018 - IEEE Conference on Computer Communications.

[29]  Moumena Chaqfeh,et al.  JSCleaner: De-Cluttering Mobile Webpages Through JavaScript Cleanup , 2020, WWW.

[30]  Harsha V. Madhyastha,et al.  Vroom: Accelerating the Mobile Web with Server-Aided Dependency Resolution , 2017, SIGCOMM.

[31]  Lakshminarayanan Subramanian,et al.  Dissecting Web Latency in Ghana , 2014, Internet Measurement Conference.

[32]  Dennis F. Galletta,et al.  Web Site Delays: How Tolerant are Users? , 2004, J. Assoc. Inf. Syst..

[33]  David Wetherall,et al.  Demystifying Page Load Performance with WProf , 2013, NSDI.

[34]  Ravi Netravali,et al.  Oblique: Accelerating Page Loads Using Symbolic Execution , 2021, NSDI.

[35]  Srikanth V. Krishnamurthy,et al.  FlexiWeb: Network-Aware Compaction for Accelerating Mobile Web Transfers , 2015, MobiCom.

[36]  Matt Welsh,et al.  Flywheel: Google's Data Compression Proxy for the Mobile Web , 2015, NSDI.

[37]  Vijay Gopalakrishnan,et al.  NutShell: Scalable Whittled Proxy Execution for Low-Latency Web over Cellular Networks , 2017, MobiCom.

[38]  Zhenyu Zhou,et al.  A View from the Other Side: Understanding Mobile Phone Characteristics in the Developing World , 2016, Internet Measurement Conference.

[39]  Zhen Wang,et al.  How far can client-only solutions go for mobile browser speed? , 2011, WWW.

[40]  Koushik Sen,et al.  Symbolic execution for software testing: three decades later , 2013, CACM.

[41]  Youngsun Han,et al.  JavaScript Parallelizing Compiler for Exploiting Parallelism from Data-Parallel HTML5 Applications , 2016, ACM Trans. Archit. Code Optim..

[42]  Sukyoung Ryu,et al.  Battles with False Positives in Static Analysis of JavaScript Web Applications in the Wild , 2016, 2016 IEEE/ACM 38th International Conference on Software Engineering Companion (ICSE-C).

[43]  Scott A. Mahlke,et al.  Dynamic parallelization of JavaScript applications using an ultra-lightweight speculation mechanism , 2011, 2011 IEEE 17th International Symposium on High Performance Computer Architecture.

[44]  Allan Kuchinsky,et al.  Integrating user-perceived quality into Web server design , 2000, Comput. Networks.

[45]  David Wetherall,et al.  How Speedy is SPDY? , 2014, NSDI.

[46]  David Mazières,et al.  Democratizing Content Publication with Coral , 2004, NSDI.

[47]  James Mickens,et al.  Rivet: Browser-agnostic Remote Debugging for Web Applications , 2012, USENIX Annual Technical Conference.

[48]  Benjamin Livshits,et al.  Practical static analysis of JavaScript applications in the presence of frameworks and libraries , 2013, ESEC/FSE 2013.

[49]  Zhe Wu,et al.  Klotski: Reprioritizing Web Content to Improve User Experience on Mobile Devices , 2015, NSDI.

[50]  Karin Strauss,et al.  PocketWeb: instant web browsing for mobile devices , 2012, ASPLOS XVII.