Crates.io | mem-ring |
lib.rs | mem-ring |
version | 0.2.0 |
source | src |
created_at | 2024-06-28 07:09:26.199856 |
updated_at | 2024-07-02 06:28:14.938794 |
description | Across-thread queue based on shared memory |
homepage | |
repository | https://github.com/ihciah/rust2go |
max_upload_size | |
id | 1286499 |
size | 40,484 |
A ring based on shared memory bridging rust and go. It support both tokio and monoio runtime.
With 2 rings, users can simulate calls between rust and go(Both sides can start calls).
TODO
[dependencies]
mem-ring = { version = "0.1", default-features = false, features = ["tokio"] }
tpc
): The aggregation will be better, there will be fewer syscall trigger. But, each consumer must grab the lock, which will introduce competition. Also, since there can only be one consumer per queue, the performance will be limited to a single thread. However, you can dispatch tasks to other workers manually to make it able to to support more throughput(of cause you have to pay for across-thread communication).tpc
makes the performance better for this mode): Each thread has its own queue, which can be consumed or produced independently. But, the aggregation effect will be worse, and the number of syscalls will increase.I suggest using the second mode if you use monoio, which is the default feature.
[dependencies]
mem-ring = { version = "0.1" }