https://github.com/ethe/tokio-group
Tokio runtime sharding solution, supports numa awareness and core affinity
https://github.com/ethe/tokio-group
Last synced: 21 days ago
JSON representation
Tokio runtime sharding solution, supports numa awareness and core affinity
- Host: GitHub
- URL: https://github.com/ethe/tokio-group
- Owner: ethe
- Created: 2024-06-11T03:43:12.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-11T04:14:08.000Z (about 2 years ago)
- Last Synced: 2025-12-26T19:40:37.334Z (6 months ago)
- Language: Rust
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tokio-Group
A tool that helps user to create sharding tokio runtime instances, supports NUMA awareness.
## Install
Only sharding, no affinity feature.
```toml
tokio-group = { git = "https://github.com/ethe/tokio-group.git", branch = "main" }
```
### Core Affinity Mode
Just bind each runtime to cores without NUMA info.
```toml
tokio-group = { git = "https://github.com/ethe/tokio-group.git", branch = "main", features = ["affinity"] }
```
### Numa Awareness Mode
Bind each runtime to NUMA nodes.
```toml
tokio-group = { git = "https://github.com/ethe/tokio-group.git", branch = "main", features = ["numa-awareness"] }
```
## Usage
```rust
fn main() {
let results: std::io::Result> = tokio_group::new()
// switch on NUMA mode, relies on numa-awareness feature.
.numa(true)
// tokio-group supports two-level affinity strategies, several tokio runtimes could share one NUMA node.
.workers_per_numa(1)
.init(async {
// some initializations before forking tokio runtimes.
})
.entry(async move {
// server entry here.
})
.run();
}
```