HN
Today

Subminute CI

Moab Engineering tackled the universal pain point of slow CI, slashing their monorepo's median test time to under a minute and maintaining it under scale. This detailed exposé on sweating every second of waste across parallelism, caching, hardware, and elimination resonates deeply with HN's audience hungry for practical, high-impact engineering solutions. It's a masterclass in meticulous optimization that engineers can both aspire to and learn from.

43
Score
11
Comments
#2
Highest Rank
1h
on Front Page
First Seen
Dec 2, 6:00 PM
Last Seen
Dec 2, 6:00 PM

The Lowdown

Moab Engineering achieved the impressive feat of reducing their Continuous Integration (CI) times to under one minute, even after migrating their entire codebase to a monorepo and significantly increasing their test count. Initially, their CI pipeline on GitHub Actions would time out after three hours, highlighting the scale of the challenge for their ERP system, which serves very large businesses.

Key aspects of their journey and solution include:

  • Motivation: Fast CI shortens iteration loops, improves engineer productivity, and serves as a diagnostic for technical understanding and team alignment, reflecting a strong engineering culture.
  • Stack: Their environment uses AWS, Terraform, Python, Flask, SQLAlchemy, Postgres, and React.js with TypeScript.
  • Optimization Strategy: They approached optimization through four main themes, inspired in part by LLM-identified opportunities:
    • Parallelism: Forking the app to match vCPUs, distributing unit tests across runners using execution time metrics and LPT heuristic, and ensuring non-sequential jobs run in parallel.
    • Caching: Attaching persistent storage volumes for git mirrors, Docker images, and warmed disks, along with using S3 snapshots for database states.
    • Hardware: Leveraging a vendor for fast, low-latency runners (Blacksmith.sh) and optimizing machine sizing (two 16 vCPU machines proving faster than one 32 vCPU).
    • Elimination: Removing unnecessary overhead through lazy imports, skipping garbage collection, conditional execution of tasks (e.g., Semgrep on diffs only), using faster tools (uv, ruff), native forking, early result reporting, disabling telemetry, and deferring compilations/builds.
  • Deliberate Trade-off: Notably, they chose to run every single unit test rather than trying to predict relevant tests based on PR changes, prioritizing correctness for their financial source-of-truth product over potential minor speed gains.

Moab's success demonstrates that sub-minute CI for a large, complex codebase is achievable through a comprehensive, layer-by-layer optimization effort and a disciplined engineering culture.

The Gossip

CI Challenges and Triumphs

Many commenters relate deeply to the struggle of slow CI pipelines, sharing their own experiences and progress. Engineers from Laravel and Rails backgrounds discuss their journeys from 20+ minute CI runs down to 5 minutes, often encountering similar bottlenecks like `factory_bot`. There's a collective aspiration to push these times even lower, highlighting the universal nature of this engineering problem and the value of the detailed solutions presented.

Forking Follies and Language Nuances

The discussion delves into specific technical choices, particularly Moab's continued use of forking. Some commenters question this, suggesting that embracing threads could unlock further performance, especially when native code extensions are involved. The conversation also broadens to language-specific CI challenges, with Rust being highlighted as a particularly difficult case for achieving sub-minute CI due to compilation times and the inherent complexities of incremental testing in larger codebases.

Agentic Automation's Ascendancy

A forward-looking thread explores the potential shift from traditional CI pipelines to 'agentic loops' where AI agents orchestrate the entire development lifecycle. Proponents describe how agents can manage builds, tests, and deployments, leading to significant reductions in compute costs and faster integration rates. Some even share open-source tools being developed in this space. However, skepticism is also voiced regarding the trustworthiness and quality of tests generated by AI agents compared to human-written tests, emphasizing the need for robust validation and policy enforcement.