mplex

What is mplex?

mplex is a simple stream multiplexer that was designed in the early days of libp2p. It is a simple protocol that does not provide many features offered by other stream multiplexers. Notably, mplex does not provide flow control, a feature which is now considered critical for a stream multiplexer.

mplex runs over a reliable, ordered pipe between two peers, such as a TCP connection. Peers can open, write to, close, and reset a stream. mplex uses a message-based framing layer like yamux, enabling it to multiplex different data streams, including stream-oriented data and other types of messages.

Drawbacks

mplex is currently in the process of being deprecated (to track progress please see this issue). mplex does not have any flow control.

Backpressure is a mechanism to prevent one peer from overwhelming a slow time consuming the data.

mplex also doesn’t limit how many streams a peer can open.

Top