Rust async runtime based on io-uring.

Related tags

Database monoio
Overview

Monoio

A thread-per-core Rust runtime with io_uring.

Crates.io MIT/Apache-2 licensed Build Status 中文说明

Design Goal

As a runtime based on io_uring, Monoio is designed to be the most efficient and performant Rust runtime.

For some use cases, it is not necessary to make task schedulable between threads. For example, if we want to implement a load balancer like nginx, we may want to write it in a thread-per-core way. The thread local data need not to be shared between threads, so the Sync and Send will not have to be implemented.

Also, the Monoio is designed to be efficient. To achieve this goal, we enabled many Rust unstable features like GAT; and we designed a whole new IO abstraction to avoid copying, which may cause some compatibility problems.

Our benchmark shows that Monoio has a better performance than other common Rust runtimes.

Quick Start

To use monoio, you need the latest nightly rust toolchain. If you already installed it, please make sure it is the latest version.

To force using nightly, create a file named rust-toolchain and write nightly in it. Also, you can use cargo +nightly to build or run.

Here is a basic exmaple of how to use Monoio.

/// A echo example.
///
/// Run the example and `nc 127.0.0.1 50002` in another shell.
/// All your input will be echoed out.
use monoio::io::{AsyncReadRent, AsyncWriteRentExt};
use monoio::net::{TcpListener, TcpStream};

#[monoio::main]
async fn main() {
    let listener = TcpListener::bind("127.0.0.1:50002").unwrap();
    println!("listening");
    loop {
        let incoming = listener.accept().await;
        match incoming {
            Ok((stream, addr)) => {
                println!("accepted a connection from {}", addr);
                monoio::spawn(echo(stream));
            }
            Err(e) => {
                println!("accepted connection failed: {}", e);
                return;
            }
        }
    }
}

async fn echo(stream: TcpStream) -> std::io::Result<()> {
    let mut buf: Vec<u8> = Vec::with_capacity(8 * 1024);
    loop {
        // read
        let (res, _buf) = stream.read(buf).await;
        buf = _buf;
        let res: usize = res?;
        if res == 0 {
            return Ok(());
        }

        // write all
        let (res, _buf) = stream.write_all(buf).await;
        buf = _buf;
        res?;

        // clear
        buf.clear();
    }
}

Limitations

  1. Since we rely on io_uring, currently monoio depends on Linux 5.6 or later. Epoll or other multiplex I/O will be supported soon.
  2. Monoio can not solve all problems. If the workload is very unbalanced, it may cause performance degradation than Tokio since CPU cores may not be fully utilized.

Contributors

GitHub Contributors Image

Thanks for their contributions!

Licenses

Monoio is licensed under the MIT license or Apache license.

During developing we referenced a lot from Tokio, Mio, Tokio-uring and other related projects. We would like to thank the authors of these projects.

Comments
  • High CPU usage

    High CPU usage

    Version v0.0.3

    Platform Linux linux 5.11.0-40-generic #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

    ulimit -l 65536

    Description

    All examples eat up ~100% of CPU

    cargo run --color=always --example echo --release or
    cargo run --color=always --example proxy --release or
    cargo run --color=always --example hyper-server --release
    

    Screenshot from 2021-12-15 23-38-31

    opened by kshvakov 8
  • monoio need support pollable IO driver for cross platform development

    monoio need support pollable IO driver for cross platform development

    Why?

    The platform support: https://github.com/bytedance/monoio/blob/master/docs/en/platform-support.md

    How?

    We can just use mio as our dependency for the pollable IO driver

    F-feature-request 
    opened by dyxushuai 8
  • block_on from local runtime, like tokio

    block_on from local runtime, like tokio

    I need to be able to fetch the current runtime of each thread and call blocking methods. How does tokio with the functions

    • https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html#method.block_on
    • https://docs.rs/tokio/latest/tokio/task/fn.spawn_blocking.html
    • https://docs.rs/tokio/latest/tokio/runtime/struct.Handle.html#method.current

    I think I could implement it.

    Edit:

    I see that it is quite difficult to get a local Executor because it depends on the Driver trait. I'm doing tests removing everything that is not ui-ring. It may fork you. With this I come to say that there is no rush with the issue and thank you for your work. I have already seen that you have it reflected in #8

    F-feature-request 
    opened by botika 6
  • TcpListener/ListenerConfig support configure IPV6_V6ONLY

    TcpListener/ListenerConfig support configure IPV6_V6ONLY

    Is your feature request related to a problem? Please describe. I want TcpListener bind both ipv4 and ipv6 (dual stack)

    Describe the solution you'd like Add a config in struct ListenerConfig for ipv6_v6only

    Describe alternatives you've considered None

    Additional context

    [w@ww ~]$ sysctl net.ipv6.bindv6only
    net.ipv6.bindv6only = 0
    

    image

    F-feature-request 
    opened by pymongo 4
  • Implement spawn_blocking

    Implement spawn_blocking

    Is your feature request related to a problem? Please describe. We need spawn_blocking like tokio, or the latency will be very big if users do heavy calculation.

    Describe the solution you'd like Implement with an thread pool.

    Describe alternatives you've considered Maybe users can do "spawn" by themselves since they can do across-thread communication.

    Additional context Nop.

    F-feature-request 
    opened by ihciah 4
  • Unsafety of pinned buffer?

    Unsafety of pinned buffer?

    According to the docs, the runtime will pin the buffer of an IoBufMut. But doesn't this mean that the impl of AsyncReadRent for [u8; N] is unsound because it returns the buffer by move, which violates the pinning guarantees?

    opened by alercah 3
  • panics: run example 'join'

    panics: run example 'join'

    Version List the versions of all monoio crates you are using. The easiest way to get this information is using cargo tree subcommand:

    cargo tree | grep monoio

    monoio v0.0.3 (github.com/bytedance/monoio/monoio)
    ├── monoio-macros v0.0.2 (proc-macro) (github.com/bytedance/monoio/monoio-macros)
    monoio-compat v0.0.4 (github.com/bytedance/monoio/monoio-compat)
    ├── monoio v0.0.3 (github.com/bytedance/monoio/monoio) (*)
    └── monoio v0.0.3 (github.com/bytedance/monoio/monoio) (*)
    monoio-examples v0.0.0 (github.com/bytedance/monoio/examples)
    ├── monoio v0.0.3 (github.com/bytedance/monoio/monoio) (*)
    ├── monoio-compat v0.0.4 (github.com/bytedance/monoio/monoio-compat) (*)
    monoio-macros v0.0.2 (proc-macro) (github.com/bytedance/monoio/monoio-macros) (*)
    

    Platform The output of uname -a and ulimit -l.

    uname -a
    Linux zephyrus 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 GNU/Linux
    
    ulimit -l
    64
    

    Description Enter your issue details here. One way to structure the description:

    [short summary of the bug]

    RUST_BACKTRACE=1 cargo run --color=always --example join
    

    Output:

    thread 'main' panicked at 'Unable to build runtime.: Os { code: 12, kind: OutOfMemory, message: "Cannot allocate memory" }', github.com/bytedance/monoio/monoio/src/lib.rs:81:10
    stack backtrace:
       0: rust_begin_unwind
                 at /rustc/936238a92b2f9d6e7afe7dda69b4afd903f96399/library/std/src/panicking.rs:498:5
       1: core::panicking::panic_fmt
                 at /rustc/936238a92b2f9d6e7afe7dda69b4afd903f96399/library/core/src/panicking.rs:106:14
       2: core::result::unwrap_failed
                 at /rustc/936238a92b2f9d6e7afe7dda69b4afd903f96399/library/core/src/result.rs:1613:5
       3: core::result::Result<T,E>::expect
                 at /rustc/936238a92b2f9d6e7afe7dda69b4afd903f96399/library/core/src/result.rs:1255:23
       4: monoio::start
                 at ./monoio/src/lib.rs:79:18
       5: join::main
                 at ./examples/join.rs:6:5
       6: core::ops::function::FnOnce::call_once
                 at /rustc/936238a92b2f9d6e7afe7dda69b4afd903f96399/library/core/src/ops/function.rs:227:5
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    
    opened by divinerapier 3
  • AsyncWriteRent and AsyncReadRent trait who's method maybe need receive the mut self reference

    AsyncWriteRent and AsyncReadRent trait who's method maybe need receive the mut self reference

    I think the IO things can't be read or write concurrently. If we want do that then we can add Half APIs. Like what we see in the AsyncRead/AsyncWrite in futures or tokio.

    opened by dyxushuai 3
  • create a VTable (raw_waker) in a thread 2 and call (wake_by_val) in thread 1

    create a VTable (raw_waker) in a thread 2 and call (wake_by_val) in thread 1

    Clone https://github.com/botika/ntex and:

    cd ntex-rt
    RUST_BACKTRACE=1 cargo test --no-default-features --features=monoio --lib -- --test-threads=1 --nocapture builder::tests::test_async -- --nocapture
    

    The trace:

      1: scoped_tls::ScopedKey<T>::with
                 at /home//.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:168:9
       2: <monoio::scheduler::LocalScheduler as monoio::task::Schedule>::schedule
                 at /home//.cargo/git/checkouts/monoio-91d866d0e012895e/023e657/monoio/src/scheduler.rs:9:9
       3: monoio::task::harness::Harness<T,S>::wake_by_val
                 at /home//.cargo/git/checkouts/monoio-91d866d0e012895e/023e657/monoio/src/task/harness.rs:176:17
       4: monoio::task::waker::wake_by_val
                 at /home//.cargo/git/checkouts/monoio-91d866d0e012895e/023e657/monoio/src/task/waker.rs:76:5
       5: core::task::wake::Waker::wake
                 at /rustc/b8c35ca26b191bb9a9ac669a4b3f4d3d52d97fb1/library/core/src/task/wake.rs:276:18
    

    According to my logs, wake_by_val is launched in a thread without Runtime running. VTable is created on the new thread and called on the main thread. i.e. raw_waker is called in thread(2) and wake_by_val in thread(1), creating a single runtime in thread(2). Sorry for this mess of issue. I'm short on time and I'm trying to get the case out without the ntex wrapper. But I thought you would like to know as soon as possible. I will try to debug the exact case and update the issue.

    I have to disassemble the part of ntex but this way it is clearer.

            // std channel
            let (tx, rx) = mpsc::channel();
            // spawn read
            thread::spawn(move || {
                // create a ntex system with monoio feature
                let runner = crate::System::build().finish();
                // send ntex system ref
                tx.send(runner.system()).unwrap();
               // block until finish
                let _ = runner.run_until_stop();
            });
            // take system
            let sys = rx.recv().unwrap();
            // sleep 1 second ( If you delete this line it works )
            std::thread::sleep(std::time::Duration::from_secs(1));
            // and exec function in the system
            sys.arbiter().exec_fn(|| {});
    
    opened by botika 2
  • Implement poll_* for AsyncReadRent and AsyncWriteRent

    Implement poll_* for AsyncReadRent and AsyncWriteRent

    Is your feature request related to a problem? Please describe. I'm building an HTTP/2 server on top of monoio. The issue is that TLS crates like rustls and boring require std::io::Read and std::io::Write traits to be implemented.

    Describe the solution you'd like tokio_boring solves this issue by implementing aforementioned traits on a wrapper struct. This solution requires poll_* methods to be present.

    F-feature-request 
    opened by boohba 2
  • TcpStream::connect fails with InvalidInput while running tcp_uring example

    TcpStream::connect fails with InvalidInput while running tcp_uring example

    Version I use current master at https://github.com/bytedance/monoio/commit/2f151f2b9f99fc116055e08a37c61521757c4cd7

    Platform The output of uname -a and ulimit -l.

    uname -a
    Linux 5.17.14-300.fc36.x86_64+debug #1 SMP PREEMPT Thu Jun 9 13:21:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
    
    ulimit -l
    8192
    

    Description

    TcpStream::connect fails with InvalidInput while running tcp_uring example

    Running cargo run --example tcp_uring yields

    Will run with IoUringDriver(you must be on linux and enable iouring feature)
    [Client] Waiting for server ready
    [Server] Bind ready
    [Client] Server is ready, will connect and send data
    thread '<unnamed>' panicked at '[Client] Unable to connect to server: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }', examples/tcp_uring.rs:34:18
    
    Full backrace
    stack backtrace:
     0:     0x5613d465c810 - std::backtrace_rs::backtrace::libunwind::trace::h60bf900414c5dcf2
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     1:     0x5613d465c810 - std::backtrace_rs::backtrace::trace_unsynchronized::habfc3ef92583c158
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x5613d465c810 - std::sys_common::backtrace::_print_fmt::hae196fe4153d0b63
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/sys_common/backtrace.rs:66:5
     3:     0x5613d465c810 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h08f9c50f850514f5
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/sys_common/backtrace.rs:45:22
     4:     0x5613d4678a0c - core::fmt::write::hcd15d2c673b5a9c1
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/fmt/mod.rs:1198:17
     5:     0x5613d4658ed5 - std::io::Write::write_fmt::h417be4d25b915a22
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/io/mod.rs:1672:15
     6:     0x5613d465e071 - std::sys_common::backtrace::_print::h95ab226f37d571aa
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/sys_common/backtrace.rs:48:5
     7:     0x5613d465e071 - std::sys_common::backtrace::print::hc77fb9ed6b2eeb3d
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/sys_common/backtrace.rs:35:9
     8:     0x5613d465e071 - std::panicking::default_hook::{{closure}}::hca418bd67097eb22
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:295:22
     9:     0x5613d465dd3e - std::panicking::default_hook::h1df4f10c6ed28c53
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:314:9
    10:     0x5613d465e713 - std::panicking::rust_panic_with_hook::hf1e7a1cb721a9823
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:698:17
    11:     0x5613d465e607 - std::panicking::begin_panic_handler::{{closure}}::h573a00e95ce9340d
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:588:13
    12:     0x5613d465cd34 - std::sys_common::backtrace::__rust_end_short_backtrace::h597b7803117e52fd
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/sys_common/backtrace.rs:138:18
    13:     0x5613d465e332 - rust_begin_unwind
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:584:5
    14:     0x5613d45d49b3 - core::panicking::panic_fmt::h62ccf03c8a8a51b5
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/panicking.rs:142:14
    15:     0x5613d45d4a43 - core::result::unwrap_failed::hff48f82f03d418ae
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/result.rs:1814:5
    16:     0x5613d45e4eec - core::result::Result<T,E>::expect::h06b932c75fc0619f
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/result.rs:1064:23
    17:     0x5613d45ed061 - tcp_uring::run::{{closure}}::{{closure}}::h798ebb573da54447
                                 at /home/dr/checkout/monoio/examples/tcp_uring.rs:32:28
    18:     0x5613d45e2dfc - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1d329dafc8cb7ef7
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/future/mod.rs:91:19
    19:     0x5613d45e4596 - monoio::task::core::CoreStage<T>::poll::{{closure}}::hdf835fe76cf14c85
                                 at /home/dr/checkout/monoio/monoio/src/task/core.rs:116:17
    20:     0x5613d45d8480 - <core::cell::UnsafeCell<T> as monoio::task::utils::UnsafeCellExt<T>>::with_mut::h7635711df777ce23
                                 at /home/dr/checkout/monoio/monoio/src/task/utils.rs:14:9
    21:     0x5613d45e4663 - monoio::task::core::CoreStage<T>::with_mut::h56a469e0a03b69cb
                                 at /home/dr/checkout/monoio/monoio/src/task/core.rs:101:9
    22:     0x5613d45e4277 - monoio::task::core::CoreStage<T>::poll::h5af03ee54b8b3bb1
                                 at /home/dr/checkout/monoio/monoio/src/task/core.rs:106:13
    23:     0x5613d45df5f8 - monoio::task::harness::poll_future::hf77210d8be4f08a2
                                 at /home/dr/checkout/monoio/monoio/src/task/harness.rs:376:18
    24:     0x5613d45df6c7 - monoio::task::harness::Harness<T,S>::poll_inner::h9b1c2d534ff09919
                                 at /home/dr/checkout/monoio/monoio/src/task/harness.rs:76:19
    25:     0x5613d45e0973 - monoio::task::harness::Harness<T,S>::poll::h221813ad72ba1651
                                 at /home/dr/checkout/monoio/monoio/src/task/harness.rs:52:15
    26:     0x5613d45daa30 - monoio::task::raw::poll::hcf302bf61c74505b
                                 at /home/dr/checkout/monoio/monoio/src/task/raw.rs:105:5
    27:     0x5613d46172af - monoio::task::raw::RawTask::poll::h6674ecdee16f6556
                                 at /home/dr/checkout/monoio/monoio/src/task/raw.rs:80:18
    28:     0x5613d45f4365 - monoio::task::Task<S>::run::h85fa75e0221e7f99
                                 at /home/dr/checkout/monoio/monoio/src/task/mod.rs:47:9
    29:     0x5613d45e7ff3 - monoio::runtime::Runtime<D>::block_on::{{closure}}::{{closure}}::he6183734a8543936
                                 at /home/dr/checkout/monoio/monoio/src/runtime.rs:143:29
    30:     0x5613d45d4e63 - scoped_tls::ScopedKey<T>::set::ha00816e2f74cf61c
                                 at /home/dr/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
    31:     0x5613d45e7a22 - monoio::runtime::Runtime<D>::block_on::{{closure}}::h5d57811c8d0fbcc9
                                 at /home/dr/checkout/monoio/monoio/src/runtime.rs:130:13
    32:     0x5613d45d50c3 - scoped_tls::ScopedKey<T>::set::hdc18c92f0ae942b1
                                 at /home/dr/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
    33:     0x5613d45ea1db - <monoio::driver::uring::IoUringDriver as monoio::driver::Driver>::with::hd2978ab165e731a3
                                 at /home/dr/checkout/monoio/monoio/src/driver/uring/mod.rs:259:9
    34:     0x5613d45e7790 - monoio::runtime::Runtime<D>::block_on::h0470bf77d9dca20f
                                 at /home/dr/checkout/monoio/monoio/src/runtime.rs:129:9
    35:     0x5613d45df293 - monoio::start::h8fbcb4bfaa65ffce
                                 at /home/dr/checkout/monoio/monoio/src/lib.rs:94:5
    36:     0x5613d45ecbe7 - tcp_uring::run::{{closure}}::h34b374f24a920d28
                                 at /home/dr/checkout/monoio/examples/tcp_uring.rs:27:9
    37:     0x5613d45f371e - std::sys_common::backtrace::__rust_begin_short_backtrace::h7a904a254d5f590b
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/sys_common/backtrace.rs:122:18
    38:     0x5613d45dcd9a - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::hd149554c9dcdfa01
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/thread/mod.rs:505:17
    39:     0x5613d45e0f7e - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h3815bd578e1d88bc
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/panic/unwind_safe.rs:271:9
    40:     0x5613d45d8da3 - std::panicking::try::do_call::h6df9a0604e18405a
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:492:40
    41:     0x5613d45d926b - __rust_try
    42:     0x5613d45d898a - std::panicking::try::h7d27a3888d9bc7c1
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:456:19
    43:     0x5613d45e498e - std::panic::catch_unwind::h9eb5f3a8371e0827
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panic.rs:137:14
    44:     0x5613d45dcbe5 - std::thread::Builder::spawn_unchecked_::{{closure}}::h8819e20da09f5953
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/thread/mod.rs:504:30
    45:     0x5613d45efb2e - core::ops::function::FnOnce::call_once{{vtable.shim}}::h947bc7d58899b370
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/ops/function.rs:248:5
    46:     0x5613d4660b13 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hede4885ee64a1fac
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/alloc/src/boxed.rs:1935:9
    47:     0x5613d4660b13 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h06c745de9f474954
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/alloc/src/boxed.rs:1935:9
    48:     0x5613d4660b13 - std::sys::unix::thread::Thread::new::thread_start::h529a493f2fb191b6
                                 at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/sys/unix/thread.rs:108:17
    49:     0x7fb81032ce2d - start_thread
    50:     0x7fb8103b21b0 - __clone3
    51:                0x0 - <unknown>
    

    Let me know if I can add more details. Thanks!

    opened by LizardWizzard 2
  • error below : protocol error for h2-server when trying to run in browser

    error below : protocol error for h2-server when trying to run in browser

    error below : protocol error for h2-server when trying to run in browser

    cargo run --example h2-server --release
        Finished release [optimized] target(s) in 0.08s
         Running `target/release/examples/h2-server`
    listening on Ok(0.0.0.0:8080)
    listening on Ok(0.0.0.0:8080)
    listening on Ok(0.0.0.0:8080)
    listening on Ok(0.0.0.0:8080)
      -> err=Error { kind: GoAway(b"", PROTOCOL_ERROR, Library) }
      -> err=Error { kind: GoAway(b"", PROTOCOL_ERROR, Library) }
      -> err=Error { kind: GoAway(b"", PROTOCOL_ERROR, Library) }
      -> err=Error { kind: GoAway(b"", PROTOCOL_ERROR, Library) }
    
    opened by hiqsociety 0
  • Working with Files?

    Working with Files?

    I had a go at writing a basic program to copy the content of files. However, I found that I can't use monoio::io::copy or monoio::io::zero_copy, I understand because monoio::fs::File only implements positional I/O.

    I found my way to BufReader which sounds like what I want, from the docs:

    BufReader implements AsyncBufRead and AsyncReadRent, and if the inner io implements AsyncWriteRent, it will delegate the implementation.

    However, I do not see an implementation unless the underlying AsyncReadRent.

    I'd like to be able to copy or zero-copy file-based file descriptors in an obvious way using the functions provided by the library.

    Is this possible currently, or is there some implementation missing?

    F-feature-request 
    opened by pwaller 0
  • possible to provide a letsencrypt autocert http2 example?

    possible to provide a letsencrypt autocert http2 example?

    pls provide an example for automatic letsencrypt example using http2. appreciate this. not sure how to use here https://github.com/bytedance/monoio/blob/master/examples/h2_server.rs

    F-feature-request 
    opened by ultperf 0
  • chore(deps): update nix requirement from 0.25 to 0.26

    chore(deps): update nix requirement from 0.25 to 0.26

    Updates the requirements on nix to permit the latest version.

    Changelog

    Sourced from nix's changelog.

    [0.26.1] - 2022-11-29

    Fixed

    • Fix UB with sys::socket::sockopt::SockType using SOCK_PACKET. (#1821)

    [0.26.0] - 2022-11-29

    Added

    • Added SockaddrStorage::{as_unix_addr, as_unix_addr_mut} (#1871)
    • Added MntFlags and unmount on all of the BSDs.
    • Added any() and all() to poll::PollFd. (#1877)
    • Add MntFlags and unmount on all of the BSDs. (#1849)
    • Added a Statfs::flags method. (#1849)
    • Added NSFS_MAGIC FsType on Linux and Android. (#1829)
    • Added sched_getcpu on platforms that support it. (#1825)
    • Added sched_getaffinity and sched_setaffinity on FreeBSD. (#1804)
    • Added line_discipline field to Termios on Linux, Android and Haiku (#1805)
    • Expose the memfd module on FreeBSD (memfd was added in FreeBSD 13) (#1808)
    • Added domainname field of UtsName on Android and Linux (#1817)
    • Re-export RLIM_INFINITY from libc (#1831)
    • Added syncfs(2) on Linux (#1833)
    • Added faccessat(2) on illumos (#1841)
    • Added eaccess() on FreeBSD, DragonFly and Linux (glibc and musl). (#1842)
    • Added IP_TOS SO_PRIORITY and IPV6_TCLASS sockopts for Linux (#1853)
    • Added new_unnamed and is_unnamed for UnixAddr on Linux and Android. (#1857)
    • Added SockProtocol::Raw for raw sockets (#1848)
    • added IP_MTU (IpMtu) IPPROTO_IP sockopt on Linux and Android. (#1865)

    Changed

    • The MSRV is now 1.56.1 (#1792)

    ... (truncated)

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Stable Rust now that GATs are stable?

    Stable Rust now that GATs are stable?

    Thanks for making this library!

    I noticed in the readme that GATs are a reason for depending on nightly Rust instead of stable. Now that GATs have just landed in stable, is it possible for monoio to depend on stable?

    F-feature-request 
    opened by rtfeldman 1
Releases(0.0.9)
  • 0.0.9(Oct 21, 2022)

    What's Changed

    • chore(deps): update windows requirement from 0.40.0 to 0.42.0 by @dependabot in https://github.com/bytedance/monoio/pull/112
    • fully compactable tcp_safe by @ihciah in https://github.com/bytedance/monoio/pull/113
    • implement from_std for TcpStream by @botika in https://github.com/bytedance/monoio/pull/115
    • fix: adjust to latest nightly api changing by @ihciah in https://github.com/bytedance/monoio/pull/118
    • bump monoio and monoio-compat versions by @ihciah in https://github.com/bytedance/monoio/pull/119

    New Contributors

    • @botika made their first contribution in https://github.com/bytedance/monoio/pull/115

    Full Changelog: https://github.com/bytedance/monoio/compare/0.0.8...0.0.9

    Source code(tar.gz)
    Source code(zip)
  • 0.0.8(Sep 21, 2022)

    What's Changed

    • feat: support zero-copy with splice by @ihciah in https://github.com/bytedance/monoio/pull/103
    • feat: support force use legacy driver with env by @ihciah in https://github.com/bytedance/monoio/pull/104
    • chore(deps): update nix requirement from 0.24 to 0.25 by @dependabot in https://github.com/bytedance/monoio/pull/99
    • feat: make split/into_split generic by @Kingtous in https://github.com/bytedance/monoio/pull/105
    • chore: fix clippy and bump version by @ihciah in https://github.com/bytedance/monoio/pull/110

    New Contributors

    • @dependabot made their first contribution in https://github.com/bytedance/monoio/pull/99
    • @Kingtous made their first contribution in https://github.com/bytedance/monoio/pull/105

    Full Changelog: https://github.com/bytedance/monoio/compare/0.0.7...0.0.8

    Source code(tar.gz)
    Source code(zip)
  • 0.0.7(Aug 25, 2022)

    What's Changed

    • remove dependency futures and update crate version by @ihciah in https://github.com/bytedance/monoio/pull/80
    • add docs for legacy driver mode by @ihciah in https://github.com/bytedance/monoio/pull/81
    • fix: replace RawBuf with IoVecWrapper for drop safe; impl SinkExt by @ihciah in https://github.com/bytedance/monoio/pull/84
    • fix: change type alias restriction to satisfy latest nightly by @ihciah in https://github.com/bytedance/monoio/pull/89
    • write stub code for pass compile on windows system by @LemonHX in https://github.com/bytedance/monoio/pull/88
    • improve: remove default box for op by @ihciah in https://github.com/bytedance/monoio/pull/92
    • chore: add rustfmt.toml & do fmt by @ihciah in https://github.com/bytedance/monoio/pull/93
    • replace lazy_static with LazyLock by @ihciah in https://github.com/bytedance/monoio/pull/94
    • fix: remove OsSocketAddr on connect by @ihciah in https://github.com/bytedance/monoio/pull/98
    • fix: remove libc::EFD_NONBLOCK from eventfd flags by @import-yuefeng in https://github.com/bytedance/monoio/pull/100
    • fix None eq warning by @ihciah in https://github.com/bytedance/monoio/pull/101

    New Contributors

    • @LemonHX made their first contribution in https://github.com/bytedance/monoio/pull/88
    • @import-yuefeng made their first contribution in https://github.com/bytedance/monoio/pull/100

    Full Changelog: https://github.com/bytedance/monoio/compare/0.0.6...0.0.7

    Source code(tar.gz)
    Source code(zip)
  • 0.0.6(Jun 13, 2022)

    In this release, we support better AsyncReadBuf, BufReader and BufWriter.

    Also, some useful utils are implemented, such as read_u8 and PrefixedIo.

    We also add a Sink trait(in GAT way) to make implementation easier with pure async and await.

    Source code(tar.gz)
    Source code(zip)
  • 0.0.5(May 31, 2022)

    This release includes many optimizations.

    Besides, this release supports legacy driver, which means it can be used on linux without io_uring and macOS.

    Also, there are self mut changes in AsyncReadRent and AsyncWriteRent.

    Source code(tar.gz)
    Source code(zip)
  • 0.0.4(Jan 26, 2022)

    Bug fix:

    • fix default slab size when sync feature is enabled
    • fix panic in Deref/DerefMut for Slice extending into uninitialized part of the buffer
    • fix stream_ext for latest nightly toolchain

    Features:

    • allow using shutdown to close connection write
    • add async buf read trait and BufReader
    • add File::read_exact_at and File::write_all_at
    • use tracing instead of eprintln as debug output
    • support UnixDatagram; allow split for unix stream
    • change IoBuf and IoBufMut pointer semantics
    • allow not Sized type for AsyncRentExts
    • implement io copy util
    • allow ReadHalf and WriteHalf reunite
    • update iobuf and iovec trait

    Thanks @18o @dragonly @pymongo @songzhi @ihciah and @dyxushuai for thier contributions!

    Source code(tar.gz)
    Source code(zip)
  • 0.0.3(Dec 2, 2021)

Owner
Bytedance Inc.
Bytedance Inc.
Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async

CDRS CDRS is looking for maintainers CDRS is Apache Cassandra driver written in pure Rust. ?? Looking for an async version? async-std https://github.c

Alex Pikalov 338 Jan 1, 2023
📺 Netflix in Rust/ React-TS/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Kafka, Redis, Tokio, Actix, Elasticsearch, Influxdb Iox, Tensorflow, AWS

Fullstack Movie Streaming Platform ?? Netflix in RUST/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Spark, Kafka, Redis,

null 34 Apr 17, 2023
An Async SDR Runtime for Heterogeneous Architectures

FutureSDR An experimental asynchronous SDR runtime for heterogeneous architectures that is: Extensible: custom buffers (supporting accelerators like G

FutureSDR 169 Jan 8, 2023
An async executor based on the Win32 thread pool API

wae An async executor based on the Win32 thread pool API use futures::channel::oneshot; #[wae::main] async fn main() { let (tx, rx) = oneshot::ch

Raphaël Thériault 10 Dec 10, 2021
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.

SQLx ?? The Rust SQL Toolkit Install | Usage | Docs Built with ❤️ by The LaunchBadge team SQLx is an async, pure Rust† SQL crate featuring compile-tim

launchbadge 7.6k Dec 31, 2022
TDS 7.2+ (mssql / Microsoft SQL Server) async driver for rust

Tiberius A native Microsoft SQL Server (TDS) client for Rust. Supported SQL Server versions Version Support level Notes 2019 Tested on CI 2017 Tested

Prisma 189 Dec 25, 2022
Simple, async embedded Rust

Cntrlr - Simple, asynchronous embedded Cntrlr is an all-in-one embedded platform for writing simple asynchronous applications on top of common hobbyis

Branan Riley 11 Jun 3, 2021
🐚 An async & dynamic ORM for Rust

SeaORM ?? An async & dynamic ORM for Rust SeaORM SeaORM is a relational ORM to help you build web services in Rust with the familiarity of dynamic lan

SeaQL 3.5k Jan 6, 2023
Quick Pool: High Performance Rust Async Resource Pool

Quick Pool High Performance Rust Async Resource Pool Usage DBCP Database Backend Adapter Version PostgreSQL tokio-postgres qp-postgres Example use asy

Seungjae Park 13 Aug 23, 2022
Dataloader-rs - Rust implementation of Facebook's DataLoader using async-await.

Dataloader Rust implementation of Facebook's DataLoader using async-await. Documentation Features Batching load requests with caching Batching load re

cksac 229 Nov 27, 2022
High-level async Cassandra client written in 100% Rust.

CDRS tokio CDRS is production-ready Apache Cassandra driver written in pure Rust. Focuses on providing high level of configurability to suit most use

Kamil Rojewski 73 Dec 26, 2022
Automatically deleted async I/O temporary files in Rust

async-tempfile Provides the TempFile struct, an asynchronous wrapper based on tokio::fs for temporary files that will be automatically deleted when th

Markus Mayer 3 Jan 4, 2023
Go like sync.WaitGroup implementation in Rust. (sync/async)

WAG Go like sync.WaitGroup implementation in Rust. (sync/async) | Examples | Docs | Latest Note | wag = "0.3.0" How to use, use wag::WaitGroup; let w

Doha Lee 2 Dec 15, 2022
An async Rust client for SurrealDB's RPC endpoint

An async Rust client for SurrealDB's RPC endpoint This crate serves as a temporary yet complete implementation of an async Rust client to connect to a

Thibault H 12 Jan 21, 2023
An async-ready Phoenix Channels v2 client library in Rust

Phoenix Channels This crate implements a Phoenix Channels (v2) client in Rust. Status NOTE: This client is still a work-in-progress, though it has eno

LiveView Native 22 Jan 7, 2023
Notification demon + web server using async Rust

Async Rust example Road to the asynchronous Rust Table of Contents About the Project Screenshots Tech Stack Features Getting Started Prerequisites Clo

Edem Khadiev 4 Feb 9, 2023
Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe

redi-rs (or redirs) redi-rs is a Lightweight Redis client with connection pooling written in Rust and 100% memory safe redi-rs is a Redis client writt

Oğuz Türkay 4 May 20, 2023
Async positioned I/O with io_uring.

uring-positioned-io Fully asynchronized positioned I/O with io_uring. Basic Usage let files = vec![File::open("test.txt").unwrap()]; let context = Uri

Alex Chi 30 Aug 24, 2022
Macros that allow for implicit await in your async code.

suspend fn Disclaimer: this was mostly made as a proof of concept for the proposal below. I haven't tested if there is a performance cost to this macr

null 6 Dec 22, 2021