Interview Prep/Python for DevOps/Kubernetes, Docker, SSH & fleet automation

You need to make 1,000 HTTP health checks every minute against internal endpoints. Threads or asyncio?

IntermediateScenarioKubernetes, Docker, SSH & fleet automation
Answer

Situation read → High fan-out I/O on a timer.

What I'd do →

  1. asyncio with httpx.AsyncClient (or aiohttp), a Semaphore(100), per-request timeouts (timeout=3), and asyncio.gather(..., return_exceptions=True).
  2. Record results as Prometheus metrics (probe_success, latency histogram) from a long-running process.
  3. Or just deploy Prometheus blackbox_exporter, which does exactly this.

Why → asyncio handles thousands of sockets in one thread cheaply; threads would need a big pool.

Interview tip → Mentioning blackbox_exporter shows you do not reinvent monitoring.

All Python for DevOps questions Roadmap: Python for automation

More on Kubernetes, Docker, SSH & fleet automation