tokio-stream-multiplexor

Crates.iotokio-stream-multiplexor
lib.rstokio-stream-multiplexor
version0.5.6
sourcesrc
created_at2021-11-21 15:31:07.768787
updated_at2021-11-26 14:58:01.750734
descriptionStream Multiplexor for tokio with a tcp like interface
homepage
repositoryhttps://github.com/GothAck/tokio-stream-multiplexor
max_upload_size
id485337
size89,176
Greg "GothAck" Miell (GothAck)

documentation

https://docs.rs/tokio-stream-multiplexor

README

Build Status Rust Crates.io Crates.io docs.rs

Tokio Stream Multiplexor

TL;DR: Multiplex multiple streams over a single stream. Has a TcpListener / TcpSocket style interface, and uses u16 ports similar to TCP itself.

[dependencies]
foo = "1.2.3"

Why?

Because sometimes you wanna cram as much shite down one TCP stream as you possibly can, rather than have your application connect with multiple ports.

But Whyyyyyy?

Because I needed it. Inspired by async-smux, written for Tokio.

What about performance?

Doesn't this whole protocol in a protocol thing hurt perf?

Sure, but take a look at the benches:

throughput/tcp          time:   [28.968 ms 30.460 ms 31.744 ms]
                        thrpt:  [7.8755 GiB/s 8.2076 GiB/s 8.6303 GiB/s]

throughput/mux          time:   [122.24 ms 135.96 ms 158.80 ms]
                        thrpt:  [1.5743 GiB/s 1.8388 GiB/s 2.0451 GiB/s]

Approximately 4.5 times slower than TCP, but still able to shovel 1.8 GiB/s of shite... Seems alright to me. (Numbers could possibly be improved with some tuning of the config params too.)

Commit count: 53

cargo fmt