Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 1.58 KB

File metadata and controls

77 lines (53 loc) · 1.58 KB

Running the Project

This setup was tested with Ubuntu 22.04.

Clone the repository locally with:

git clone git@github.com:adiprerepa/distributed-wasm-runtime.git

Ideally, follow these steps in this order.

Bringing up a worker

Bringing up a worker requires no dependencies.

cargo run --bin worker

This runs an HTTP server synchronously, so leave this process running.

Bringing up the Load Balancer

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-wasi

This 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_balancer

Calling the service

Say 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 sleep

You 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 10

To 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.