◇ OpenCyber Academy
Engineering · Chapter 6 · English

Chapter 6 — Calculus II

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Chapter 6 — Calculus II

Lesson map

Lesson 06 published. Map, example, EX016.

flowchart TD
  N0["Learning outcomes"]
  N1["6.1 Geometric series and retries"]
  N2["6.2 Differential model of a backlog"]
  N3["6.3 When continuous is enough"]
  N4["6.3b Choosing a retry cap from the series"]
  N5["Synthesis"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5
  N5 --> EX["Worked example"]
  EX --> Q["Exercise EX016"]

Logical drawing

flowchart LR
  N0["Learning outcomes"]
  N1["6.1 Geometric series and retries"]
  N2["6.2 Differential model of a backlog"]
  N3["6.3 When continuous is enough"]
  N4["6.3b Choosing a retry cap from the series"]
  N5["Synthesis"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> Q["EX016"]
[Learning outcomes]
    |
    v
[6.1 Geometric series and retries]
    |
    v
[6.2 Differential model of a backlog]
    |
    v
[6.3 When continuous is enough]
    |
    v
[6.3b Choosing a retry cap from the series]
    |
    v
[Synthesis]
    |
    v
[Worked example] --> [Exercise EX016]

Learning outcomes

You will (1) use series and accumulation to reason about repeated probes; (2) apply a simple differential model to a remediation backlog; (3) decide when a continuous model is good enough for a ROE debate.

6.1 Geometric series and retries

If each attempt to upload evidence succeeds with probability p = 0.8 independently, the chance of succeeding within k tries is 1 − (1 − p)^k. That is a finite geometric series. With k = 3, 1 − 0.2³ = 0.992. Retries raise the success rate, but they also multiply traffic: expected attempts until success is 1/p = 1.25, so a 1,000-upload batch expects 1,250 requests. The ROE must count the retries, not only the logical uploads.

"""Reliability of a synthetic evidence-upload step with retries (deterministic)."""
import random
random.seed(7)
P_FAIL = 0.2
def upload_attempts(max_tries):
    for t in range(1, max_tries + 1):
        if random.random() > P_FAIL:
            return True, t
    return False, max_tries
for tries in (1, 2, 3, 5):
    random.seed(7)
    ok = sum(upload_attempts(tries)[0] for _ in range(1000))
    print(f"max_tries={tries} success={ok}/1000 theory={1-P_FAIL**tries:.4f}")

Expected output:

max_tries=1 success=784/1000 theory=0.8000
max_tries=2 success=949/1000 theory=0.9600
max_tries=3 success=988/1000 theory=0.9920
max_tries=5 success=1000/1000 theory=0.9997

Counting only logical uploads understates load by the retry factor. With p equal to 0.8, every thousand logical uploads mean about twelve hundred and fifty attempts on average, which is what the client's rate limiter will see. The lab's seed keeps the demonstration stable across machines; production uses the same formula with measured failure rates. Sam writes the expected attempt count into the ROE volume budget before the engagement.

6.2 Differential model of a backlog

Let B(t) be open findings. Findings arrive at rate a and are closed at rate c when staffed. Then B′(t) ≈ a − c. If a = 4/day and c = 6/day, the backlog falls by about 2 per day; starting from 30, it reaches zero in 15 days. If arrivals jump to 8/day (a campaign week) while staffing stays at 6, the backlog grows. The model is crude — it ignores priority — but it makes the staffing decision quantitative.

The sign of a minus c tells the story at a glance: negative and the pile shrinks, positive and it grows. Priority still matters in real queues, so Sam uses the model to ask for staffing, not to promise a calendar date. When a campaign week doubles arrivals, the same model shows how many extra closers are needed to stay level. Plotting B(t) over a month makes the effect visible to managers who will not read the equation.

6.3 When continuous is enough

ROE debates often need an order of magnitude, not a closed form. "Will a 5 req/s scan for 30 minutes produce about 9,000 requests?" Yes: 5 × 1,800 = 9,000. Reserve exact calculus for schedules with peaks (§1) and for models the client will audit.

Synthetic case — Riverstone Transit. FindingsDesk showed a backlog of 28 medium findings with two remediations per day. Sam's B′ model predicted 14 days to clear if no new arrivals; the manager funded a third engineer for that fortnight.

Exact schedules with peaks need the fuller treatment from the first calculus chapter, and those are the ones Sam brings to a client who will audit the numbers. For a flat scan, multiplying rate by duration is enough, and writing the product next to the volume limit shows compliance at a glance. If the product sits near the limit, he switches to the exact schedule check rather than hoping bursts stay small.

6.4 Errors and limits

Independence of retries fails when the failure is systematic (a broken endpoint). Backlog models ignore priority and SLA; use them as a conversation starter, not as a forecast the board will quote.

A broken endpoint fails every try, so multiplying attempts does not raise the success rate and only adds load. Staffing models that ignore severity will clear easy tickets while critical ones age. Sam labels every model with its assumptions and refuses to let a backlog chart be quoted as a delivery date.

6.3b Choosing a retry cap from the series

The geometric series gives the chance that every attempt fails as p to the power n. Sam uses it backwards: TrackScope's evidence upload must succeed 99% of the time, and synthetic runs show a 20% failure rate per attempt, so three attempts (0.8%) meet the goal while two (4%) do not. He writes the derivation into the design note so a reviewer can check the cap without rerunning experiments.

Working backwards from a reliability goal turns a taste decision into a short derivation. Three attempts leave under one percent failure when each try fails one time in five, which matches the lab. Putting the derivation in the design note means a later engineer can change the failure rate and recompute the cap without guessing why three was chosen. Sam re-runs the synthetic check whenever the upload path changes.

Exercises

Synthesis

Series and rates turn "try again" and "hire someone" into numbers that fit in a ROE or a staffing request.

Continue studying — chapter 06 of 50

← Chapter 05 (draft) · Course chapter index · Chapter 07 (draft) →