When to invoke
- You are tuning retries/backoff for ETL jobs, API ingestion, or batch pipelines.
- You need to compare strategies (fixed delay vs exponential + jitter).
- You want a quick estimate of expected runtime, attempts, and wasted work under failure.
Inputs needed
- A JSON config with:
attempts_maxbase_delay_secondsstrategy:fixed,exponential, orexponential_jitterfailure_probabilityper attempt (0..1)work_seconds_per_attempt(time spent before a failure/success)trialsfor Monte Carlo simulation
Workflow
- Validate config.
- Run Monte Carlo simulation across
trials:- For each trial, attempt the job up to
attempts_max. - Each attempt succeeds with probability \(1-p\).
- Add work time each attempt; add delay between failed attempts per strategy.
- For each trial, attempt the job up to
- Compute summary statistics:
- success rate
- expected attempts
- p50/p90 total duration
- expected backoff time
Output format
JSON to stdout:
success_rateexpected_attemptsduration_seconds: p50, p90, meanexpected_backoff_seconds
Guardrails
- Vendor-neutral: does not assume a specific orchestrator or cloud.
- Model is simplified; use for comparative tuning, not precise capacity planning.
Reference code
etl_retry_backoff_simulator.py