Benchmark Rust actor frameworks with same application
You can run the Actix example with:
cargo run --bin actix
actix has 3 types for controlling concurrency
- OS process
- out of scope of actix
System- Usually, only one in process
- Only for special reason, like test, there are multiple
Systems. - Between different
Systems,Actors cannot send messages.
Arbiter- Represents a OS thread
- Each
Arbiteris bound to one and only oneSystem Systemcan hold multipleArbiters. But in this benchmark, we only use oneArbiter.
Actor- Encapsulates state and behavior
- Communicates with other
Actors by sending and receiving messages - Each
Actoris bound to one and only oneArbiter
- cast: 片方向メッセージ送信
- call: RPC
-
Timer
- Actix:
actix::AsyncContext::run_interval - Ractor: Not supported. Need to use
tokio::time::intervaland send message toActorperiodically.
- Actix:
-
Handler
- Actix: Need to implement
Handlertrait for each message type. - Ractor: Implement
Actortrait once, and define message handling inhandlemethod.
- Actix: Need to implement