lab12: WebAssembly Moscow-time endpoint on Spin SDK + TinyGo#1340
Open
1r444444 wants to merge 4 commits into
Open
lab12: WebAssembly Moscow-time endpoint on Spin SDK + TinyGo#13401r444444 wants to merge 4 commits into
1r444444 wants to merge 4 commits into
Conversation
Signed-off-by: Irina <irina.bychkova06@mail.ru>
Signed-off-by: Irina <irina.bychkova06@mail.ru>
Task 1: Spin component (wasm/) serving GET /time with Moscow time JSON, built with TinyGo 0.41 + wasip1 + -buildmode=c-shared. Uses time.FixedZone for UTC+3 (no tzdata in TinyGo) and fmt.Fprintf for JSON (no reflect). Task 2: Perf table vs Lab 6 Docker β WASM artifact 359 KB vs 21.6 MB image; cold start ~80 ms vs ~190 ms; warm latency p50 5.5 ms vs 7.6 ms. Bonus: wasm-cli/ standalone WASI CLI module (no Spin SDK, bare wasmtime run), 191 KB, ~35 ms cold start per invocation. Demonstrates wasi-http vs CLI model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lab 12 β WebAssembly Containers
Task 1 β Spin SDK component (4 pts)
wasm/main.go: HTTP handler usingspinhttp.Handle, returns Moscow time JSON (unix,iso,hour_minute,timezone)wasm/spin.toml: HTTP trigger at/time,allowed_outbound_hosts = [], TinyGowasip1 -buildmode=c-sharedbuildspin new -t http-go, SDKgithub.com/spinframework/spin-go-sdk/v2time.FixedZone("Moscow/UTC+3", 3*60*60)β TinyGo has no tzdata fortime.LoadLocationcurl http://127.0.0.1:3000/timeβ{"unix":...,"iso":"2026-07-05T15:16:44+03:00","hour_minute":"15:16","timezone":"Europe/Moscow (UTC+3)"}submissions/lab12.mdTask 2 β Perf comparison vs Lab 6 Docker (4 pts)
Measured with
hyperfine --warmup 10 --runs 100on Apple M-series / macOS, Spin 3.4.0, TinyGo 0.41.0.Design questions eβg answered in
submissions/lab12.md.Bonus β Two WASM execution models (2 pts)
wasm-cli/main.go: standalone WASI CLI module (no Spin SDK) β readsREQUEST_METHOD/PATH_INFOfrom env, prints Moscow-time JSON to stdouttinygo build -target=wasi -no-debug -o main.wasm; Run:wasmtime run --env REQUEST_METHOD=GET --env PATH_INFO=/time main.wasmsubmissions/lab12.mdToolchain