datafuselabs / openraft

rust raft with improvements
Apache License 2.0
1.24k stars 140 forks source link

Add sync primitives to `AsyncRuntime` trait #1013

Open drmingdrmer opened 3 months ago

drmingdrmer commented 3 months ago

Yes. Tokio primitives do work in other runtimes, but they are not optimally-supported.

For example, Tokio has its own counters for cooperative multitasking (which, obviously, only make sense and are active if running within Tokio), other runtimes have their own algorithm for how not to block the runtime for too long. The same is true for resource monitoring support (e.g., via tracing in Tokio).

Another issue is that Tokio sync primitives allocate memory at unexpected points. This is OK if you are fine with your program going broken on OOM, but we don't have this luxury :-). We need to handle OOMs properly.

Originally posted by @schreter in https://github.com/datafuselabs/openraft/pull/1010#pullrequestreview-1887035679

TODO:

github-actions[bot] commented 3 months ago

👋 Thanks for opening this issue!

Get help or engage by: