[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
research-article
Open access

Wasm-R3: Record-Reduce-Replay for Realistic and Standalone WebAssembly Benchmarks

Published: 08 October 2024 Publication History

Abstract

WebAssembly (Wasm for short) brings a new, powerful capability to the web as well as Edge, IoT, and embedded systems. Wasm is a portable, compact binary code format with high performance and robust sandboxing properties. As Wasm applications grow in size and importance, the complex performance characteristics of diverse Wasm engines demand robust, representative benchmarks for proper tuning. Stopgap benchmark suites, such as PolyBenchC and libsodium, continue to be used in the literature, though they are known to be unrepresentative. Porting of more complex suites remains difficult because Wasm lacks many system APIs and extracting real-world Wasm benchmarks from the web is difficult due to complex host interactions. To address this challenge, we introduce Wasm-R3, the first record and replay technique for Wasm. Wasm-R3 transparently injects instrumentation into Wasm modules to record an execution trace from inside the module, then reduces the execution trace via several optimizations, and finally produces a replay module that is executable standalone without any host environment-on any engine. The benchmarks created by our approach are (i) realistic, because the approach records real-world web applications, (ii) faithful to the original execution, because the replay benchmark includes the unmodified original code, only adding emulation of host interactions, and (iii) standalone, because the replay benchmarks run on any engine. Applying Wasm-R3 to web-based Wasm applications in the wild demonstrates the correctness of our approach as well as the effectiveness of our optimizations, which reduce the recorded traces by 99.53% and the size of the replay benchmark by 9.98%. We release the resulting benchmark suite of 27 applications, called Wasm-R3-Bench, to the community, to inspire a new generation of realistic and standalone Wasm benchmarks.

References

[1]
2018. TurboFan: V8’s Optimizing Compiler. https://v8.dev/docs/turbofan (Accessed 2021-07-29)
[2]
2021. JavaScriptCore, the built-in JavaScript engine for WebKit. https://trac.webkit.org/wiki/JavaScriptCore (Accessed 2021-07-29)
[3]
2021. SpiderMonkey: Mozilla’s JavaScript and WebAssembly engine. https://spidermonkey.dev (Accessed 2021-07-29)
[4]
2021. V8 Development Site. https://v8.dev (Accessed 2021-07-29)
[5]
2021. Wasmer: A Fast and Secure WebAssembly Runtime. https://github.com/wasmerio/wasmer (Accessed 2021-07-06)
[6]
2021. Wasmtime: a standalone runtime for WebAssembly. https://github.com/bytecodealliance/wasmtime (Accessed 2021-08-11)
[7]
2024. Announcing Speedometer 3.0: A Shared Browser Benchmark for Web Application Responsiveness. https://browserbench.org/announcements/speedometer3/
[8]
2024. binjgb. https://binji.github.io/binjgb/ Retrieved April 5th, 2024
[9]
Esben Andreasen, Liang Gong, Anders Møller, Michael Pradel, Marija Selakovic, Koushik Sen, and Cristian-Alexandru Staicu. 2017. A Survey of Dynamic Analysis and Test Generation for JavaScript. ACM Comput. Surv., 50, 5 (2017), 66:1–66:36. https://doi.org/10.1145/3106739
[10]
Clemens Backes. 2018. Liftoff: a new baseline compiler for WebAssembly in V8. https://v8.dev/blog/liftoff Accessed: 2024-03-08
[11]
Doehyun Baek, Jakob Getz, and Yusung Sim. 2024. Wasm-R3: Record-Reduce-Replay for Realistic and Standalone WebAssembly Benchmarks (Artifact). https://doi.org/10.5281/zenodo.13382344
[12]
S. M. Blackburn. 2006. The DaCapo Benchmarks: Java Benchmarking Development and Analysis. In Conference on Object-Oriented Programming Systems Languages and Applications (OOPSLA). 169–190.
[13]
Derek L. Bruening. 2004. Efficient, transparent, and comprehensive runtime code manipulation. Ph. D. Dissertation. USA. AAI0807735
[14]
Bytecode Alliance. 2023. WASI: The WebAssembly System Interface. wasi.dev (Accessed 2024-3-26)
[15]
Gabriel Cuvillier. 2024. Arxwasm. https://wasm.continuation-labs.com/arxdemo/ Retrieved April 5th, 2024
[16]
Gabriel Cuvillier. 2024. D3wasm. https://wasm.continuation-labs.com/d3demo/ Retrieved April 5th, 2024
[17]
Frank Denis. 2021. LibSodium WebAssembly Benchmarks. https://github.com/jedisct1/webassembly-benchmarks (Accessed 2023-5-7)
[18]
George W Dunlap, Samuel T King, Sukru Cinar, Murtaza A Basrai, and Peter M Chen. 2002. ReVirt: Enabling intrusion analysis through virtual-machine logging and replay. ACM SIGOPS Operating Systems Review, 36, SI (2002), 211–224.
[19]
Aaron Turner et al. 2024. Wasmboy. https://wasmboy.app/ Retrieved April 5th, 2024
[20]
Matteo Basso et al. 2024. Awesome-Wasm. https://github.com/mbasso/awesome-wasm Retrieved April 5th, 2024
[21]
Zakai et al. 2024. Binaryen. https://github.com/WebAssembly/binaryen Retrieved April 3, 2024
[22]
Phani Kishore Gadepalli, Sean P. McBride, Gregor Peach, L. Cherkasova, and Gabriel Parmer. 2020. Sledge: a Serverless-first, Light-weight Wasm Runtime for the Edge. Proceedings of the 21st International Middleware Conference, https://api.semanticscholar.org/CorpusID:228085728
[23]
Google Chrome Developers. 2024. Chrome DevTools Protocol. https://chromedevtools.github.io/devtools-protocol/
[24]
Zhenyu Guo, Xi Wang, Jian Tang, Xuezheng Liu, Zhilei Xu, Ming Wu, M. Frans Kaashoek, and Zheng Zhang. 2008. R2: an application-level kernel for record and replay. In Proceedings of the 8th USENIX Conference on Operating Systems Design and Implementation (OSDI’08). USENIX Association, USA. 193–208.
[25]
Giuseppe Gurgone and Philipp Spiess. 2018. A Real-World WebAssembly Benchmark. https://pspdfkit.com/blog/2018/a-real-world-webassembly-benchmark/
[26]
M.R. Guthaus, J.S. Ringenberg, D. Ernst, T.M. Austin, T. Mudge, and R.B. Brown. 2001. MiBench: A free, commercially representative embedded benchmark suite. In Proceedings of the Fourth Annual IEEE International Workshop on Workload Characterization. WWC-4 (Cat. No.01EX538). 3–14. https://doi.org/10.1109/WWC.2001.990739
[27]
Andreas Haas, Andreas Rossberg, Derek L. Schuff, Ben L. Titzer, Michael Holman, Dan Gohman, Luke Wagner, Alon Zakai, and JF Bastien. 2017. Bringing the web up to speed with WebAssembly. SIGPLAN Not., 52, 6 (2017), jun, 185–200. issn:0362-1340 https://doi.org/10.1145/3140587.3062363
[28]
Aaron Hilbig, Daniel Lehmann, and Michael Pradel. 2021. An Empirical Study of Real-World WebAssembly Binaries: Security, Languages, Use Cases. In Proceedings of the Web Conference 2021 (WWW ’21). Association for Computing Machinery, New York, NY, USA. 2696–2708. isbn:9781450383127 https://doi.org/10.1145/3442381.3450138
[29]
Yongjian Hu, Tanzirul Azim, and Iulian Neamtiu. 2015. Versatile yet lightweight record-and-replay for Android. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2015). Association for Computing Machinery, New York, NY, USA. 349–366. isbn:9781450336895 https://doi.org/10.1145/2814270.2814320
[30]
Abhinav Jangda, Bobby Powers, Emery D Berger, and Arjun Guha. 2019. Not so fast: Analyzing the performance of $WebAssembly$ vs. native code. In 2019 USENIX Annual Technical Conference (USENIX ATC 19). 107–120.
[31]
Daniel Lehmann, Johannes Kinder, and Michael Pradel. 2020. Everything Old is New Again: Binary Security of WebAssembly. In 29th USENIX Security Symposium, USENIX Security 2020, August 12-14, 2020, Srdjan Capkun and Franziska Roesner (Eds.). USENIX Association, 217–234. https://www.usenix.org/conference/usenixsecurity20/presentation/lehmann
[32]
Daniel Lehmann and Michael Pradel. 2019. Wasabi: A Framework for Dynamically Analyzing WebAssembly. In Proceedings of the Twenty-Fourth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS ’19). Association for Computing Machinery, New York, NY, USA. 1045–1058. isbn:9781450362405 https://doi.org/10.1145/3297858.3304068
[33]
Daniel Lehmann and Michael Pradel. 2022. Finding the dwarf: recovering precise types from WebAssembly binaries. In PLDI ’22: 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation, Ranjit Jhala and Isil Dillig (Eds.). ACM, 410–425. https://doi.org/10.1145/3519939.3523449
[34]
Friedrich Leisch and Evgenia Dimitriadou. 2010. mlbench: Machine Learning Benchmark Problems. R package version 2.1-1
[35]
Borui Li, Hongchang Fan, Yi Gao, and Wei Dong. 2022. Bringing webassembly to resource-constrained iot devices for seamless device-cloud integration. Proceedings of the 20th Annual International Conference on Mobile Systems, Applications and Services, https://api.semanticscholar.org/CorpusID:249705610
[36]
Zhenyue Long, Guoquan Wu, Xiaojiang Chen, Wei Chen, and Jun Wei. 2020. WebRR: self-replay enhanced robust record/replay for web application testing. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE 2020). Association for Computing Machinery, New York, NY, USA. 1498–1508. isbn:9781450370431 https://doi.org/10.1145/3368089.3417069
[37]
William Mbotta. 2024. Tic tac toe Wasm. https://sepiropht.github.io/tic-tac-toe-wasm/ Retrieved April 5th, 2024
[38]
Jämes Ménétrey, Marcelo Pasin, Pascal Felber, and Valerio Schiavoni. 2022. WebAssembly as a Common Layer for the Cloud-edge Continuum. Proceedings of the 2nd Workshop on Flexible Resource and Application Management on the Edge, https://api.semanticscholar.org/CorpusID:249960276
[39]
James Mickens, Jeremy Elson, and Jon Howell. 2010. Mugshot: deterministic capture and replay for Javascript applications. In Proceedings of the 7th USENIX Conference on Networked Systems Design and Implementation (NSDI’10). USENIX Association, USA. 11.
[40]
Microsoft. 2024. Playwright. https://playwright.dev/ Retrieved April 5th, 2024
[41]
Matthias Müller, Brian Whitney, Robert Henschel, and Kalyan Kumaran. 2011. SPEC Benchmarks. Springer US, Boston, MA. 1886–1893. isbn:978-0-387-09766-4 https://doi.org/10.1007/978-0-387-09766-4_370
[42]
Nicholas Nethercote and Julian Seward. 2007. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation. SIGPLAN Not., 42, 6 (2007), jun, 89–100. issn:0362-1340 https://doi.org/10.1145/1273442.1250746
[43]
Harish Patil, Cristiano L. Pereira, Mack Stallcup, Gregory Lueck, and James H. Cownie. 2010. PinPlay: a framework for deterministic replay and reproducible analysis of parallel programs. In IEEE/ACM International Symposium on Code Generation and Optimization. https://api.semanticscholar.org/CorpusID:17445756
[44]
Matthias J. Reisinger. 2016. PolyBenchC. https://github.com/MatthiasJReisinger/PolyBenchC-4.2.1 (Accessed 2023-5-7)
[45]
Gregor Richards, Andreas Gal, Brendan Eich, and Jan Vitek. 2011. Automated Construction of JavaScript Benchmarks. In Proceedings of the 2011 ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA ’11). Association for Computing Machinery, New York, NY, USA. 677–694. isbn:9781450309400 https://doi.org/10.1145/2048066.2048119
[46]
Gregor Richards, Sylvain Lebresne, Brian Burg, and Jan Vitek. 2010. An analysis of the dynamic behavior of JavaScript programs. In ACM-SIGPLAN Symposium on Programming Language Design and Implementation. https://api.semanticscholar.org/CorpusID:2334122
[47]
Alan Romano, Daniel Lehmann, Michael Pradel, and Weihang Wang. 2022. Wobfuscator: Obfuscating JavaScript Malware via Opportunistic Translation to WebAssembly. In 43rd IEEE Symposium on Security and Privacy, SP 2022, San Francisco, CA, USA, May 22-26, 2022. IEEE, 1574–1589. https://doi.org/10.1109/SP46214.2022.9833626
[48]
Alan Romano and Weihang Wang. 2023. Automated WebAssembly Function Purpose Identification With Semantics-Aware Analysis. In Proceedings of the ACM Web Conference 2023, WWW 2023, Austin, TX, USA, 30 April 2023 - 4 May 2023, Ying Ding, Jie Tang, Juan F. Sequeda, Lora Aroyo, Carlos Castillo, and Geert-Jan Houben (Eds.). ACM, 2885–2894. https://doi.org/10.1145/3543507.3583235
[49]
Onur Sahin, Assel Aliyeva, Hariharan Mathavan, Ayse Coskun, and Manuel Egele. 2019. RANDR: Record and Replay for Android Applications via Targeted Runtime Instrumentation. In 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE). 128–138. https://doi.org/10.1109/ASE.2019.00022
[50]
Koushik Sen, Swaroop Kalasapur, Tasneem Brutch, and Simon Gibbs. 2013. Jalangi: a selective record-replay and dynamic analysis framework for JavaScript. In Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering (ESEC/FSE 2013). Association for Computing Machinery, New York, NY, USA. 488–498. isbn:9781450322379 https://doi.org/10.1145/2491411.2491447
[51]
Ben L. Titzer. 2021. Wizard, An advanced WebAssembly Engine for Research. https://github.com/titzer/wizard-engine Retrieved Februar 23, 2024
[52]
Ben L. Titzer. 2022. A fast in-place interpreter for WebAssembly. Proc. ACM Program. Lang., 6, OOPSLA2 (2022), Article 148, oct, 27 pages. https://doi.org/10.1145/3563311
[53]
Ben L. Titzer. 2024. Whose Baseline Compiler Is It Anyway? In International Symposium on Code Generation and Optimization (CGO).
[54]
Ben L Titzer, Elizabeth Gilbert, Bradley Wei Jie Teo, Yash Anand, Kazuyuki Takayama, and Heather Miller. 2024. Flexible Non-intrusive Dynamic Instrumentation for WebAssembly. arXiv preprint arXiv:2403.07973.
[55]
Aaron Turner, James Milner, and Jonathan Beri. 2024. Made with WebAssembly. https://madewithwebassembly.com/ Retrieved April 5th, 2024
[56]
Min Xu, Rastislav Bodik, and Mark D. Hill. 2003. A "flight data recorder" for enabling full-system multiprocessor deterministic replay. SIGARCH Comput. Archit. News, 31, 2 (2003), may, 122–135. issn:0163-5964 https://doi.org/10.1145/871656.859633

Index Terms

  1. Wasm-R3: Record-Reduce-Replay for Realistic and Standalone WebAssembly Benchmarks

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    Published In

    cover image Proceedings of the ACM on Programming Languages
    Proceedings of the ACM on Programming Languages  Volume 8, Issue OOPSLA2
    October 2024
    2691 pages
    EISSN:2475-1421
    DOI:10.1145/3554319
    Issue’s Table of Contents
    This work is licensed under a Creative Commons Attribution International 4.0 License.

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 08 October 2024
    Published in PACMPL Volume 8, Issue OOPSLA2

    Permissions

    Request permissions for this article.

    Check for updates

    Badges

    Author Tags

    1. Benchmarking
    2. WebAssembly
    3. record and replay

    Qualifiers

    • Research-article

    Funding Sources

    • European Research Council
    • National Research Foundation of Korea
    • National Science Foundation

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • 0
      Total Citations
    • 154
      Total Downloads
    • Downloads (Last 12 months)154
    • Downloads (Last 6 weeks)57
    Reflects downloads up to 13 Dec 2024

    Other Metrics

    Citations

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Login options

    Full Access

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media