YoMo
YoMo is an open-source Streaming Serverless Framework for building low-latency edge computing applications. Built atop QUIC transport protocol and functional reactive programming interface, makes build geo-distributed system quickly. Used in Metaverse, real-time web applications, AR/VR, IoT etc.
๐ถ Features
- โก๏ธ Low-latency Guaranteed by implementing atop of QUIC
- ๐ Security TLS v1.3 on every data packet by design
- ๐ฑ 5G/WiFi-6 Reliable networking in Celluar/Wireless
- ๐ Geo-Distributed Edge Mesh Edge-Mesh Native architecture makes your services close to end users
- ๐ธ Event-First Architecture leverages serverless service to be event driven and elastic
- ๐ฆ Streaming Serverless Write only a few lines of code to build applications and microservices
- ๐ Y3 a faster than real-time codec
- ๐จ Reactive stream processing based on Rx
๐ Getting Started
Prerequisite
1. Install CLI
Binary (Recommended)
$ curl -fsSL "https://get.yomo.run" | sh
Or build from source
$ go install github.com/yomorun/cli/yomo@latest
Verify Your YoMo CLI Installation
Use the following command to verify that the installation was successful:
$ yomo version
- You're good to go!
- Please make sure you have installed the latest version!
Create a YoMo App
The yomo init
command should set up everything for you.
$ yomo init yomo-app-demo
โ Initializing the Serverless app...
โ
Congratulations! You have initialized the serverless function successfully.
โน๏ธ You can enjoy the YoMo Serverless via the command:
โน๏ธ DEV: yomo dev -n Noise yomo-app-demo/app.go
โน๏ธ PROD: First run source application, eg: go run example/source/main.go
Second: yomo run -n yomo-app-demo yomo-app-demo/app.go
$ cd yomo-app-demo
YoMo CLI will automatically create an app.go
with the following content:
package main
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/yomorun/yomo/rx"
)
// NoiseData represents the structure of data
type NoiseData struct {
Noise float32 `json:"noise"` // Noise value
Time int64 `json:"time"` // Timestamp (ms)
From string `json:"from"` // Source IP
}
var echo = func(_ context.Context, i interface{}) (interface{}, error) {
value := i.(*NoiseData)
value.Noise = value.Noise / 10
rightNow := time.Now().UnixNano() / int64(time.Millisecond)
fmt.Println(fmt.Sprintf("[%s] %d > value: %f โก๏ธ=%dms", value.From, value.Time, value.Noise, rightNow-value.Time))
return value.Noise, nil
}
// Handler will handle data in Rx way
func Handler(rxstream rx.Stream) rx.Stream {
stream := rxstream.
Unmarshal(json.Unmarshal, func() interface{} { return &NoiseData{} }).
Debounce(50).
Map(echo).
StdOut()
return stream
}
func DataTags() []byte {
return []byte{0x33}
}
3. Build and Run
Run yomo dev
from the terminal. you will see the following message:
$ yomo dev
โน๏ธ YoMo serverless function file: app.go
โ Create YoMo serverless instance...
โ YoMo serverless function building...
โ
Success! YoMo serverless function build.
โน๏ธ YoMo serverless function is running...
โน๏ธ Run: /Users/xiaojianhong/Downloads/yomo-app-demo/sl.yomo
2021/06/07 12:00:06 Connecting to zipper dev.yomo.run:9000 ...
2021/06/07 12:00:07 โ
Connected to zipper dev.yomo.run:9000
[10.10.79.50] 1623038407236 > value: 1.919251 โก๏ธ=-25ms
[StdOut]: 1.9192511
[10.10.79.50] 1623038407336 > value: 11.370256 โก๏ธ=-25ms
[StdOut]: 11.370256
[10.10.79.50] 1623038407436 > value: 8.672209 โก๏ธ=-25ms
[StdOut]: 8.672209
[10.10.79.50] 1623038407536 > value: 4.826996 โก๏ธ=-25ms
[StdOut]: 4.826996
[10.10.79.50] 1623038407636 > value: 16.201773 โก๏ธ=-25ms
[StdOut]: 16.201773
[10.10.79.50] 1623038407737 > value: 13.875483 โก๏ธ=-26ms
[StdOut]: 13.875483
๐ Show case
๐ Examples
All examples can be run by Task, following the
Install Task, execute task -l
in this
directory will list all the examples.
$ cd example
$ task -l |grep example
* example-basic: YoMo basic usage
* example-pipeline: Unix pipeline to cloud
* example-iopipe: IO Pipe
* example-multi-sfn: Multiple stream functions
* example-cascading-zipper: Cascading zippers
can run each example directly by task example-basic
,
task example-cascading-zipper
and etc.
- 0-basic: process the streams from IoT sound sensor.
- 1-pipeline:
read the local streams (f.e.
/dev/urandom
) and use yomo-source to send the streams over cloud. - 2-iopipe: use
io.Copy()
to pipe the local streams (f.e./dev/urandom
) to yomo-source. - 3-multi-sfn:
use 3 stream functions to process the streams in different cases.
- stream-fn-1: calculate the sound value in real-time.
- stream-fn-2: print the warning message when the sound value reaches a threshold.
- stream-fn-3: calculate the average value in a sliding window.
- 4-cascading-zipper: source connect to zipper-1, then zipper-1 will auto sync streams to the zippers in other regions.
๐ฏ Focuses on computing at the edge
YoMo is best for:
- Making latency-sensitive applications.
- Dealing with high network latency and packet loss.
- Handling continuous high-frequency data with stream processing.
- Building complex systems with streaming serverless architecture.
๐ฆธ Contributing
First off, thank you for considering making contributions. It's people like you that make YoMo better. There are many ways in which you can participate in this project, for example:
- File a bug report. Be sure to include information like what version of YoMo you are using, what your operating system is, and steps to recreate the bug.
- Suggest a new feature.
- Read our contributing guidelines to learn about what types of contributions we are looking for.
- We have also adopted a code of conduct that we expect project participants to adhere to.
๐คน๐ปโโ๏ธ Feedback
If you have any questions, please feel free to come to our discussion board. Any feedback would be greatly appreciated!