zeep

module
v0.0.0-...-6cb77cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2019 License: Apache-2.0

README

Zeep Xanflorp and his Miniverse

Zeep

Worker for workflow aware serverless platform.

Table of Contents

Architecture

Overview

Architecture Overview

Architecture Overview

Zeep is a local agent that manages containers, storages and handles function invoke requests on a worker node. Kyle is an agent delegate that manages the runtimes takes over some of Zeep's roles.

Consider executing a workflow (also a function) that consists of sequential functions using Zeep CLI. Zeep takes the request and assign task to Kyle (It might not be Kyle. See details on Kyle section) and Kyle sends invoke request for first function of the workflow to a runtime. After the execution of the first function is completes, the second function of the workflow is invoked by another runtime but in the same container by Kyle.

For a workflow that consists of parallel functions, those functions are must be executed in different containers for performance isolation. At this time, Kyle sends invoke request for the first parallel function of the workflow to it's runtime and sends invoke request for rest of the parallel functions of the workflow to Zeep. In this case, Zeep knows that the requested functions are part of the workflow, so bind same storage that bound to the container that execute the first function to the other containers that are going to execute rest of the functions.

As a result, all the functions in the same workflow are deployed in the same host so the latency between the execution of functions is very small (about 150ms in OpenWhisk, about 1~15ms in ours). In addition, if there is data dependency among functions, the data can be shared using host storage, thereby saving the cost of external storage.

Zeep

Zeep provides Invokee and Invoker services via gRPC. Invokee service handles the requests related to the worker that responsible to execute a function. Invoker service handles the requests related to manage function resources and invoke a function.

When a container managed by Zeep is created in the pool, Kyle run in the container connect to Invokee service and Zeep pauses the container. Zeep unpauses this container when the invoke a function is requested by Invoker service, copies function resources into the container, and then assigns invoke task to Kyle that is connected through Invokee service. After the execution is completes, the container is paused again.

Kyle

Kyle also provides Invokee and Invoker service as same as Zeep provides. This is why we call Kyle an agent delegate. When a runtime managed by Kyle is created, the runtime connect to Invokee service provided by Kyle. The Invoker service provided by Kyle is only used by its runtime that executes a workflow. When the invoke a sequential function is requested, Kyle spawns a new runtime process, waits for connection from runtime through Invokee servie, and then assigns invoke task to the new runtime. If the function is a parallel function, Kyle simply forward the request to Zeep.

At the cold start, Kyle checks if the function is a workflow. If the function is not a workflow, Kyle requests for handover to Invokee service provided by Zeep and sends message to handover to runtime connected through its Invokee service. After the handover procedure, the runtime is connected to Invokee service provided by Zeep directly and the Kyle is shut down.

Getting Started

Prerequisites

Build Kyle

# Download Kyle.
$ git clone https://github.com/mee6aas/kyle.git

# Build Kyle.
$ cd ./kyle
$ ./scripts/build.sh

We are looking for a way to distribute Kyle as a package. Currently only manual builds are supported.

Install Zeep and Runtime

# Pull Zeep image from Docker Hub.
$ docker pull mee6aas/zeep

# Pull Runtime image from Docker Hub.
$ docker pull mee6ass/runtime-nodejs

# Unstall Zeep CLI
$ go get github.com/mee6aas/zeep/cmd/zeep

# Make sure the Zeep CLI is installed.
$ zeep --help

Currently only the runtime for Node.js is supported.

Run Zeep

$ zeep agent serve

When Zeep starts, you can see that one Zeep container and one runtime container are created.

Add a function

# Download sample functions.
$ git clone https://github.com/mee6aas/samples.git

# Add echo function.
$ cd ./samples/nodejs
$ zeep act add echo

# List added functions.
$ zeep act ls
> name:"echo" runtime:"mee6aas/runtime-nodejs:latest" added:"2019-12-24 07:03:51.534119732 +0000 UTC m=+370.172112759"

Invoke a function

# Invoke echo with argument "foo".
$ zeep act invoke echo foo
> foo

Invoke a workflow

# Add functions.
$ cd ./pingpong
$ zeep act add pinger
$ zeep act add ponger

# Invoke pinger with argument "ponger".
# The function pinger will invoke the function ponger.
# The ponger returns string "ponged".
$ zeep act invoke pinger ponger
> ping to ponger...pong from ponger: ponged.

Destroy Zeep

$ zeep agent destroy

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL