公平性的不可能三角
公平性是一个伪命题。不是因为它不重要,而是因为它根本不可实现。
#mermaid-svg-s7ZzeIKecKUEPAiw{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-s7ZzeIKecKUEPAiw .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-s7ZzeIKecKUEPAiw .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-s7ZzeIKecKUEPAiw .error-icon{fill:#552222;}#mermaid-svg-s7ZzeIKecKUEPAiw .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-s7ZzeIKecKUEPAiw .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-s7ZzeIKecKUEPAiw .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-s7ZzeIKecKUEPAiw .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-s7ZzeIKecKUEPAiw .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-s7ZzeIKecKUEPAiw .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-s7ZzeIKecKUEPAiw .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-s7ZzeIKecKUEPAiw .marker{fill:#333333;stroke:#333333;}#mermaid-svg-s7ZzeIKecKUEPAiw .marker.cross{stroke:#333333;}#mermaid-svg-s7ZzeIKecKUEPAiw svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-s7ZzeIKecKUEPAiw p{margin:0;}#mermaid-svg-s7ZzeIKecKUEPAiw .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-s7ZzeIKecKUEPAiw .cluster-label text{fill:#333;}#mermaid-svg-s7ZzeIKecKUEPAiw .cluster-label span{color:#333;}#mermaid-svg-s7ZzeIKecKUEPAiw .cluster-label span p{background-color:transparent;}#mermaid-svg-s7ZzeIKecKUEPAiw .label text,#mermaid-svg-s7ZzeIKecKUEPAiw span{fill:#333;color:#333;}#mermaid-svg-s7ZzeIKecKUEPAiw .node rect,#mermaid-svg-s7ZzeIKecKUEPAiw .node circle,#mermaid-svg-s7ZzeIKecKUEPAiw .node ellipse,#mermaid-svg-s7ZzeIKecKUEPAiw .node polygon,#mermaid-svg-s7ZzeIKecKUEPAiw .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-s7ZzeIKecKUEPAiw .rough-node .label text,#mermaid-svg-s7ZzeIKecKUEPAiw .node .label text,#mermaid-svg-s7ZzeIKecKUEPAiw .image-shape .label,#mermaid-svg-s7ZzeIKecKUEPAiw .icon-shape .label{text-anchor:middle;}#mermaid-svg-s7ZzeIKecKUEPAiw .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-s7ZzeIKecKUEPAiw .rough-node .label,#mermaid-svg-s7ZzeIKecKUEPAiw .node .label,#mermaid-svg-s7ZzeIKecKUEPAiw .image-shape .label,#mermaid-svg-s7ZzeIKecKUEPAiw .icon-shape .label{text-align:center;}#mermaid-svg-s7ZzeIKecKUEPAiw .node.clickable{cursor:pointer;}#mermaid-svg-s7ZzeIKecKUEPAiw .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-s7ZzeIKecKUEPAiw .arrowheadPath{fill:#333333;}#mermaid-svg-s7ZzeIKecKUEPAiw .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-s7ZzeIKecKUEPAiw .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-s7ZzeIKecKUEPAiw .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-s7ZzeIKecKUEPAiw .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-s7ZzeIKecKUEPAiw .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-s7ZzeIKecKUEPAiw .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-s7ZzeIKecKUEPAiw .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-s7ZzeIKecKUEPAiw .cluster text{fill:#333;}#mermaid-svg-s7ZzeIKecKUEPAiw .cluster span{color:#333;}#mermaid-svg-s7ZzeIKecKUEPAiw div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-s7ZzeIKecKUEPAiw .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-s7ZzeIKecKUEPAiw rect.text{fill:none;stroke-width:0;}#mermaid-svg-s7ZzeIKecKUEPAiw .icon-shape,#mermaid-svg-s7ZzeIKecKUEPAiw .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-s7ZzeIKecKUEPAiw .icon-shape p,#mermaid-svg-s7ZzeIKecKUEPAiw .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-s7ZzeIKecKUEPAiw .icon-shape .label rect,#mermaid-svg-s7ZzeIKecKUEPAiw .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-s7ZzeIKecKUEPAiw .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-s7ZzeIKecKUEPAiw .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-s7ZzeIKecKUEPAiw :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 不可能三角
测量公平
无法获得完整状态
定义公平
没有统一标准
执行公平
被动滞后不可控
你无法测量公平
拥塞控制的所有决策都基于观测。但观测永远是滞后的、有噪声的、不完整的。
- 你看到 RTT 增加了,但你看不到是哪个交换机在排队。
- 你看到丢包了,但你看不到是路由抖动还是缓存不足。
- 你看到其他流在抢带宽,但你看不到它们来自哪里、要去哪里。
没有这些信息,你凭什么说"这很公平"?
你无法定义公平
公平是对称性的想象。现实中没有对称。
- 两条流:一条 RTT 10ms,一条 RTT 100ms。平分带宽算公平吗?长 RTT 的流吞吐天然吃亏。
- 一条流跑大文件,一条流跑网页。平分带宽算公平吗?网页流需要低延迟,大文件流需要高吞吐。
- 一个用户连 Wi-Fi,一个用户连 5G。平分带宽算公平吗?物理链路本身的容量就不一样。
网络不是数学题。没有标准答案。
你无法执行公平
即使你规定了"理想分配比例",你也做不到精准执行。因为拥塞控制是被动的:
- 你先发,收到反馈再调。
- 等你调完,网络已经变了。
- 你永远在追一个移动的目标。
这就是为什么所有"公平性改进"最后都变成了"差不多就行"。
真实世界的变量太多
每一条流的路径都不相同。沿途经过的路由器、交换机、机房出口、物理链路、CPU 调度、网卡中断、甚至温度都会影响它的 RTT 和丢包率。
一条从香港到成都的流,和一条从香港到纽约的流,它们之间不存在"公平"的基础。强行让它们平分带宽,只是把不公平从一端转移到了另一端。
我们能做到的极限
承认吧:我们做不到全知,也做不到全能。
我们能做的只是:
- 尽量不让任何一条流被饿死。
- 尽量不让队列无限堆积。
- 尽量让大多数人在大多数时候觉得"还行"。
这就是"相对公平"。它不是数学上的解,而是工程上的妥协。
所以
别再谈"实现公平"了。我们连"测量公平"都做不到。我们能做的,只是承认自己的局限,然后在有限的观测里,做出不那么坏的决策。
这是拥塞控制的真相。也是人类的局限。