Share
Embed
セルフホストWasmランタイムと WasmCon NA振り返り/wasm-meetup-jp
Wasm Meetup Japan #3
https://wasm.connpass.com/event/383634/
Yuki Nakata chikuwait
March 06, 2026
Transcript
24 slides
-
自己紹介 2 • 中田裕貴 (chikuwait, X: @chiku_wait) • 札幌市在住 •
さくらインターネット株式会社 • さくらインターネット研究所で学術研究に従事 • 公立はこだて未来大学 • 大学院博士(後期)課程2年 • 研究領域:システムソフトウェア(OS・仮想化技術などの低レイヤ) • 現在のメインテーマ:Wasmのチェックポイント・レストア、セルフホストランタイム -
WasmCon NA 2025とは 3 • KubeCon + CloudNative Con North
America 2025の CNCF-hosted Co-located Event • 特定の技術・OSSに関する会議 • KubeCon初日に開催 • CFPの期間はKubeCon本体から少し後 • NAの場合は5月上旬〜6月末 • WasmConの採択率: 8/37(21%) -
Does the Component Model Require Extra Copying? 6 • コンポーネントモデルにおけるコンポーネント間のデータコピーの仕組みを解説
• Linking • 同一の言語やツールチェーンを利用している場合は単一のメモリを共有 • Value Types • カーネルからの読み込みや レイアウト変換など必要最低限 • Resources Types • データのインデックスを コンポーネント間でやり取りする https://www.youtube.com/watch?v=YZG7waS2XZg -
Whamm: A Framework for Performant, Sandboxed Instrumentation. 7 • インストルメンテーション:計測用コードを挿入して内部状態を解析・デバッグ
• 従来は言語や環境によってパフォーマンス・観測可能なイベント・ポータビリティに制約 • Wasmを使うことでポータブルで多言語対応なインストルメンテーションを実現 • DSLで記述しコンパイラで 改変済バイトコードを生成 • 特定ランタイム用fast-pathも実装 • 成果は言語系の トップカンファレンスにも掲載* https://static.sched.com/hosted_files/colocatedeventsna2025/3e/whamm.pdf?_gl=1*3erz 0x*_gcl_au*MjExNzI3MzYxMC4xNzY5NjYwOTYz*FPAU*MjExNzI3MzYxMC4xNzY5NjYwOTYz * Elizabeth Gilbert, Matthew Schneider, Zixi An, Suhas Thalanki, Wavid Bowman, Alexander Y. Bai, Ben L. Titzer, and Heather Miller. 2025. Debugging WebAssembly? Put Some Whamm on It! Proc. ACM Program. Lang. 9, OOPSLA2, Article 346 (October 2025), 29 pages. https://doi.org/10.1145/3763124 -
What If the Runtime Was Portable Too? Self-Hosted Runtime Capabilities
in Wasm Yuki Nakata X:@chiku_wait Researcher / Ph.D. student SAKURA internet Inc. / Future University Hakodate, Japan -
9 The “Portability” of Wasm 1. Language-independent 2. Hardware- and
platform-independent Write once, run anywhere Compile to Wasm -
10 The “Portability” of Wasm 1. Language-independent 2. Hardware- and
platform-independent Write once, run anywhere Compile to Wasm Wasm Runtime Wasm Runtime Wasm Runtime Bytecode Bytecode Bytecode Abstract Hardware and Platform -
11 Diversity of Wasm Runtimes • 100+ runtimes with different
characteristics* • Execution model (Interpreter, JIT or AOT) • Target platforms and workloads *Yixuan Zhang, Mugeng Liu, Haoyu Wang, Yun Ma, Gang Huang, and Xuanzhe Liu. 2025. Research on WebAssembly Runtimes: A Survey. ACM Trans. Softw. Eng. Methodol. Just Accepted (January 2025). https://doi.org/10.1145/3714465 Wasmtime High performance with JIT compilation WasmEdge Rich extensions for AI/LLM workloads -
12 Portability Limitations Imposed by Runtime Diversity • Unsupported capabilities
and features impose limitations on usable runtimes How can we use or implement them runtime-neutrally? WasmEdge-specific Statistics and Resource Limitation Capabilities Different Status of Wasm Feature Support -
13 Self-hosted Runtime for Runtime-neutral Extensions • Minimal Wasm-ised Wasm
runtime • Execute app bytecode via self-hosted runtime • Compatibility layer for host runtimes • Implementing extensions to self-hosted runtime only • No need to modify host Wasm runtimes • PoC (Chiwawa U^ェ^U): https://github.com/oss-fun/chiwawa Self-hosted Runtime Host Runtime (E.g., Wasmtime) Wasm Bytecode -
14 Use Case: Cross-runtime Checkpoint/Restore (C/R) • C/R requires to
save and resume the application’s state • Needs to modify optimizations (e,g.,JIT and AOT) and runtime implementation • Self−hosted runtime−based C/R • Save states in the self-hosted runtime • No need to consider runtime differences Implemented in Chiwawa Self-hosted Runtime (JIT Compiled) Wasmtime Wasm Bytecode WasmEdge Self-hosted Runtime (Interpreted) Wasm Bytecode Checkpoint and restore -
15 Use Case: Tracing and Instrumentation • Understand the execution
status of running Wasm bytecode • For bug detection, visualization of processing flows, and profiling • Self-hosted Runtime-based instrumentation • Detailed tracing including the state of its VM • Can use any runtime without modification Implemented in Chiwawa Self-hosted Runtime (JIT Compiled) Wasmtime Wasm Bytecode in Self-hosted Runtime WasmEdge Self-hosted Runtime (Interpreted) The self-hosted runtime's VM is not changed by the host’s optimization -
16 Use Case: Executing Runtime Unsupported Features • Execute a
self-hosted runtime as a compatibility layer • Implement interfaces for unsupported features • Compile the self-hosted runtime into Wasm executable for the host runtime • Can execute it within the scope supported by the host runtime Self-hosted Runtime (Support WASIp2 Interface) Host Runtime (Support WASI p1) z Wasm Bytecode (WASIp2) Using WASIp2 Feature Executing WASIp2 features as a WASIp1 bytecode Under consideration in Chiwawa -
17 Performance Overhead by Duplicated Runtime 1. Increase bytecode instructions
executed on host runtime • An instruction in an application is transformed into multiple instructions 2. Duplicated computationally expensive processing • Sandbox mechanism and WASI implementations local.get … fn handle_local_get(ctx: Context){ … let val = ctx.frame.locals[i].clone(); ctx.value_stack.push(val); … } -
18 Optimization Techniques for Self-hosted Runtime 1. Merging instructions •
Parser identifies dependencies between instructions • Convert stack instructions to Immediate Value 2. Pass-through WASI implementation (without WASI interface conversion) • Redirect to the WASI implementation of a host runtime … i32.const 10 local.get 0 I32.add local.set 1 … … i32.add{10, local@0} => local@1 … Merged into a single instruction -
19 Chiwawa on Wasmtime VS. Wasmtime Relative execution time (normalized
to wasmtime) Performance Evaluation Wizard on Wizard VS. Chiwawa on Wizard (Self-Hostable Runtimes ) 1.3~1.4x performance by optimization techniques Benchmarks Wizard on Wizard Chiwawa on Wizard pi-Leibniz 26.791 19.620 N-body 14.554 9.932 Execution time (Sec.) -
20 Wizard on Wizard VS. Chiwawa on Wizard (Self-Hostable Runtimes
) Benchmarks Wizard on Wizard Chiwawa on Wizard pi-Leibniz 26.791 19.620 N-body 14.554 9.932 Performance Evaluation Chiwawa on Wasmtime VS. Wasmtime 13-426x performance degradation by increased processing Relative execution time (normalized to wasmtime) Execution time (Sec.) -
21 Conclusion • A Self-hosted runtime helps implement and test
features and runtime capabilities • Can run on any runtime • Significant performance overhead • Performance optimization techniques are essential • My future goal is to achieve performance equivalent to execution in interpreter runtimes Chiwawa: https://github.com/oss-fun/chiwawa -
WasmConで発表して 22 • 発表を通じてグローバルな Wasmコミュニティの輪に入れた • 発表良かったよ!って話しかけてくれる人がたくさん居る • ただの参加者だと得られないコミュニケーション •
WasmやWASIの標準化の中心人物、メンテナからフィードバック貰えるのは非常に貴重