关于「十秒止血契约:时间预算卷积、误报与漏报、回滚路径的锈蚀」,《单机零停机热迁与十秒止血》给出的定量结论是什么?
结论:第六章把十秒契约拆成三个条款:自动判定且旧版本保温时第 95 百分位 6.90 秒,冷启动时达成率只有 0.0020;每秒探一次、连续 4 次失败时每月误触发 0.0257 次;一年才演练一次的回滚路径能用概率只有 0.2669。
数据口径:书中只讲通用的数学模型,例子用虚构的 app-blue、app-green 与 db;参数为示意,全部计算由书中程序生成,程序不连接任何服务器;本书是非个人化的经营与工程参考,生产变更须按运维协议人工放行。 书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.0020, 6.90, 95
| config | P(<=10s) | median | p95 | mean |
| A h2 k2 auto warm | 1.0000 | 5.50 | 6.90 | 5.50 |
| B h5 k3 auto warm | 0.0000 | 16.00 | 18.50 | 16.00 |
| C h4 k2 auto warm | 0.6313 | 9.50 | 11.60 | 9.50 |
| D h2 k2 auto cold | 0.0020 | 17.55 | 25.25 | 18.05 |
| E h2 k2 human warm | 0.0000 | >60 | >60 | >60 |
| F h1 k4 auto warm | 1.0000 | 6.00 | 7.10 | 6.00 |
| grid 0.05 s up to 60 s; budget 10 s |
查看完整验算程序
# Chapter 6. p61: does the stop-the-bleeding path fit in ten seconds?
# Model: total time from a bad release failing to clean traffic is the
# sum of independent parts: detection D uniform on [(k-1)h + t, kh + t]
# (p11); a decision (automatic: 0; a person paged: lognormal, median
# 120 s, spread 0.8); the router flip back, uniform on [0.2, 0.8] s;
# propagation through the shared ingress, uniform on [0, 2] s; and,
# if the old colour was already stopped, a cold start, lognormal with
# median 12 s and spread 0.3 (0 if it was kept warm). Each law is put
# on a 0.05 s grid (mass of [(i - 1/2) dt, (i + 1/2) dt) at i dt) up to
# 60 s and convolved exactly; each output cell is a math.fsum. All
# component laws are illustrative.
import math
DT = 0.05
NB = 1200
def grid(cdf):
edges = [cdf((i - 0.5) * DT) for i in range(NB + 1)]
return [max(0.0, edges[i + 1] - edges[i]) for i in range(NB)]
def uniform(a, b):
return grid(lambda x: min(1.0, max(0.0, (x - a) / (b - a))))
def lognormal(med, s):
def cdf(x):
if x <= 0.0:
return 0.0
z = (math.log(x) - math.log(med)) / s
return 0.5 * (1.0 + math.erf(z / math.sqrt(2.0)))
return grid(cdf)
ZERO = [1.0] + [0.0] * (NB - 1)
def conv(a, b):
nz = [(i, x) for i, x in enumerate(a) if x > 0.0]
return [math.fsum(x * b[k - i] for i, x in nz if i <= k)
for k in range(NB)]
def quantile(p, q):
for i in range(NB):
if math.fsum(p[:i + 1]) >= q:
return "%.2f" % (i * DT)
return ">60"
CONFIGS = (
("A h2 k2 auto warm", 2.0, 2, 1.0, False, False),
("B h5 k3 auto warm", 5.0, 3, 2.0, False, False),
("C h4 k2 auto warm", 4.0, 2, 2.0, False, False),
("D h2 k2 auto cold", 2.0, 2, 1.0, False, True),
("E h2 k2 human warm", 2.0, 2, 1.0, True, False),
("F h1 k4 auto warm", 1.0, 4, 1.0, False, False),
)
FLIP = uniform(0.2, 0.8)
PROP = uniform(0.0, 2.0)
print("%-19s %9s %8s %8s %8s" % ("config", "P(<=10s)", "median",
"p95", "mean"))
for name, h, k, t, human, cold in CONFIGS:
lo = (k - 1) * h + t
p = uniform(lo, lo + h)
for part in (FLIP, PROP,
lognormal(120.0, 0.8) if human else ZERO,
lognormal(12.0, 0.3) if cold else ZERO):
p = conv(p, part)
within = math.fsum(p[:int(round(10.0 / DT)) + 1])
mean = "%.2f" % math.fsum(i * DT * x for i, x in enumerate(p))
if math.fsum(p) < 0.999:
mean = ">60"
print("%-19s %9.4f %8s %8s %8s" % (
name, within, quantile(p, 0.5), quantile(p, 0.95), mean))
print("grid %.2f s up to %.0f s; budget 10 s" % (DT, NB * DT))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《单机多容器零停机热迁与回滚、共享隧道架构生产库无损演进与十秒止血契约母典》第 6 章「十秒止血契约:时间预算卷积、误报与漏报、回滚路径的锈蚀」(版本 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}
}