What does Single-Host Hot Migration and the Ten-Second Contract conclude, in numbers, about “The Availability Markov Chain: How Repair Time Eats the Yearly Budget”?

Answer: Chapter 3 uses an availability Markov chain to show that the five-nines budget leaves only 12.1 seconds per bad release, and that expand-contract cuts yearly downtime from 2431.9 to 155.9 minutes.

Scope of the numbers: Examples use fictional names, parameters are illustrative, and all calculations come from the book's programs, which connect to no server. Marked boxes separate published evidence, runnable Python calculations (22 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 155.9, 2431.9

branch at detection, expand-contract: 0.8930 0.0510 0.0560
expand-contract: A = 0.9997034, down 155.9 min a year
   mean outage per bad release 359.7 s
   DET 3.30e-06  FAST 6.62e-06  COMP 1.30e-05  REST 1.90e-04  MAN 8.38e-05
big-bang: A = 0.9953731, down 2431.9 min a year
   mean outage per bad release 5612.0 s
   DET 3.28e-06  FAST 0.00e+00  COMP 0.00e+00  REST 3.21e-03  MAN 1.42e-03
Show the full program
# Chapter 3. p32: a six-state availability Markov chain for releases.
# States: UP; DET (a bad release is failing, not yet detected); FAST
# (pointer flipped back, mean 9 s); COMP (undo with reverse backfill,
# mean 309 s); REST (restore from backup, mean 3909 s); MAN (manual
# rebuild after a failed restore, mean 4 h). Rates are reciprocals of
# mean holding times (exponential holding, the usual CTMC reading).
# Bad releases arrive 26 times a year (p31); detection takes 4 s on
# average (p11, "tighter"). At detection the branch shares come from
# where the fault falls against the bake period (p22): expand-contract
# with B = 24 h, or big-bang (always REST). A failed FAST or COMP undo
# falls back to REST, a failed REST goes to MAN. The stationary law
# solves pi Q = 0 with the entries of pi adding to 1, by Gaussian
# elimination with partial pivoting; inner products use math.fsum.
# All rates and probabilities are illustrative.
import math

YEAR_S = 365.0 * 86400.0
NAMES = ("UP", "DET", "FAST", "COMP", "REST", "MAN")
LAM = 26.0 / YEAR_S
MEAN = {"DET": 4.0, "FAST": 9.0, "COMP": 309.0, "REST": 3909.0,
        "MAN": 14400.0}
OK = {"FAST": 0.998, "COMP": 0.978, "REST": 0.8802}


def cdf(x_h, med=2.0, spread=2.0):
    z = (math.log(x_h) - math.log(med)) / spread
    return 0.5 * (1.0 + math.erf(z / math.sqrt(2.0)))


def generator(branch):
    n = len(NAMES)
    ix = {s: i for i, s in enumerate(NAMES)}
    q = [[0.0] * n for _ in range(n)]

    def add(a, b, rate):
        q[ix[a]][ix[b]] = rate
    add("UP", "DET", LAM)
    for tgt, share in zip(("FAST", "COMP", "REST"), branch):
        add("DET", tgt, share / MEAN["DET"])
    for st in ("FAST", "COMP"):
        add(st, "UP", OK[st] / MEAN[st])
        add(st, "REST", (1.0 - OK[st]) / MEAN[st])
    add("REST", "UP", OK["REST"] / MEAN["REST"])
    add("REST", "MAN", (1.0 - OK["REST"]) / MEAN["REST"])
    add("MAN", "UP", 1.0 / MEAN["MAN"])
    for i in range(n):
        q[i][i] = -math.fsum(q[i][j] for j in range(n) if j != i)
    return q


def stationary(q):
    n = len(q)
    a = [[q[j][i] for j in range(n)] + [0.0] for i in range(n)]
    a[-1] = [1.0] * n + [1.0]
    for c in range(n):
        p = max(range(c, n), key=lambda r: abs(a[r][c]))
        a[c], a[p] = a[p], a[c]
        for r in range(n):
            if r != c and a[r][c] != 0.0:
                f = a[r][c] / a[c][c]
                a[r] = [x - f * y for x, y in zip(a[r], a[c])]
    return [max(0.0, a[i][n] / a[i][i]) for i in range(n)]


p1 = cdf(24.0)
p2 = cdf(48.0) - p1
POLICIES = (("expand-contract", (p1, p2, 1.0 - p1 - p2)),
            ("big-bang", (0.0, 0.0, 1.0)))
print("branch at detection, expand-contract: %.4f %.4f %.4f" % (
    p1, p2, 1.0 - p1 - p2))
for label, br in POLICIES:
    pi = stationary(generator(br))
    down = 1.0 - pi[0]
    print("%s: A = %.7f, down %.1f min a year" % (
        label, pi[0], down * YEAR_S / 60.0))
    print("   mean outage per bad release %.1f s" % (down * YEAR_S / 26.0))
    print("   " + "  ".join("%s %.2e" % (s, p)
                            for s, p in zip(NAMES[1:], pi[1:])))

Single source and citation

Fan, Y. (2026). 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 (Version 1.0.0), Chapter 3: The Availability Markov Chain: How Repair Time Eats the Yearly Budget. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 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}
}

Other chapter answers in this book