Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 2023 #10

Open
8 tasks
sameo opened this issue Dec 11, 2022 · 0 comments
Open
8 tasks

Project 2023 #10

sameo opened this issue Dec 11, 2022 · 0 comments

Comments

@sameo
Copy link
Contributor

sameo commented Dec 11, 2022

The 2023 virt-docourse project is a serverless runtime for the Polycode backend.

The (name TBD) runtime will run code snippets in hardware virtualized virtual machines and must have the following properties:

  • Written in Rust
  • Support for x86-64 and aarch64
  • Based on the rust-vmm crates
  • Minimal footprint
  • Minimal device model:
    • Two emulated UARTs (a.k.a. serial ports)
    • One virtio-mmio based networking interface (rust-vmm virtio-net)
    • initramfs based root filesystems
  • Support for the following languages:
    • rustlang
    • golang

Overall Architecture and Usage

The runtime is used to run code snippets for a well known, pre-defined and fixed set of programming languages.

Its inputs are a language, a code snippet contained in a file, and an API socket. With those arguments the runtime VMM starts a Linux VM which root file system is an initramfs image. The image contains all the needed language dependencies to build and run the code snippet file.

Inside the root file system, a custom serverless agent is the init process. It takes commands from the runtime VMM and executes them. The protocol between the serverless agent and the runtime VMM is a custom one, that can run over an emulated serial interface and is based on the SLIP protocol. Optionally, it can also run over a TCP/IP transport layer with e.g. virtio-net.

Initramfs generation

Initramfs images generation happens every time a new language or a new language version needs to be supported.

Images are generated and prepared in advance, and re-used for every VM instance running a certain language runtime (for a specific or the default version).

Images are based on container reference images for each language.

The image generation tool goes through the following steps:

  1. Pull the OCI container image from a container registry
  2. Unpack the container image on the local filesystem
  3. Amend and customize the image with all the needed serverless components (agent, etc)
  4. Generate a compressed initramfs image

The initramfs init process is the serverless agent.

$ initramfs-build --image rust:1.65.0 --initramfs rust-1.65.0.cpio.gz

Workload Execution

The runtime VMM starts a VM which root filesystem is the canonical initramfs for the desired language.

$ runtime-vmm --language rust --socket /tmp/UuId-12345678

The runtime VMM (based on lumper) initially listens for API commands on its Unix socket. The infrastructure control plane starts the actual VM and the guest kernel starts the serverless agent as the init process.

The VMM API start command passes the code snippet as its HTTP body and gets a Unix socket path back through the HTTP reply. The code snippet build or execution output is sent by the runtime VMM through this Unix socket.

Tasks

  • Find a project name
  • Define a serverless agent protocol
  • Implement the serverless agent in Rust
  • Add virtio-net to lumper
  • Add support for standalone and separate (not embedded in the kernel) initramfs to lumper
  • Add an HTTP based API to lumper
  • Implement an initramfs generation tool in Rust
  • Integrate the serverless runtime into Polycode

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant