关于「页面是最大值:次序统计量与最后几片叶子」,《扇出尾延迟与对冲请求》给出的定量结论是什么?

结论:第二章把页面写成最大值,并用实测表检验独立性:独立模型预测「百分之九十五叶节点返回」与「全部返回」的时刻之比为 0.087,实测为 0.500。

数据口径:书中服务时间、慢请求比例与成本均为示意参数;全部计算由书中程序生成;本书属于非个人化经营建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.087, 0.500

leaf lognormal sigma0.9898
one leaf p50/p95/p99 (ms)1.00 5.09 10.00
N rows (99th pct, ms)95% of leaves all leaves
1007.94 39.64
10005.92 68.05
50005.45 95.89
measured Table 1 (99th pct)95% = 70 ms, all = 140 ms
independent ratio 95%/all at N1000: 0.087
measured ratio 70/1400.500
查看完整验算程序
# Chapter 2. p22: time for k of N leaves to finish, independent leaves.
# Model: P(T_(k) <= t) = P(Binomial(N, F(t)) >= k). The leaf law is a
# lognormal fitted to the single-leaf row of Dean and Barroso (2013,
# Table 1): median 1 ms and 99th percentile 10 ms, so sigma = ln 10 /
# z(0.99). The independent prediction for "95% of leaves" and "all
# leaves" is set against the measured 70 ms and 140 ms (99th pct).
import math

Z99 = 2.3263478740408408
SIG = math.log(10.0) / Z99


def leaf_cdf(t):
    if t <= 0.0:
        return 0.0
    return 0.5 * (1.0 + math.erf(math.log(t) / (SIG * math.sqrt(2.0))))


def binom_tail(n, k, x):
    # P(Binomial(n, x) >= k) with log-space terms and math.fsum
    if x <= 0.0:
        return 0.0 if k > 0 else 1.0
    if x >= 1.0:
        return 1.0
    lx, ly = math.log(x), math.log1p(-x)
    terms = []
    for j in range(k, n + 1):
        lc = math.lgamma(n + 1) - math.lgamma(j + 1) - math.lgamma(n - j + 1)
        terms.append(math.exp(lc + j * lx + (n - j) * ly))
    return math.fsum(terms)


def kth_q(q, n, k):
    lo, hi = 1e-6, 1e6
    for _ in range(200):
        mid = math.sqrt(lo * hi)
        if binom_tail(n, k, leaf_cdf(mid)) < q:
            lo = mid
        else:
            hi = mid
    return hi


if __name__ == "__main__":
    print("leaf lognormal sigma = {:.4f}".format(SIG))
    print("one leaf p50/p95/p99 (ms): {:.2f} {:.2f} {:.2f}".format(
        kth_q(0.5, 1, 1), kth_q(0.95, 1, 1), kth_q(0.99, 1, 1)))
    print("     N  rows (99th pct, ms): 95% of leaves   all leaves")
    for n in (100, 1000, 5000):
        k95 = math.ceil(0.95 * n)
        print("  {:5d}                    {:10.2f}   {:10.2f}".format(
            n, kth_q(0.99, n, k95), kth_q(0.99, n, n)))
    print("measured Table 1 (99th pct): 95% = 70 ms, all = 140 ms")
    r = kth_q(0.99, 1000, 950) / kth_q(0.99, 1000, 1000)
    print("independent ratio 95%/all at N=1000: {:.3f}".format(r))
    print("measured ratio 70/140: {:.3f}".format(70 / 140))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《扇出尾延迟乘法律与对冲请求、单页多调用时百分位延迟的放大母典》第 2 章「页面是最大值:次序统计量与最后几片叶子」(版本 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}
}

本书其他章节结论