this is a very specific question about multiplexing protocol selection.
h2mux, smux, and yamux are all application-layer multiplexing protocols,
but they have very different design philosophies, performance characteristics,
and suitable use cases.

I will compare them across multiple dimensions and provide a final selection
recommendation.

Core Feature Comparison Table

Feature Dimension h2mux (HTTP/2 based) yamux smux
Protocol Basis Full HTTP/2 protocol stack Simple custom framing protocol Minimalist custom framing protocol
Design Goal Strong Obfuscation, Feature-rich Balance of Features & Performance, Versatility Extreme Lightweight, Low Overhead
Header Overhead High (HPACK compression, but complex frame headers) Medium (16-byte frame header) Very Low (a few bytes)
Flow Control Sophisticated, per-stream windowing Simple connection-level window control None or very basic
Head-of-Line Blocking Present (runs over TCP) Present (runs over TCP) Present (runs over TCP)
CPU/Memory Overhead High Medium Very Low
Primary Advantage Indistinguishable from HTTPS traffic, strong anti-censorship Well-rounded, good balance, widely adopted Ultimate performance, lowest latency, minimal resource usage
Primary Disadvantage Protocol heavyweight, high overhead, has HoL blocking Not as fast as smux, not as stealthy as h2mux Feature-sparse, lacks advanced features

In-Depth Analysis

1. h2mux (HTTP/2 based)

  • What is it? It’s not just multiplexing; it completely disguises all your

data streams as a standard HTTP/2 session.

  • What’s good about it?

    • Ultimate Stealth: This is its one and most important reason for existence. To network censors, your traffic looks exactly like traffic visiting Google or YouTube. Deep Packet Inspection finds it extremely difficult to distinguish from normal web traffic, and blocking it risks massive collateral damage.
  • What’s bad about it?

    • Performance Cost: To achieve perfect camouflage, it carries the entire burden of the HTTP/2 protocol, including header compression, stream prioritization, server push, etc., resulting in the highest CPU and memory overhead of the three.
    • Protocol Heavyweight: Less flexible than the other two.

2. yamux (Yet another Multiplexer)

  • What is it? A well-designed, general-purpose multiplexing protocol aimed

at balancing features and performance. It’s widely used in many well-known
projects.

  • What’s good about it?

    • Feature Complete: Provides necessary mechanisms like flow control, preventing a single stream from exhausting all resources and enhancing connection stability.
    • Good Balance: Maintains relatively simple design while offering sufficient features, with performance and resource overhead in the middle range.
    • Wide Support: Good ecosystem, built-in or optionally supported in many open-source projects.
  • What’s bad about it?

    • Lacks a Standout Strength: It’s neither as stealthy as h2mux nor as extremely fast as smux. In non-adversarial environments, it might be replaced by the lighter smux.

3. smux (Simple Multiplexing)

  • What is it? A multiplexing protocol that pursues **extreme simplicity and

minimal overhead**. Its goal is to do only multiplexing and do it the fastest.

  • What’s good about it?

    • Ultimate Performance: The protocol header overhead is minimal, and encoding/decoding is very simple, resulting in the lowest latency and highest throughput. CPU and memory usage are also the lowest of the three.
    • Ideal for Internal Networks or Trusted Environments: When you don’t care about traffic obfuscation and only pursue raw performance, it’s an excellent choice.
  • What’s bad about it?

    • Feature Sparse: Often lacks advanced features like fine-grained flow control.
    • No Obfuscation: Has distinct traffic characteristics, making it easy to identify and block in monitored networks.

Summary and Final Selection Guide

The choice depends entirely on your primary objective.

Your Primary Requirement Recommended Choice Reason
Fighting network censorship/blocking, prioritizing stealth 🥇 h2mux Its strong obfuscation capability is unmatched by the others. The performance cost is worth paying for survival.
Pursuing ultimate performance, low latency, low overhead (Internal/Trusted Network) 🥇 smux When you don’t need stealth, it’s the fastest. Low resource usage, high speed.
Needing a balance of features and performance, general reliability 🥇 yamux If you are unsure or need a “default” reliable choice, yamux is usually safe. It provides key features like flow control, ensuring connection robustness.
Using the general internet, wanting some anti-interference capability 🥈 yamux While not completely stealthy like h2mux, its custom protocol is still harder to simply identify and interfere with than raw TCP.

A Figurative Analogy:

  • h2mux is like a Spy: Perfectly disguised as an ordinary citizen in the

target city, with flawless speech and behavior, but requires significant extra
effort to maintain this identity.

  • yamux is like a Regular Army Soldier: Well-equipped, well-trained,

with comprehensive tactical proficiency, capable of stable operation in various
environments.

  • smux is like a Special Forces Operative: Travels light, moves swiftly,

specializes in penetration and elimination, unparalleled in specific missions,
but lacks heavy firepower and comprehensive support.

Final Recommendation:

  1. First, consider the environment: Is your network facing censorship? If
    yes, choose h2mux without hesitation.
  2. Then, consider performance: If the network is free, and you just want to
    maximize bandwidth and reduce gaming latency, then choose smux.
  3. Indecisive/Uncertain: If you are unsure, or need a feature-complete,
    stable, and reliable default option, then choose yamux. It’s a “good enough”
    choice in most situations.