Skip to content

add: yamux #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions content/concepts/multiplex/yamux.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
---
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.
[Yamux](https://github.com/hashicorp/yamux) (Yet another Multiplexer)
is a powerful stream multiplexer used in libp2p. It was
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
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.
{{< /alert >}}

### 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).