This setup was tested with Ubuntu 22.04.
Clone the repository locally with:
git clone git@github.com:adiprerepa/distributed-wasm-runtime.gitIdeally, follow these steps in this order.
Bringing up a worker requires no dependencies.
cargo run --bin workerThis runs an HTTP server synchronously, so leave this process running.
Bringing up the Load Balancer requires you to have rustc/rustup installed, along with the wasm32-wasi runtime installed. You can install this runtime with:
rustup target add wasm32-wasiThis target is required because the WebAssembly compilation is run from the kernel space, whereas the execution on the worker is run in the user space as a statically linked library.
To bring up the load balancer:
cargo run --bin load_balancerSay you have a hello.rs in your working directory with the contents:
use std::{thread, time};
fn main() {
thread::sleep(time::Duration::new(5, 0));
println!("job done, hello!");
}You can submit a job with:
cargo run --bin cli run hello.rs --cpus 1 --memory-mb 1000 --job-name sleepYou should get output like (id varies):
job running, id: 10.You can pull the status of the job with:
cargo run --bin cli status --id 10To then get output similar to:
job status:
name: "sleep"
finished: true
running time: 6s
execution output: "job done, hello!\n"The above output was extracted from the WebAssembly execution.