(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 |
- External communication can archive 1.5M messages (1500 bytes) per second, that is 1.5M * 1500 * 8 = 18Gbps, this is just enough for almost of application. The latency is 2.5ms, because of we doing in polling base, maybe it can improve by using interrupt base.
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