Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WebAssemblyとクラウドの動向と可能性
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Masashi Yoshimura
February 18, 2025
81
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WebAssemblyとクラウドの動向と可能性
Masashi Yoshimura
February 18, 2025
More Decks by Masashi Yoshimura
See All by Masashi Yoshimura
LinuxアプリのAOT-Wasm化による⾼速ブラウザ実⾏ 〜FOSDEM 2026での発表と振り返り〜
yomaytk
0
76
High-Speed Linux Application Execution in the Browser with Binary Translation
yomaytk
1
72
A technology for lifting machine code to high-performance LLVM IR
yomaytk
0
17
elfconv: AOT compiler that translates Linux/AArch64 ELF binary to WebAssembly
yomaytk
0
18
elfconv: AOT compiler that translates Linux/AArch64 ELF binary to WebAssembly
yomaytk
0
19
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
The SEO identity crisis: Don't let AI make you average
varn
0
480
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
270
Context Engineering - Making Every Token Count
addyosmani
9
950
Raft: Consensus for Rubyists
vanstee
141
7.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
430
Exploring anti-patterns in Rails
aemeredith
3
400
How to train your dragon (web standard)
notwaldorf
97
6.7k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
550
Transcript
[機密性1/Confidentiality1] WebAssemblyとクラウドの動向と可能性 NTTソフトウェアイノベーションセンタ 吉村 仁志 2025/02/18
[機密性1/Confidentiality1] • 氏名:吉村 仁志 • 2023年度4月NTT研究所へ修士卒後に入社.主にコンテナ・ WebAssemblyなどのクラウド技術をOSS活動チームに所属. • 主な活動:LinuxバイナリをWebAssemblyなど別バイナリフォーマット にAOT変換する技術の開発(repo:
elfconv) – FOSDEM, WASM I/Oにて発表 • X: Masashi Yoshimura (@ming_rrr) 自己紹介 2
[機密性1/Confidentiality1] ➢ WebAssemblyとは ➢ サーバーサイドでのWasm ➢ WebAssembly System Interface (WASI)
➢ capability-based security ➢ Wasm Component Model ➢ WASI 0.3 ➢ Wasmとコンテナ ➢ まとめ 目次 3
[機密性1/Confidentiality1] WebAssembly (Wasm) • ブラウザ上 (Amazon Prime Video, etc.) だけでなく,
クラウド環境や組み込みなどのブラウザ外へと適用領 域を広げる(採用例:Fastly, etc.) WasmとOS間の重要な仕様 Solomon Hykes (Docker作者): WASMとWASIが当時あれば,私はDockerを作る必要がなかっただろう. 4
[機密性1/Confidentiality1] • WASI Runtime – Wasmtime, WasmEdge, etc. • Wasm
application Platforms – wasmCloud, Spin • Kubernetes – runwasi • edge – Cloudflare, Fastly サーバーサイド上のWasm 5
[機密性1/Confidentiality1] • WebAssembly System Interface (WASI) – Wasmがシステムリソースを使用するために ランタイムが提供するAPI –
capability-based security – 現在のバージョンはv0.2.4 – Component Model WebAssembly System Interface 6 WASI WASI Runtime WASI 0.2
[機密性1/Confidentiality1] • capability-based security – 「最小権限の原則」に基づき,リソース と権限の対であるcapabilityをもとに アクセス可否を決定する仕組みのこと. • WASIはcapability-based
securityをベースに 実装されており,ホスト側(ランタイム) から許可されたcapabilityに基づきアクセス が可能となる. WASIのcapability-based security 図1:実行結果 サンプルプログラム 7
[機密性1/Confidentiality1] • Component Model – 明確なインタフェース(WIT)によるモジュールの再利用・柔軟な結合が 可能 (マイクロサービス,プラグインなど). – Core
Wasmでの言語間の異なる型表現による相互運用性の欠如を解決する. – 専用のレジストリ(wa.dev)によるコンポーネント配布 Component Model 8 package example: world { interface Greeter { greet: func(name: string) -> string; } } world hello_world { import greeter: example.Greeter; } WITの例:
[機密性1/Confidentiality1] • WASI 0.3 – Luke Wagner氏がWasmcon 2024,Wasm I/O 2024にて解説
– WASI 0.2のコンポーネントモデルは前提 • 期待される主な更新 – 0.2 コンポーネントモデルのバイナリフォーマットに新たな型やABIオプションを追 加(0.2のコンポーネントは0.3でも動作可能) – native async support • native async support – プログラミング言語側の並行処理の機能を統合 – 並行処理を行うためのインタフェースを簡略化 – 結合可能な並行処理 (composable concurrency) WASI0.3 9
[機密性1/Confidentiality1] - 言語間の並行処理機能の統合 - 並行性処理のインタフェース簡略化 native async support async Task<Model>
load(string name) { var data = await blockingOperation(name); return data; } from `my-component` import load async def some_func(); one = asyncio.create_task(load(“input.txt1”)); two = asyncio.create_task(load()); models = await asyncio.gather(one, two); ... export import load: func (name: string) -> result<Model>; interface wasi:io/poll { resource pollable {...} } interface { resources fields {...} resources incoming-request {...} resources outgoing-request {...} resources incoming-response {...} resources outgoing-response {...} ... } interface wasi:http/types { resources fields {...}, resources request {...}, resources response {...}, resources body {...} } 10 wasi:
[email protected]
wasi:
[email protected]
13 resources, 2 handlers 4 resources, 1 handlers
[機密性1/Confidentiality1] • 結合可能な並行処理(composable concurrency) native async support 11 interface tools
{ load: func(path: string) -> stream<u8>; unzip: func(path: stream<u8>) -> stream<u8>; jq: func(in: stream<u8>, query: string) -> string; } // client.js import { load, unzip, jq } from tools; let first = await jq(unzip(load(‘input.txt.gz’)), ‘.[0]’); console.log(first); unix-pipeline-style composition world chainable-handler { import wasi:http/handler; export wasi:http/handler; } http-cache AB-tester compressor // compound-handler.wac let cache = new tools:http-cache {...}; let ab = new tools:AB-tester { cache }; let compressor = new tools:compressor { ab }; export compressor [ wasi:http/handler ]; service-chaining-style composition
[機密性1/Confidentiality1] • Wasmはコンテナには無い特徴をいくつも持つ. • 高い移植性 – OSやCPUアーキテクチャといったプラットフォーム非依存 – コンポーネントモデルによる言語を超えたモジュール結合 •
セキュリティ機能 – メモリアクセス時の境界チェック,間接関数呼び出しのシグネチャチェック – capability-based securityに基づくWASI Wasmはコンテナを置き換える? >? 12
[機密性1/Confidentiality1] • 実行時の性能 – Wasmはしばしば”faster”と表現されるが,ネイティブバイナリと比較すると性能が劣 化するケースも多い(セキュリティチェックによるトレードオフ). – 図1は,Frank Denis氏のWasmと ネイティブコードの実行速度の比較[1].
平均で,2.32倍の速度劣化があるとのこと. – 表1は,LINPACK という浮動小数点演算 系のベンチマークテストの測定結果. nativeと比較し53%の性能. Wasmはコンテナを置き換える? 0 0 1.5 3 4.5 6 図1 表1 環境 Wasm (wasmtime) native 速度 4692 (MFLOPS) 8813 (MFLOPS) [1] https://00f.net/2023/01/04/webassembly-benchmark-2023/より引用 13
[機密性1/Confidentiality1] • 実行時の性能 – Wasmはしばしば”faster”と表現されるが,ネイティブバイナリと比較すると性能が劣 化するケースも多い(セキュリティチェックによるトレードオフ). – 図1は,Frank Denis氏のWasmと ネイティブコードの実行速度の比較[1].
平均で,2.32倍の速度劣化がある. – 表1は,LINPACK という浮動小数点演算 系のベンチマークテストの測定結果. nativeと比較し53%の性能. Wasmはコンテナを置き換える? 0 0 1.5 3 4.5 6 図1 表1 環境 Wasm (wasmtime) native 速度 4692 (MFLOPS) 8813 (MFLOPS) [1] https://00f.net/2023/01/04/webassembly-benchmark-2023/ Wasmはコンテナを置き換えるものではない. (性能面の課題が顕在) 高い移植性を用いたアプリケーション配布・柔軟なモジュール結合や, セキュアなサンドボックス環境としての活用 14
[機密性1/Confidentiality1] • サーバーサイドのWasmは,純粋なWASIランタイムを始め,Wasmから構成さ れるマイクロサービス構築や,エッジコンピューティングへの活用を行う多く のツールが実在する. • WASIでは次バージョンの0.3でnative async supportが実装される予定.また, 0.3以降もComponent
Modelは健在. • Wasmはセキュリティや移植性においてコンテナに勝る点もあるが,構造上の 性能面の課題は存在しているため,コンテナの置換はできない.非常に柔軟な マイクロサービス構築が期待できるComponent Modelに今後も注目. まとめ 15