← Wed, Dec 2 digest

Subminute CI

read article ↗ hn thread ↗

Moab engineers reduced their enterprise ERP codebase's median CI time from over three hours to under one minute using aggressive parallelism, caching, and elimination strategies.

read it A detailed breakdown of architectural and infrastructural optimizations that cut a massive CI pipeline down to under a minute, offering concrete patterns for backend engineers.

summary

Moab engineers migrated their large enterprise resource planning codebase to a monorepo and cut median CI time from over three hours to under one minute. They achieved this by applying aggressive optimizations across parallelism, caching, hardware selection, and elimination of unnecessary abstractions. Key strategies include native process forking, persisting a development database snapshot in S3, utilizing 16 vCPU runners, and adopting faster tooling like uv and ruff. Notably, they opted to run the entire unit test suite on every PR rather than attempting smart test scoping to ensure complete reliability.

key points

  1. Parallelism is managed by freezing and native-forking the application across available vCPUs, distributing tests via time metrics and the Longest Processing Time heuristic.
  2. Caching is heavily optimized using persistent storage volumes for git mirrors, Docker layers, and S3-stored database snapshots to bypass slow schema construction.
  3. Elimination of overhead includes using faster tooling (uv, ruff, oxlint), lazy imports, skipping garbage collection during startup, and deferring Pydantic model compilation.
  4. The team intentionally avoids test selection and scoping, running the entire unit test suite on every change to maintain absolute correctness.

who should read it

Backend engineers and infrastructure teams scaling Python applications or large monorepo CI pipelines.

discussion positive

consensus

Commenters appreciate the practical techniques shared, though some debate whether median is the ideal metric or if GitHub Actions billing makes sub-minute runs economically wasteful.

pushback

A few express skepticism regarding the maintenance burden, non-determinism risks, and cache poisoning vulnerabilities introduced by aggressive state persistence.

best comment by iveqy ↗

caching in a CI is terribly hard to do correct. Specially if you can't trust all code starting a CI run. It's really easy to end up with poisonous cache.

Apart from that managing hardware bugs is a pita. Your build manifest should be able to tell which hardware built what code, I bet most cache solutions can't share that information.

It highlights the critical and often overlooked risks of cache poisoning and hardware state management when implementing aggressive CI caching.

Generated by an LLM from the article and thread. Check the sources before relying on it.