一句话:首个 WebAssembly 记录-重放技术,从真实网页应用生成真实、忠实且独立可运行的基准测试。
WebAssembly 在 Web、边缘计算与嵌入式场景中愈发重要,但其多样化引擎的性能特征需要真实且有代表性的基准测试;而现有替代方案(如 PolyBenchC、libsodium)公认缺乏代表性,且由于 Wasm 缺少系统 API、宿主交互复杂,直接移植或从网页提取真实负载都很困难。本文提出 Wasm-R3,首个面向 Wasm 的记录-重放技术:向 Wasm 模块透明注入插桩以在模块内部记录执行轨迹,随后通过多种优化对轨迹进行归约,最终生成无需任何宿主环境、可在任意引擎上独立运行的重放模块。由此得到的基准具有三点性质:真实(录制自真实网页应用)、忠实(重放时保留未修改的原始代码,仅补充宿主交互的模拟)、独立(可在任意引擎上运行)。作者将 Wasm-R3 应用于线上 Wasm 应用,验证了方法的正确性与优化有效性,轨迹归约达 99.53%,重放基准体积缩减 9.98%,并发布含 27 个应用的 Wasm-R3-Bench 基准套件。
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.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@article{abs-2409-00708,
title = {Wasm-R3: Record-Reduce-Replay for Realistic and Standalone WebAssembly Benchmarks},
author = {Doehyun Baek and Jakob Getz and Yusung Sim and Daniel Lehmann and Ben L. Titzer and Sukyoung Ryu and Michael Pradel},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {OOPSLA2},
year = {2024},
doi = {10.1145/3689787}
}