From 10310590596f96aeb7bc2a6d1ca9fd266f84290a Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Wed, 7 Dec 2022 04:49:25 -0500 Subject: [PATCH 1/9] add short desc. for yamux --- content/concepts/multiplex/yamux.md | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index 6b6cd9c5..77e57b8c 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -1,15 +1,22 @@ --- -title: "yamux" +title: "Yamux" description: "yamux is a multiplexing protocol designed by Hashicorp." weight: 180 --- -[yamux](https://github.com/hashicorp/yamux) is a multiplexing protocol designed by [Hashicorp](https://www.hashicorp.com/). -yamux offers more sophisticated flow control than mplex, and can scale to thousands of multiplexed streams over a -single connection. +## What is Yamux? -{{< alert icon="💡" context="note">}} -This section is incomplete, and many of the articles are stubs. To help fill in -the gaps, please see the issues linked in each article to add your input and -help us prioritize the outstanding work. -{{< /alert >}} +[Yamux](https://github.com/hashicorp/yamux) is a multiplexing protocol designed +by [Hashicorp](https://www.hashicorp.com/) for Go. It is built over +[SCTP (Stream Control Transmission Protocol)](https://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol), which is a transport layer protocol +that provides reliable, message-oriented communication with congestion control. +Yamux provides a high-level interface for working with SCTP streams. It is inspired +by [SPDY](https://en.wikipedia.org/wiki/SPDY), but is not interoperable with it. + +Yamux offers more sophisticated flow control than [mplex](mplex), and can scale +to thousands of multiplexed streams over a single connection. + +### Resources + +- [Yamux overview and a list of features](https://github.com/hashicorp/yamux#yamux). +- [Technical specification](https://github.com/hashicorp/yamux/blob/master/spec.md). From 4bab3f0a9a989338cc14e57a3583d81309cec306 Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Mon, 12 Dec 2022 07:32:04 -0500 Subject: [PATCH 2/9] incorporate feedback, add backpressure info --- content/concepts/multiplex/yamux.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index 77e57b8c..6b35189f 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -7,14 +7,21 @@ weight: 180 ## What is Yamux? [Yamux](https://github.com/hashicorp/yamux) is a multiplexing protocol designed -by [Hashicorp](https://www.hashicorp.com/) for Go. It is built over -[SCTP (Stream Control Transmission Protocol)](https://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol), which is a transport layer protocol -that provides reliable, message-oriented communication with congestion control. +by [Hashicorp](https://www.hashicorp.com/) for Go, built over TCP. Yamux provides a high-level interface for working with SCTP streams. It is inspired -by [SPDY](https://en.wikipedia.org/wiki/SPDY), but is not interoperable with it. +by [SPDY](https://en.wikipedia.org/wiki/SPDY), but it is not interoperable with it. -Yamux offers more sophisticated flow control than [mplex](mplex), and can scale -to thousands of multiplexed streams over a single connection. +Yamux offers more sophisticated flow control than [mplex](mplex) while also supporting +backpressure, which is a mechanism that helps to prevent data from being sent faster +then it can be processed. + +Backpressure allows the receiver of a data stream to specify an offset +to which the sender can send data. This offset increases as the receiver process the data, +allowing the sender to send more data. This helps prevent the +sender from sending more data than the receiver can handle, leading to buffering +and potentially causing the application to crash. This is especially important in +applications where the receiver might be slower at processing the data, such as when the +receiver is a low-powered device or when the data is complex and requires a lot of processing. ### Resources From 9ca41166880f41beb9b01878f8a6a73394adf3f2 Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Mon, 12 Dec 2022 07:38:26 -0500 Subject: [PATCH 3/9] add note on yamux perference in libp2p --- content/concepts/multiplex/yamux.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index 6b35189f..7a6c6708 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -23,6 +23,11 @@ and potentially causing the application to crash. This is especially important i applications where the receiver might be slower at processing the data, such as when the receiver is a low-powered device or when the data is complex and requires a lot of processing. +{{< alert icon="💡" context="note">}} +**Yamux should be used over mplex in libp2p**. It is well-suited for applications that require fast, +reliable data transfer, such as real-time communication or streaming media as it is optimized for low-latency, high-bandwidth environments. +{{< /alert >}} + ### Resources - [Yamux overview and a list of features](https://github.com/hashicorp/yamux#yamux). From cc7a8d239e95350b75391cb3903fc084d6b2a2de Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Mon, 12 Dec 2022 17:44:07 -0500 Subject: [PATCH 4/9] incorporate pr feedback --- content/concepts/multiplex/yamux.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index 7a6c6708..bdd2b30d 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -6,26 +6,26 @@ weight: 180 ## What is Yamux? -[Yamux](https://github.com/hashicorp/yamux) is a multiplexing protocol designed -by [Hashicorp](https://www.hashicorp.com/) for Go, built over TCP. -Yamux provides a high-level interface for working with SCTP streams. It is inspired +[Yamux](https://github.com/hashicorp/yamux) (Yet another Multiplexer) is a multiplexing +protocol initially designed by [Hashicorp](https://www.hashicorp.com/) for Go, built over +TCP. Yamux provides a high-level interface inspired by [SPDY](https://en.wikipedia.org/wiki/SPDY), but it is not interoperable with it. -Yamux offers more sophisticated flow control than [mplex](mplex) while also supporting -backpressure, which is a mechanism that helps to prevent data from being sent faster -then it can be processed. +Yamux supports flow control through backpressure, which is a mechanism that helps to +prevent data from being sent faster than it can be processed. -Backpressure allows the receiver of a data stream to specify an offset -to which the sender can send data. This offset increases as the receiver process the data, -allowing the sender to send more data. This helps prevent the +One way to achieve backpressure is for the receiver to specify an offset +to which the sender can send data. This offset increases as the receiver process +the data, allowing the sender to send more data. This helps prevent the sender from sending more data than the receiver can handle, leading to buffering and potentially causing the application to crash. This is especially important in -applications where the receiver might be slower at processing the data, such as when the -receiver is a low-powered device or when the data is complex and requires a lot of processing. +applications where the receiver might be slower at processing the data, such as when +the receiver is a low-powered device or when the data is complex and requires a lot of +processing. {{< alert icon="💡" context="note">}} -**Yamux should be used over mplex in libp2p**. It is well-suited for applications that require fast, -reliable data transfer, such as real-time communication or streaming media as it is optimized for low-latency, high-bandwidth environments. +**Yamux should be used over mplex in libp2p**. It is well-suited for applications that require +fast, reliable data transfer as it is optimized for low-latency, high-bandwidth environments. {{< /alert >}} ### Resources From e3cd3417d3e66cf4f5552ce3198b2bf706d191f1 Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Mon, 12 Dec 2022 18:22:29 -0500 Subject: [PATCH 5/9] edit --- content/concepts/multiplex/yamux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index bdd2b30d..ee834270 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -23,7 +23,7 @@ applications where the receiver might be slower at processing the data, such as the receiver is a low-powered device or when the data is complex and requires a lot of processing. -{{< alert icon="💡" context="note">}} +{{< alert icon="" context="">}} **Yamux should be used over mplex in libp2p**. It is well-suited for applications that require fast, reliable data transfer as it is optimized for low-latency, high-bandwidth environments. {{< /alert >}} From 4bf22813fc6cd4ce841f18166f79a1249e578ea7 Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Wed, 11 Jan 2023 20:22:27 -0500 Subject: [PATCH 6/9] Apply suggestions from code review Co-authored-by: Marten Seemann --- content/concepts/multiplex/yamux.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index ee834270..cf6ae3d5 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -15,7 +15,7 @@ Yamux supports flow control through backpressure, which is a mechanism that help prevent data from being sent faster than it can be processed. One way to achieve backpressure is for the receiver to specify an offset -to which the sender can send data. This offset increases as the receiver process +to which the sender can send data. This offset increases as the receiver consumes the data, allowing the sender to send more data. This helps prevent the sender from sending more data than the receiver can handle, leading to buffering and potentially causing the application to crash. This is especially important in @@ -24,8 +24,7 @@ the receiver is a low-powered device or when the data is complex and requires a processing. {{< alert icon="" context="">}} -**Yamux should be used over mplex in libp2p**. It is well-suited for applications that require -fast, reliable data transfer as it is optimized for low-latency, high-bandwidth environments. +**Yamux should be used over mplex in libp2p**, as mplex doesn't provide a mechanism to apply backpressure on the stream level. {{< /alert >}} ### Resources From 8abb6071046680d3c8d8f26d18bfdc50fd47b1ab Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Tue, 24 Jan 2023 06:38:34 -0500 Subject: [PATCH 7/9] Apply suggestions from code review Co-authored-by: Marten Seemann --- content/concepts/multiplex/yamux.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index cf6ae3d5..501f0f77 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -17,8 +17,7 @@ prevent data from being sent faster than it can be processed. One way to achieve backpressure is for the receiver to specify an offset to which the sender can send data. This offset increases as the receiver consumes the data, allowing the sender to send more data. This helps prevent the -sender from sending more data than the receiver can handle, leading to buffering -and potentially causing the application to crash. This is especially important in +sender from sending data faster than the receiver process it. This is especially important in applications where the receiver might be slower at processing the data, such as when the receiver is a low-powered device or when the data is complex and requires a lot of processing. From 643faf693160fdf5d8df821925af1b2408bb4c8c Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Tue, 24 Jan 2023 06:44:36 -0500 Subject: [PATCH 8/9] incorporate PR feedback + edits --- content/concepts/multiplex/yamux.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index 501f0f77..3b15e763 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -6,21 +6,21 @@ weight: 180 ## What is Yamux? -[Yamux](https://github.com/hashicorp/yamux) (Yet another Multiplexer) is a multiplexing -protocol initially designed by [Hashicorp](https://www.hashicorp.com/) for Go, built over -TCP. Yamux provides a high-level interface inspired -by [SPDY](https://en.wikipedia.org/wiki/SPDY), but it is not interoperable with it. +[Yamux](https://github.com/hashicorp/yamux) (Yet another Multiplexer) +is a powerful stream multiplexer used in libp2p. It was +developed by Hashicorp for Go and built on top of TCP. Yamux +enables multiple parallel streams on a single TCP connection +and provides a high-level interface similar to SPDY, however +it is not compatible with it. -Yamux supports flow control through backpressure, which is a mechanism that helps to -prevent data from being sent faster than it can be processed. - -One way to achieve backpressure is for the receiver to specify an offset -to which the sender can send data. This offset increases as the receiver consumes -the data, allowing the sender to send more data. This helps prevent the -sender from sending data faster than the receiver process it. This is especially important in -applications where the receiver might be slower at processing the data, such as when -the receiver is a low-powered device or when the data is complex and requires a lot of -processing. +One of the key features of Yamux is its support for flow control +through backpressure. This mechanism helps to prevent data from +being sent faster than it can be processed. It allows +the receiver to specify an offset to which the sender can send +data, which increases as the receiver processes the data. +This helps prevent the sender from overwhelming the receiver, +especially when the receiver has limited resources or needs to +process complex data. {{< alert icon="" context="">}} **Yamux should be used over mplex in libp2p**, as mplex doesn't provide a mechanism to apply backpressure on the stream level. From 2536a9a293cf8cc81d24d203210c92300a1ac7c6 Mon Sep 17 00:00:00 2001 From: Danny Salman Date: Tue, 31 Jan 2023 08:29:50 -0500 Subject: [PATCH 9/9] Apply suggestions from code review Co-authored-by: Marten Seemann --- content/concepts/multiplex/yamux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/concepts/multiplex/yamux.md b/content/concepts/multiplex/yamux.md index 3b15e763..6da20a85 100644 --- a/content/concepts/multiplex/yamux.md +++ b/content/concepts/multiplex/yamux.md @@ -8,9 +8,9 @@ weight: 180 [Yamux](https://github.com/hashicorp/yamux) (Yet another Multiplexer) is a powerful stream multiplexer used in libp2p. It was -developed by Hashicorp for Go and built on top of TCP. Yamux -enables multiple parallel streams on a single TCP connection -and provides a high-level interface similar to SPDY, however +initially developed by Hashicorp for Go, and is now implemented in Rust, JavaScript and other languages. +enables multiple parallel streams on a single TCP connection. +The design was inspired by SPDY (which later became the basis for HTTP/2), however it is not compatible with it. One of the key features of Yamux is its support for flow control