Crates.io | sans-io-runtime |
lib.rs | sans-io-runtime |
version | 0.3.0 |
source | src |
created_at | 2024-07-18 17:40:45.099495 |
updated_at | 2024-11-08 20:04:20.244041 |
description | An opinionated SANS-IO runtime for SDN and media servers |
homepage | |
repository | https://github.com/8xFF/sans-io-runtime |
max_upload_size | |
id | 1307806 |
size | 393,171 |
(This module is in very early stage of development. It is not ready for production use.)
This is a simple, lightweight, and fast runtime for the SansIo mechanism.
The goal of this project is to provide a simple, lightweight, and fast runtime for the SansIo mechanism. The runtime should be able to run on any platform with variables network library like: mio, io_uring, af_xdp.
Controller will spawn some threads and each thread will run a worker. The workers
Impl | C/I | Works | Benchmark | Group | Description |
---|---|---|---|---|---|
[x] | [ ] | [x] | [ ] | Control | Cross tasks communication |
[x] | [ ] | [x] | [x] | Control | Controller to worker communication |
[x] | [ ] | [x] | [ ] | Control | Controller to task communication |
[x] | [ ] | [x] | [ ] | Control | Workers status monitoring |
[x] | [ ] | [x] | [ ] | I/O | Udp |
[x] | [ ] | [x] | [ ] | I/O | Tun/Tap |
[ ] | [ ] | [ ] | [ ] | I/O | Tcp |
[ ] | [ ] | [ ] | [ ] | I/O | Rpc |
[x] | [ ] | [x] | [ ] | Backend | mio |
[x] | [ ] | [x] | [ ] | Backend | raw poll |
[x] | [ ] | [x] | [ ] | Backend | polling |
[ ] | [ ] | [ ] | [ ] | Backend | io_uring |
[ ] | [ ] | [ ] | [ ] | Backend | af_xdp |
[x] | [ ] | [x] | [ ] | Example | Udp echo server |
[x] | [ ] | [x] | [ ] | Example | Udp echo client |
[x] | [ ] | [x] | [ ] | Example | Simple Whip/Whep server |
Bellow is state diagram of a single task.
stateDiagram
[*] --> Created
Created --> Waiting : attach to worker
Waiting --> OnTick : timer fired
OnTick --> Waiting : no output
OnTick --> PopOutput : has output
PopOutput --> PopOutput : has output
PopOutput --> Waiting : no output
Waiting --> OnInput : I/O, Bus
OnInput --> Waiting : no output
OnInput --> PopOutput : has output
The idea is in SAN/IO style, each task will reduce memory by create output immediately after input. We need to pop the output before we can receive the next input.
With idea of SAN/IO is we need to pop the output before we can receive the next input. This is a problem when we have multiple tasks. We need to have a way to control the order of the tasks.
stateDiagram
[*] --> Created
Created --> Waiting : attach groups to worker
Waiting --> OnTick : timer fired
OnTick --> OnTickSingleTask : next task
OnTick --> Waiting : no task
OnTickSingleTask --> OnTick : no output
OnTickSingleTask --> PopCurrentTickTaskOutput : has output
PopCurrentTickTaskOutput --> PopCurrentTickTaskOutput : has output
PopCurrentTickTaskOutput --> OnTick : no output
Waiting --> OnInput : I/O, Bus
OnInput --> OnInputSingleTask : has task
OnInputSingleTask --> Waiting : no output
OnInputSingleTask --> PopCurrentInputTaskOutput : has output
PopCurrentInputTaskOutput --> PopCurrentInputTaskOutput : has output
PopCurrentInputTaskOutput --> Waiting : no output