MAY
Rust Stackfull Coroutine Library.
May is a high performance stackfull coroutine library that can be thought of rust version goroutine. you can use it easily to design and develop massive concurrent programs in rust.
Features
- Stackfull coroutine implementation based on generator
- Support schedule on configurable number of threads for multi-cores
- Support coroutine version local storage(CLS)
- Support efficient network async IO
- Support efficient timer management
- Support standard snc primitives plus semphore, mpmc channel etc.
- Support cancellation of coroutines
- Support graceful panic handling that will not affect other coroutines
- Support scoped coroutine creation
- Support general select for all the coroutine APIs
- All the coroutine APIs are compatible with std library semantics
- All the coroutine APIs can be safely called in thread context
Usage
/// a naive echo server
extern crate may;
use coroutine;
use TcpListener;
use ;
More examples
CPU heavy load examples
IO heavy Bound examples
Performance
just a simple comparation with the rust echo server implemented in tokio to get a sense about May
Machine Specs:
- Logical Cores: 4 (4 cores x 1 threads)
- Memory: 4gb ECC DDR3 @ 1600mhz
- Processor: CPU Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz
- Operating System: Ubuntu VirtualBox guest
Echo server client:
- you can just compile it under this project
tokio echo server
run the server by default with 2 threads in another terminal
==================Benchmarking: 127.0.0.1:8080==================
may echo server
run the server by default with 2 threads in another terminal
==================Benchmarking: 127.0.0.1:8000==================
Notices
-
both stable and nightly rust compiler are supported
-
This crate supports below platforms, for more platform support, please ref generator
- x86_64 Linux
- x86_64 MacOs
- x86_64 Windows
License
May is licensed under either of the following, at your option:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)