Tiny, blazing fast WebAssembly compute

Related tags

WebAssembly sat
Overview

Sat, the tiny WebAssembly compute module

Sat (as in satellite) is an experiment, and isn't ready for production use. Please try it out and give feedback!

Sat is a compute module designed to have the maximum performance and smallest possible footprint. Where our Atmo project is a fully-fledged platform with support for running entire applications, Sat takes the opposite approach: run a single module really f***ing fast.

Sat has no dependencies (it's statically compiled), and can run in a tiny Docker container (Alpine). It's meant to live in small places such as edge compute instances.

Using Sat

To run Sat, Docker is easiest. Clone this repo and run:

make docker run

This will build the suborbital/sat:dev Docker image and then launch it using the hello-echo.wasm module found in the testmodule directory.

You can then make a POST request to localhost:8080 with a body, and that body will be echoed back to you.

Sat executes modules with the Runnable API enabled, so you can create modules using our Subo CLI and all of the capabilities are available for use.

Note that statically compiling Sat on macOS is not currently possible, so it is Linux-only for now.

Stdin mode

As an alternative to running Sat as a server, you can also use it in stdin mode. First, build Sat:

make sat
OR
make sat/dynamic #on macOS

Then, run Sat with an input on stdin:

echo "world" | .bin/sat --stdin ./testmodule/hello-echo.wasm

Sat will write the response to stdout and exit.

Run from URL

If you provide a URL as the path argument to Sat, it will download the module from that URL, write it to a temp directory, and use it for execution:

sat "https://github.com/suborbital/reactr/blob/main/rwasm/testdata/hello-echo/hello-echo.wasm?raw=true"

The URL must be HTTPS and must have a .wasm suffix (excluding query parameters)

One day...

Sat has the ability to create a mesh with other instances using local network discovery and websockets. By default, Sat starts on a random port, and listens for requests from its peers. In the future, this will enable some very interesting network topologies and potentially an integration with Atmo, but for now we are focused on being tiny and fast.

Copyright Suborbital contributors 2021.

Comments
  • Unable to run Sat with a compiled Runnable

    Unable to run Sat with a compiled Runnable

    Following these steps in the docs, on an Intel Mac running Monterey, @ramonh and I ran make docker run followed by make sat and then SAT_HTTP_PORT=8080 ./sat https://github.com/suborbital/reactr/blob/main/rwasm/testdata/hello-echo/hello-echo.wasm, and got the following error:

    {"log_message":"(W) configured to use HTTP with no TLS","timestamp":"2022-04-04T09:31:00.580195-07:00","level":2,"app":{"sat_version":"v0.1.1"}}
    {"log_message":"(I) starting hello-echo ...","timestamp":"2022-04-04T09:31:00.580593-07:00","level":3,"app":{"sat_version":"v0.1.1"}}
    {"log_message":"(I) serving on :8080","timestamp":"2022-04-04T09:31:00.580609-07:00","level":3,"app":{"sat_version":"v0.1.1"}}
    {"log_message":"(E) failed to start hello-echo worker: failed to reconcilePoolSize: failed to addThread more than numRetries: runnable returned OnChange error: failed to addInstance: failed to builder.New: failed to internals: failed to NewModule: failed to parse WebAssembly module\n\nCaused by:\n    Invalid input WebAssembly code at offset 0: Bad magic number","timestamp":"2022-04-04T09:31:00.580844-07:00","level":1}
    
    bug 
    opened by LauraLangdon 5
  • Include response headers in real sat response

    Include response headers in real sat response

    Hi there! This project looks extremely promising.

    I was trying out sat and got quite confused about why calls to resp::set_header didn't seem to have any effect - my HTTP headers were not showing up on the response. On looking into it, I see they do get added to the CoordinatedResponse structure, but the RespHeaders here are simply ignored by handler.go and hence they don't end up in the real HTTP response.

    Fortunately it's very easy to add the headers to the real HTTP response as per this PR. If there is some reason why it's intentional that the response headers should be discarded then I apologise (though it would be great if you could clarify why). Thanks!

    opened by SteveSandersonMS 5
  • Question about headers

    Question about headers

    πŸ‘‹ Hello, perhaps I missed something because of my baby steps with Rust and Swift, but I'm unable to get the value of a header with ReqHeader (or req::header):

    import Suborbital
    
    class HelloPeople: Suborbital.Runnable {
        func run(input: String) -> String {
            
            return "hello " + input + " " + ReqHeader(key:"message")
        }
    }
    
    Suborbital.Set(runnable: HelloPeople())
    

    And I try to call the function like this:

    data="Bob Morane"
    curl -d "${data}" \
        -H "Content-Type: application/json" \
        -H "message: 'ping'" \
        -X POST "http://localhost:8080"
    

    But ReqHeader(key:"message") returns an empty value

    opened by k33g 4
  • chore(deps): update module github.com/suborbital/reactr to v0.15.1

    chore(deps): update module github.com/suborbital/reactr to v0.15.1

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/suborbital/reactr | require | minor | v0.14.0 -> v0.15.1 |


    Release Notes

    suborbital/reactr

    v0.15.1

    Compare Source

    Changelog

    Update wasmtime to v0.35.0

    v0.15.0

    Compare Source

    JavaScript and TypeScript Support

    This release of Reactr includes a new library for use with JavaScript and TypeScript runnables. With Subo Beta-4, JS runnables can be created with subo create runnable <name> --lang js, and TS runnables can be created with subo create runnable <name> --lang ts.


    Configuration

    πŸ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    β™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    πŸ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 2
  • chore(deps): update module github.com/suborbital/e2core to v0.4.7

    chore(deps): update module github.com/suborbital/e2core to v0.4.7

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/suborbital/e2core | require | patch | v0.4.4-0.20220927141500-cc009c3a3c36 -> v0.4.7 |


    Release Notes

    suborbital/e2core

    v0.4.7

    Compare Source

    Atmo Beta-4.7 fixes a panic when attempting to connect to a control plane server that is not available, and an issue connecting to external databases.

    v0.4.6

    Compare Source

    Atmo Beta-4.6 fixes an issue with stream handlers that would fail to handle arbitrary message schemas.

    v0.4.5

    Compare Source

    Atmo Beta-4.5 brings some minor fixes and the ability to define static peers with the ATMO_PEERS env var.


    Configuration

    πŸ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    β™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    πŸ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 2
  • chore(deps): update module go to 1.19

    chore(deps): update module go to 1.19

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | go (source) | golang | minor | 1.18 -> 1.19 |


    Configuration

    πŸ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    β™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    πŸ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 2
  • Unable to build manually Sat for arm platform with WasmEdge

    Unable to build manually Sat for arm platform with WasmEdge

    Usually, on RaspberryPi, I install the WasmEdge library like this:

    curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -e all -v 0.9.0-rc5
    

    Because Reactr needs this version of the Wasmedge library (https://github.com/suborbital/reactr/blob/main/go.mod#L13).

    And then:

    git clone --depth=1 https://github.com/suborbital/sat.git
    
    cd sat
    go build -o .bin/sat -tags netgo,wasmedge .
    

    But the version 0.9.0-rc5 of Wasmedge seems to be unavailable, and then the build of Sat is impossible.

    # github.com/second-state/WasmEdge-go/wasmedge
    ../go/pkg/mod/github.com/second-state/[email protected]/wasmedge/ast.go:3:11: fatal error: wasmedge/wasmedge.h: No such file or directory
     // #include <wasmedge/wasmedge.h>
               ^~~~~~~~~~~~~~~~~~~~~
    
    opened by k33g 2
  • [HACK] πŸͺ² Fix warning message [make sat]

    [HACK] πŸͺ² Fix warning message [make sat]

    When the building sat, I get this message:

    # github.com/suborbital/sat/sat
    /usr/bin/ld: /workspace/sat/vendor/github.com/bytecodealliance/wasmtime-go/build/linux-x86_64/libwasmtime.a(dirs_sys_next-ac02c6299ada6dc3.dirs_sys_next.3b0485cb-cgu.6.rcgu.o): in function `dirs_sys_next::target_unix_not_redox::home_dir':
    dirs_sys_next.3b0485cb-cgu.6:(.text._ZN13dirs_sys_next21target_unix_not_redox8home_dir17hcb096aa60fa17738E+0x147): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/bin/ld: /workspace/sat/vendor/github.com/bytecodealliance/wasmtime-go/build/linux-x86_64/libwasmtime.a(std-008055cc7d873802.std.cf1c8f7e-cgu.0.rcgu.o): in function `<std::sys_common::net::LookupHost as core::convert::TryFrom<(&str,u16)>>::try_from':
    /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b//library/std/src/sys_common/net.rs:197: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    
    opened by k33g 2
  • Add dependency stage to Dockerfile

    Add dependency stage to Dockerfile

    The Dockerfile now fetches the latest wasmtime tarball build for the correct arch and OS and puts libwasmtime.a in the right place so it can be linked in.

    opened by jagger27 2
  • chore(sat): update appspec

    chore(sat): update appspec

    Not 100% sure how to handle this but sat depends on atmo which depends on sat and they both have their own appspec version so they are both going to complain that the transitive dependency (appspec) isn't required.

    opened by rnpridgeon 1
  • chore(deps): update opentelemetry-go monorepo - autoclosed

    chore(deps): update opentelemetry-go monorepo - autoclosed

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | go.opentelemetry.io/otel | require | minor | v1.9.0 -> v1.10.0 | | go.opentelemetry.io/otel/metric | require | minor | v0.30.0 -> v0.32.1 | | go.opentelemetry.io/otel/sdk | require | minor | v1.9.0 -> v1.10.0 | | go.opentelemetry.io/otel/trace | require | minor | v1.9.0 -> v1.10.0 |


    Release Notes

    open-telemetry/opentelemetry-go

    v1.10.0

    Compare Source

    Added
    • Support Go 1.19. (#​3077) Include compatibility testing and document support. (#​3077)
    • Support the OTLP ExportTracePartialSuccess response; these are passed to the registered error handler. (#​3106)
    • Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#​3107)
    Changed
    • Fix misidentification of OpenTelemetry SpanKind in OpenTracing bridge (go.opentelemetry.io/otel/bridge/opentracing). (#​3096)
    • Attempting to start a span with a nil context will no longer cause a panic. (#​3110)
    • All exporters will be shutdown even if one reports an error (#​3091)
    • Ensure valid UTF-8 when truncating over-length attribute values. (#​3156)

    Configuration

    πŸ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    β™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    πŸ‘» Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 1
  • chore(deps): update module github.com/suborbital/go-kit to v0.0.2

    chore(deps): update module github.com/suborbital/go-kit to v0.0.2

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | github.com/suborbital/go-kit | require | patch | v0.0.0-20220913125118-e0faaefc95df -> v0.0.2 |


    Release Notes

    suborbital/go-kit

    v0.0.2

    Compare Source

    What's Changed

    Full Changelog: https://github.com/suborbital/go-kit/compare/v0.0.1...v0.0.2


    Configuration

    πŸ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    β™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    πŸ”• Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Expose response metadata on the HTTP response

    Expose response metadata on the HTTP response

    We currently have no way to access response metadata (status code, headers) in http.* runnable API calls, this limits some usecases such as makes it impossible to follow redirects.

    JS & TS method calls return a HTTPResponse object which has methods for various output formats (binary, text, JSON), while Rust for example only produces a binary stream here.

    JS (Javy) support is tracked in suborbital/javy#20

    opened by flaki 0
  • Document environment variables

    Document environment variables

    Looking at the blog post on sat: https://www.wasm.builders/suborbital/a-simple-data-hashing-serverless-function-using-sat-3fn0

    Sat can be configured to automatically acquire a TLS certificate using LetsEncrypt, so if you want to deploy this service on the public internet, you can add SAT_DOMAIN=example.com as well for automatic HTTPS!

    This is really cool! I wonder if we can document this and SAT_HTTP_PORT?

    opened by hola-soy-milk 0
  • [Sat embedded]: a line of logs is triggered by `sat.New()` with `traceProvider == nil`

    [Sat embedded]: a line of logs is triggered by `sat.New()` with `traceProvider == nil`

    With Sat embedded, the sat.New() function triggers a line of log even if the traceProvider parameter equals nil:

    {"log_message":"(W) configured to use HTTP with no TLS","timestamp":"2022-06-05T11:47:03.328707564Z","level":2,"app":{"sat_version":"v0.1.4"}}
    
    bug 
    opened by k33g 2
Releases(v0.1.4)
Owner
Suborbital
Rocket-fueled open source platform tools
Suborbital
WebAssembly interop between Go and JS values.

vert Package vert provides WebAssembly interop between Go and JS values. Install GOOS=js GOARCH=wasm go get github.com/norunners/vert Examples Hello W

null 78 Sep 27, 2022
WebAssembly for Proxies (Golang host implementation)

WebAssembly for Proxies (GoLang host implementation) The GoLang implementation for proxy-wasm, enabling developer to run proxy-wasm extensions in Go.

MOSN 39 Aug 26, 2022
πŸΉπŸ•ΈοΈ WebAssembly runtime for Go

Wasmer Go Website β€’ Docs β€’ Slack Channel A complete and mature WebAssembly runtime for Go based on Wasmer. Features Easy to use: The wasmer API mimics

Wasmer 2.2k Sep 23, 2022
πŸΉπŸ•ΈοΈ WebAssembly runtime for Go

Wasmer Go Website β€’ Docs β€’ Slack Channel A complete and mature WebAssembly runtime for Go based on Wasmer. Features Easy to use: The wasmer API mimics

Wasmer 2.2k Sep 30, 2022
Golang-WASM provides a simple idiomatic, and comprehensive API and bindings for working with WebAssembly for Go and JavaScript developers

A bridge and bindings for JS DOM API with Go WebAssembly. Written by Team Ortix - Hamza Ali and Chan Wen Xu. GOOS=js GOARCH=wasm go get -u github.com/

TeamOrtix 81 Sep 23, 2022
A package to build progressive web apps with Go programming language and WebAssembly.

Go-app is a package for building progressive web apps (PWA) with the Go programming language (Golang) and WebAssembly (Wasm). Shaping a UI is done by

Maxence Charriere 6.5k Sep 25, 2022
A package to build progressive web apps with Go programming language and WebAssembly.

Go-app is a package for building progressive web apps (PWA) with the Go programming language (Golang) and WebAssembly (Wasm). Shaping a UI is done by

Maxence Charriere 6.5k Sep 25, 2022
Vugu: A modern UI library for Go+WebAssembly (experimental)

Vugu: A modern UI library for Go+WebAssembly (experimental)

Vugu 4.5k Sep 27, 2022
WebAssembly runtime for wasmer-go

gowasmer When compiling Go to WebAssembly, the Go compiler assumes the WebAssembly is going to run in a JavaScript environment. Hence a wasm_exec.js f

mattn 94 Sep 21, 2022
A template project to demonstrate how to run WebAssembly functions as sidecar microservices in dapr

Live Demo 1. Introduction DAPR is a portable, event-driven runtime that makes it easy for any developer to build resilient, stateless and stateful app

Second State 137 Sep 14, 2022
WebAssembly Lightweight Javascript Framework in Go (AngularJS Inspired)

Tango Lightweight WASM HTML / Javascript Framework Intro WebAssembly is nice, Go on the web is nice, so I ported Tangu to Go and WebAssembly. Tangu is

enimatek 4 Jun 8, 2022
Running a Command line tool written in Go on browser with WebAssembly

Running a command line tool written in Go on browser with WebAssembly This repo contains code/assets from the article Files: . β”œβ”€β”€ article.md

wcchoi 80 Aug 10, 2022
This library provides WebAssembly capability for goja Javascript engine

This module provides WebAssembly functions into goja javascript engine.

YC-L 1 Jan 10, 2022
A Brainfuck to WebAssembly compiler written in Go.

brainfuck2wasm A Brainfuck to WebAssembly compiler written in Go. I am writing this compiler for a Medium article. When I complete the compiler, I'll

Luke I. Wilson 2 Jun 6, 2022
Dom - A Go API for different Web APIs for WebAssembly target

Go DOM binding (and more) for WebAssembly This library provides a Go API for dif

Denys Smirnov 460 Sep 9, 2022
wazero: the zero dependency WebAssembly runtime for Go developers

wazero: the zero dependency WebAssembly runtime for Go developers WebAssembly is a way to safely run code compiled in other languages. Runtimes execut

Tetrate Labs 1.9k Sep 17, 2022
`tinydisplay` is a tiny display for TinyGo development.

tinydisplay tinydisplay is a tiny display for TinyGo development. tinydisplay works on windows, macOS and linux. Usage First, run ./cmd/tinydisplay. N

sago35 14 Sep 20, 2022
Fast face detection, pupil/eyes localization and facial landmark points detection library in pure Go.

Pigo is a pure Go face detection, pupil/eyes localization and facial landmark points detection library based on Pixel Intensity Comparison-based Objec

Endre Simo 3.8k Sep 27, 2022
FaaSNet: Scalable and Fast Provisioning of Custom Serverless Container Runtimes at Alibaba Cloud Function Compute (USENIX ATC'21)

FaaSNet FaaSNet is the first system that provides an end-to-end, integrated solution for FaaS-optimized container runtime provisioning. FaaSNet uses l

LeapLab @ CS_GMU 36 Sep 28, 2022
Simple and blazing fast lockfree logging library for golang

glg is simple golang logging library Requirement Go 1.11 Installation go get github.com/kpango/glg Example package main import ( "net/http" "time"

Yusuke Kato 171 Sep 26, 2022