bytedance / monoio

Rust async runtime based on io-uring.
Apache License 2.0
3.86k stars 215 forks source link

tracing tools for monoio, thread-per-core #56

Open jon-chuang opened 2 years ago

jon-chuang commented 2 years ago

tokio tracing is slow as requires Sync and uses slow primitives Can take inspiration from https://github.com/tikv/minitrace-rust And optimize further for thread-per-core.

Actually minitrace is already very thread-per-core friendly as it does thread-local span collection before batching them out to central collector.

So maybe we should use minitrace instead.

Context on how slow tokio/tracing is: https://www.youtube.com/watch?v=8xTaxC1RcXE

minitrace is probably fast enough for spans deep in the async runtime itself. We can set tracing level via features (off by default)

[features]
minitrace_level_1 = []
minitrace_level_2 = [ "minitrace_level_1" ]
minitrace_level_3 = [ "minitrace_level_2" ]
jon-chuang commented 2 years ago

@ihciah @dyxushuai does monoio work with {futures::channel, tokio::sync}::oneshot::channel?

I am getting this error with https://github.com/tikv/minitrace-rust/issues/94

zhongzc commented 2 years ago

FYI, a minimal reproducible example:

#[monoio::test]
async fn block_forever() {
    let (tx, rx) = futures::channel::oneshot::channel();
    std::thread::spawn(move || {
        tx.send(()).unwrap();
    });
    rx.await.unwrap();
}
ihciah commented 2 years ago

Thanks! We will investigate it. @dyxushuai