关于「对冲请求:在第九十五百分位补发一份」,《扇出尾延迟与对冲请求》给出的定量结论是什么?
结论:第四章讲对冲请求:在单调用第九十五百分位补发一份,额外请求为 0.0500,页面超时概率降到 0.0100;若慢来自请求本身,对冲失效。
数据口径:书中服务时间、慢请求比例与成本均为示意参数;全部计算由书中程序生成;本书属于非个人化经营建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.0100, 0.0500, 95
| hedge delay d = leaf p95 | 11.63 ms |
| extra requests S(d) | 0.0500 |
| percentile no hedge (ms) hedged (ms) | |
| 50 | 4.1 4.1 |
| 95 | 11.6 11.6 |
| 98 | 15.8 14.4 |
| 99.5 | 1346.6 17.2 |
| 99.9 | 2151.3 21.3 |
| P(call > 1000 ms) | 0.010000 -> 0.000100 |
| P(page of 100 > 1000 ms), no hedge | 0.6340 |
| P(page of 100 > 1000 ms), hedged | 0.0100 |
查看完整验算程序
# Chapter 4. p41: a hedged request fired at the 95th percentile.
# Leaf law (illustrative, as p13): 0.99 fast 2 ms + Exp(3 ms), 0.01 slow
# 1000 ms + Exp(500 ms). Hedge: if the first copy has not answered by d,
# send a second copy to another replica and keep the first answer:
# T = min(X1, d + X2), P(T > t) = S(t) S(t - d) for t >= d,
# with independent replicas. Extra requests = S(d). Page of N = 100.
import math
P_SLOW, FA, FM, SA, SM = 0.01, 2.0, 3.0, 1000.0, 500.0
def sf_exp(t, a, m):
return 1.0 if t < a else math.exp(-(t - a) / m)
def sf(t):
return (1.0 - P_SLOW) * sf_exp(t, FA, FM) + P_SLOW * sf_exp(t, SA, SM)
def sf_hedge(t, d):
return sf(t) if t < d else sf(t) * sf(t - d)
def quantile(surv, q):
lo, hi = 0.0, 50000.0
for _ in range(100):
mid = 0.5 * (lo + hi)
if surv(mid) >= 1.0 - q:
lo = mid
else:
hi = mid
return hi
if __name__ == "__main__":
d = quantile(sf, 0.95)
print("hedge delay d = leaf p95 = {:.2f} ms".format(d))
print("extra requests S(d) = {:.4f}".format(sf(d)))
print("percentile no hedge (ms) hedged (ms)")
for q, lab in ((0.5, "50"), (0.95, "95"), (0.98, "98"),
(0.995, "99.5"), (0.999, "99.9")):
print(" {:<6} {:10.1f} {:10.1f}".format(
lab, quantile(sf, q), quantile(lambda t: sf_hedge(t, d), q)))
s0, s1 = sf(1000.0), sf_hedge(1000.0, d)
print("P(call > 1000 ms): {:.6f} -> {:.6f}".format(s0, s1))
for lab, s in (("no hedge", s0), ("hedged ", s1)):
pg = -math.expm1(100 * math.log1p(-s))
print("P(page of 100 > 1000 ms), {}: {:.4f}".format(lab, pg))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《扇出尾延迟乘法律与对冲请求、单页多调用时百分位延迟的放大母典》第 4 章「对冲请求:在第九十五百分位补发一份」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-326 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026326,
author = {Fan, Yafu},
title = {The Multiplicative Law of Fan-Out Tail Latency and Hedged Requests: How Percentile Latency Amplifies When One Page Makes Many Calls},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}