关于「流量分配、升级独立域名与现金储备」,《零人工站群、支付防欺诈与现金流排队》给出的定量结论是什么?

结论:第六章用汤普森抽样分配流量(与理想只差 470.0 次转化),给出升级独立域名的后验停止规则,并显示订单减半三个月的冲击需要 90,000 的现金储备。

数据口径:第四章用排队论与模拟显示,突发到达把单个工作进程的 T99 推到数十秒;平均负载 0.80 时,突发需要 4 个工作进程,或 3 个加限流(拒绝 0.0005 的请求)。 书中以标注框区分证据、16 段可运行的 Python 程序、史料与假说。

English version

对照数据表

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

   ideal (best site only): 9905.2 conversions
   policy     conversions   regret   share to top 3
   uniform         3473.4   6431.9            0.100
   thompson        9435.2    470.0            0.911
Reading: Thompson sampling moves most paid traffic to the
few sites that convert best and recovers most of the gap
to the ideal; uniform splitting wastes it on sites whose low
rate was obvious within days.
查看完整验算程序
# Chapter 6. [p11] Thompson sampling of paid traffic across 30 sites.
# Thirty sites on the shared kernel convert visitors with unknown rates
# p_i drawn once from Beta(2, 98) (mean 2%). A daily budget of 3,000
# paid visitors is split across them for 60 days. UNIFORM gives each
# site 100 a day; THOMPSON (in daily batches) draws 200 samples from
# every site's Beta(1 + conversions, 1 + misses) posterior and gives
# each site the share of draws in which it came out best.
# 50 replications with fixed seeds. Reported: conversions per run,
# regret against always using the best site, and the share of traffic
# that went to the three best sites.
import random

SITES, DAILY, DAYS, REPS, DRAWS = 30, 3000, 60, 50, 200

def run(rng, rates, policy):
    conv = [0] * SITES
    miss = [0] * SITES
    sent = [0] * SITES
    for _ in range(DAYS):
        if policy == "uniform":
            alloc = [DAILY // SITES] * SITES
        else:
            wins = [0] * SITES
            for _ in range(DRAWS):
                d = [rng.betavariate(1 + conv[k], 1 + miss[k])
                     for k in range(SITES)]
                wins[d.index(max(d))] += 1
            alloc = [DAILY * w // DRAWS for w in wins]
        for i, n in enumerate(alloc):
            c = sum(rng.random() < rates[i] for _ in range(n))
            sent[i] += n
            conv[i] += c
            miss[i] += n - c
    top = sorted(range(SITES), key=lambda k: -rates[k])[:3]
    return sum(conv), sum(sent[k] for k in top) / sum(sent)

if __name__ == "__main__":
    out = {"uniform": [], "thompson": []}
    best = []
    for r in range(REPS):
        rng = random.Random(75011 + r)
        rates = [rng.betavariate(2, 98) for _ in range(SITES)]
        best.append(max(rates) * DAILY * DAYS)
        for pol in out:
            out[pol].append(run(rng, rates, pol))
    ideal = sum(best) / REPS
    print("   ideal (best site only): {:.1f} conversions".format(ideal))
    print("   policy     conversions   regret   share to top 3")
    for pol, res in out.items():
        c = sum(x for x, _ in res) / REPS
        s = sum(y for _, y in res) / REPS
        print("   {:9s} {:12.1f} {:8.1f} {:16.3f}".format(
            pol, c, ideal - c, s))
    print("\nReading: Thompson sampling moves most paid traffic to the")
    print("few sites that convert best and recovers most of the gap")
    print("to the ideal; uniform splitting wastes it on sites whose low")
    print("rate was obvious within days.")

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《零人工多站点容错架构、支付防欺诈状态机与被动现金流排队论》第 6 章「流量分配、升级独立域名与现金储备」(版本 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090201

DOI: 10.5281/zenodo.24090201 · 阅读本章所在专著 · 5DL-B-075 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026075,
  author    = {Fan, Yafu},
  title     = {Zero-Touch Multi-Site Fault Tolerance, Payment Anti-Fraud State Machines and Passive Cashflow Queuing},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  doi       = {10.5281/zenodo.24090201},
  url       = {https://doi.org/10.5281/zenodo.24090201}
}

本书其他章节结论