关于「实证闭环:本地演练清单、热迁中断窗口计算器与预注册检验」,《单机零停机热迁与十秒止血》给出的定量结论是什么?
结论:第八章给出十步本地演练清单、蒸馏小工具「热迁中断窗口计算器」与预注册检验,连续 59 次零违约才能以 95 % 的把握说违约率低于 0.05。书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。
数据口径:书中只讲通用的数学模型,例子用虚构的 app-blue、app-green 与 db;参数为示意,全部计算由书中程序生成,程序不连接任何服务器;本书是非个人化的经营与工程参考,生产变更须按运维协议人工放行。 书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.05, 59, 95
| z values | 1.9600 (alpha/2) and 0.8416 (power) |
| drills per arm, two-proportion test: | |
| 0.60 vs 0.90 | 32 per arm |
| 0.80 vs 0.95 | 76 per arm |
| 0.90 vs 0.99 | 100 per arm |
| drills to bound the failure rate below p at 95 per cent: | |
| p | 0.05: 59 with 0 failures, 93 with 1, 124 with 2 |
| p | 0.01: 299 with 0 failures, 473 with 1, 628 with 2 |
查看完整验算程序
# Chapter 8. p82: sample sizes for a pre-registered local drill study.
# Model 1: compare the share of drills that recover within 10 s with no
# data difference under two procedures (big-bang against
# expand-contract) by a two-sided two-proportion z test, alpha 0.05,
# power 0.80: n per arm = (z_a sqrt(2 pb (1 - pb)) + z_b sqrt(p1 (1 -
# p1) + p2 (1 - p2)))^2 / (p1 - p2)^2, pb the mean of p1 and p2.
# Model 2: to claim with 95 per cent confidence that the failure rate
# of one procedure is below p, run n drills with at most f failures,
# the smallest n with P(X <= f | n, p) <= 0.05 (exact binomial).
# The proportions are illustrative targets, not results.
import math
import statistics
nd = statistics.NormalDist()
ZA = nd.inv_cdf(0.975)
ZB = nd.inv_cdf(0.80)
def n_two(p1, p2):
pb = 0.5 * (p1 + p2)
num = (ZA * math.sqrt(2.0 * pb * (1.0 - pb))
+ ZB * math.sqrt(p1 * (1.0 - p1) + p2 * (1.0 - p2)))
return math.ceil(num * num / (p1 - p2) ** 2)
def cdf_binom(f, n, p):
return math.fsum(math.comb(n, j) * p ** j * (1.0 - p) ** (n - j)
for j in range(f + 1))
def n_bound(p, f):
n = f + 1
while cdf_binom(f, n, p) > 0.05:
n += 1
return n
print("z values: %.4f (alpha/2) and %.4f (power)" % (ZA, ZB))
print("drills per arm, two-proportion test:")
for p1, p2 in ((0.60, 0.90), (0.80, 0.95), (0.90, 0.99)):
print(" %.2f vs %.2f -> %d per arm" % (p1, p2, n_two(p1, p2)))
print("drills to bound the failure rate below p at 95 per cent:")
for p in (0.05, 0.01):
print(" p = %.2f: %d with 0 failures, %d with 1, %d with 2" % (
p, n_bound(p, 0), n_bound(p, 1), n_bound(p, 2)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《单机多容器零停机热迁与回滚、共享隧道架构生产库无损演进与十秒止血契约母典》第 8 章「实证闭环:本地演练清单、热迁中断窗口计算器与预注册检验」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-269 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026269,
author = {Fan, Yafu},
title = {Zero-Downtime Hot Migration and Rollback on Multi-Container Single Hosts: Lossless Schema Evolution behind a Shared Tunnel and a Ten-Second Stop-the-Bleeding Contract},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}