Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What If the Runtime Was Portable Too? Self-Host...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for Yuki Nakata chikuwait Yuki Nakata chikuwait
November 13, 2025
420

What If the Runtime Was Portable Too? Self-Hosted Runtime Capabilities in Wasm

WasmCon NA (KubeCon + CloudNativeCon NA 2025 CNCF Co-located Event) , Nov 2025
https://colocatedeventsna2025.sched.com/event/d5229df449edf869ece61aa5b9c765a2?iframe=no

Avatar for Yuki Nakata chikuwait

Yuki Nakata chikuwait

November 13, 2025
Tweet

More Decks by Yuki Nakata chikuwait

Transcript

  1. 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
  2. 2 The “Portability” of Wasm 1. Language-independent 2. Hardware- and

    platform-independent Write once, run anywhere Compile to Wasm
  3. 3 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
  4. 4 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
  5. 5 Portability Limitations Imposed by Runtime Diversity WasmEdge-specific Statistics and

    Resource Limitation Capabilities Different Status of Wasm Feature Support • Unsupported capabilities and features impose limitations on usable runtimes How can we use or implement them runtime-neutrally?
  6. 6 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
  7. 7 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
  8. 8 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
  9. 9 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
  10. 10 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); … }
  11. 11 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
  12. 12 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.)
  13. 13 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.)
  14. 14 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 existing interpreter runtimes Chiwawa: https://github.com/oss-fun/chiwawa