Snapshot-based Loading Acceleration of Web Apps with Nondeterministic JavaScript Execution

JavaScript execution is heavily used during the loading of web apps, taking a substantial portion of the app loading time. To accelerate JavaScript execution, snapshot-based app loading has been proposed [5, 17]. We take a snapshot of the JavaScript objects in the heap at some point during app loading (which we call snapshot point) and save them in a file in advance. Then, we start app loading by copying the objects in the snapshot to the heap directly, skipping JavaScript execution to create those objects. One issue is that the JavaScript execution state at the snapshot point should be the same at every app loading. If JavaScript execution included in the snapshot is involved with some nondeterminism (e.g., use random function or current time/location), snapshot-based app loading might be inapplicable since the loaded state might differ each time. In this paper, we perform an empirical study for the nondeterministic behavior of web apps during app loading. The result shows that nondeterminism is used frequently, but its impact is small from the user's perspectives. Based on this observation, we propose two techniques that can increase the applicability of snapshot. First, we propose two types of snapshot point, which allows saving as much execution state as possible in the snapshot, just before the nondeterministic execution affects the user's perception. Second, we develop a tool to identify those snapshot points by static and dynamic analysis, so that the developer can easily identify them. Our experimental results show that the techniques can accelerate the app loading by 1.81 times, by applying the snapshot that would otherwise be inapplicable, achieving a performance comparable to that of a snapshot that completely ignores the nondeterminism issues.

[1]  Lei Ma,et al.  Efficient and Precise Dynamic Slicing for Client-Side JavaScript Programs , 2016, 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

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

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

[4]  Koushik Sen,et al.  TypeDevil: Dynamic Type Inconsistency Analysis for JavaScript , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[5]  Earl T. Barr,et al.  Tardis: affordable time-travel debugging in managed runtimes , 2014, OOPSLA.

[6]  Soo-Mook Moon,et al.  Snapshot-based loading-time acceleration for web applications , 2015, 2015 IEEE/ACM International Symposium on Code Generation and Optimization (CGO).

[7]  Priya Narasimhan,et al.  Living with Nondeterminism in Replicated Middleware Applications , 2006, Middleware.

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

[9]  Frank Tip,et al.  A framework for automated testing of javascript web applications , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[10]  Donald Yeung,et al.  Application-Level Correctness and its Impact on Fault Tolerance , 2007, 2007 IEEE 13th International Symposium on High Performance Computer Architecture.

[11]  Michael Pradel,et al.  ConflictJS: Finding and Understanding Conflicts Between JavaScript Libraries , 2018, 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE).

[12]  Soo-Mook Moon,et al.  Accelerating web application loading with snapshot of event and DOM handling , 2019, CC.

[13]  Chao Wang,et al.  Static DOM event dependency analysis for testing web applications , 2016, SIGSOFT FSE.

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

[15]  Koushik Sen,et al.  Jalangi: a selective record-replay and dynamic analysis framework for JavaScript , 2013, ESEC/FSE 2013.

[16]  Frank Tip,et al.  Static analysis of event-driven Node.js JavaScript applications , 2015, OOPSLA.