Q&A-2How would you reason about discrete versus continuous in a system you own?
Answer
Core (first 90 seconds). I'd start by naming the two quantities I own and the decision each drives, because the discrete/continuous choice is downstream of that. In the API I run: request latency in milliseconds, and error counts per minute. Latency is continuous: quantized to ms by the timer, but continuous as a model. Error counts are discrete. The rule I apply: the support decides which operations are valid. Point probabilities are meaningful only for the counts; for latency every threshold is an interval, "≤ x", never "= x". Then I check the model against the data before I trust it.
Why the support decides the operations. A PMF sums to 1 over countable outcomes, so P(errors = 3) is a number I can page on. A density integrates to 1, so P(latency = 3 ms) = 0 and the density at 3 ms can be 2.0: a rate, not a probability. That's why p99 is a quantile of the CDF and why a latency threshold has to be an interval. Aggregation follows: sums of independent Poisson counts stay Poisson, so errors per hour are still discrete; sums of latencies are continuous, and the mean of many requests is approximately normal by CLT even though individual latencies are heavy-tailed.
Trade-offs and when not to use each.
- Poisson for error counts: closed form, cheap, hands me a page threshold directly. Assumes variance = mean. Bursty traffic breaks it: I check the index of dispersion and move to negative binomial when it's well above 1.
- Lognormal for latency: lets me extrapolate the tail beyond observed data. Wrong for genuinely heavy tails; I use it only when the fit holds.
- Empirical histogram: no distributional assumption, works for both quantities, but resolution is bounded by bucket width and it can't extrapolate past the last bucket.
The deciding criterion is the operation the number feeds. A threshold alert needs a tail probability → empirical or continuous. Capacity or billing needs exact sums → discrete. If I can't justify a parametric model, the histogram is the fallback.
Failure modes, detection, cost.
- Density read as a probability. Detect: threshold outside [0,1], or alerts that never fire. Cost: silent SLO breach.
- Poisson on overdispersed counts. Detect: index of dispersion over a week. Cost: false pages and on-call fatigue.
- Histogram top-bucket saturation: p99 lands in the last bucket and is reported as the bucket edge. Detect: p99 equals the max bucket bound. Cost: understated tail latency.
Artefact: checking the count model.
import numpy as np
counts = np.array([2, 3, 2, 4, 3, 2, 3, 25, 2, 3]) # errors per minute, 10 min
mean = counts.mean() # 4.9
var = counts.var(ddof=1) # 50.32
print(var / mean) # 10.27Mean 4.9, variance 50.32, index 10.27: far above 1, so Poisson is the wrong model here and I'd fit negative binomial.
| Quantity | Support | Model | Operation that must stay valid |
|---|---|---|---|
| Latency (ms) | continuous | empirical histogram / lognormal | p99 threshold → tail probability |
| Errors/min | discrete | Poisson, else negative binomial | page when count > threshold |
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.