Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
Cloud & DevOps

Self-Hosted CI Runner Autoscaler with Warm Pools

A controller for software teams that starts and stops self-hosted CI runners based on the real job queue, keeping a warm pool so builds do not wait and idle machines are not paid for. An intermediate DevOps final year project with a clear cost versus wait-time evaluation and a simulator.

Difficulty

Intermediate

A small team, or one strong student willing to learn something new.
Effort

1 semester · 2 students

Deliverables

7 to ship

4 optional extras

Suggested stack

GoDockerKubernetes (kind or k3s)GitHub Actions or GitLab CI APIPostgreSQLPrometheus and Grafana
A suggestion, not a requirement. Swap anything for what you already know.

What you should ship

  • A queue monitor that reads pending jobs and their labels or resource needs from one CI system through its API or webhooks
  • A scaling controller that creates and removes ephemeral runners according to a documented, configurable policy
  • Warm pool handling with a time-of-day schedule, so jobs at busy hours do not wait for a cold start
  • Safe scale-down that never kills a runner mid-job, with idempotent handling of duplicate or lost webhook events
  • Per-job metrics for queue wait time and runner cost, exported to Prometheus with a Grafana dashboard
  • A discrete-event simulator that replays job arrival traces against different policies
  • A comparison across at least 3 workload patterns of your policy against fixed capacity and scale-from-zero, on cost and p95 wait

If you have time left

  • Predictive scaling from historical patterns such as the weekday morning surge
  • Spot or preemptible instances with correct handling of interruption and job retry
  • Per-team cost attribution and a monthly report
  • A second CI backend behind the same controller interface

The problem with fixed build capacity

Teams that run their own CI runners (for private networks, special hardware, large caches or cost reasons) usually size them once. Either machines sit idle overnight and at weekends, or developers wait many minutes for a runner at 10 a.m. when everyone pushes at once. Both cost money; the second also costs attention, because a developer waiting on a build switches context and loses the thread.

Software houses and product teams feel this as soon as they outgrow hosted runner minutes or need runners inside their own network. The fix sounds simple (scale with the queue) but the details are where teams get hurt: cold starts, runners killed mid-job, and bursts that arrive faster than machines boot.

What already exists and the gap

  • Actions Runner Controller (ARC) is GitHub's Kubernetes operator that scales self-hosted runners through runner scale sets and a listener watching the job queue.
  • terraform-aws-github-runner creates ephemeral GitHub runners on EC2 spot instances using webhooks and Lambda, can scale to zero, and supports an idle pool on a cron schedule.
  • GitLab Runner autoscaling uses a fleeting plugin to create and remove cloud instances for jobs.

These are mature, but they expose knobs (minimum runners, idle schedules, scale-down delay) without telling you what values to use for your team's traffic. The gap this project fills is the policy and the evidence: a controller small enough to understand, plus a simulator that maps the cost versus wait-time curve for a given workload so a team can choose settings deliberately.

What you build

  • Queue monitor: subscribes to job events for one CI system and keeps an accurate view of pending, running and finished jobs.
  • Scaling controller: a reconcile loop that compares desired runners (from the queue and the policy) with actual runners and acts.
  • Warm pool: a small number of ready runners, sized by time of day, so common jobs start immediately.
  • Metrics and dashboard: wait time, runner utilisation and estimated cost per job.
  • Simulator: replays recorded or synthetic job arrival traces against different policies without spending money.

The technically interesting part

The trade-off at the centre is cold start against idle cost. Terminating aggressively saves money and makes the next job wait for a machine to boot and pull images. Keeping a warm pool costs money and removes the wait. There is no single right answer, only a curve, and mapping that curve is the project.

The second hard part is correctness of the control loop. Webhooks arrive late, twice or not at all; a runner may register but never pick up a job; scale-down may race with a new assignment. Use the reconcile pattern Kubernetes controllers use (compare desired and observed state on every tick, rather than trusting individual events) and show tests for each race you found.

How to evaluate it

Running a real cluster for weeks under varied load is not feasible in a semester, so evaluate in two steps.

  • Simulation: drive the simulator with three patterns: steady arrival, a weekday morning spike, and a burst when a large pull request triggers fifty jobs at once. Compare fixed capacity, scale-from-zero and your policy on total cost and p95 wait. Policies that look good on smooth load often fail on the burst, which is the case developers actually complain about.
  • Validation: run the real controller on a small kind or k3s cluster with a scripted workload and check that its measured wait times match the simulator within a stated margin.
  • Safety: zero jobs killed mid-run across all tests, and correct recovery after the controller is restarted.

Suggested plan

  1. Weeks 1 to 2: study ARC and one CI API, record or generate job traces, define metrics.
  2. Weeks 3 to 5: queue monitor and reconcile-based controller on a local cluster.
  3. Weeks 6 to 8: warm pool, safe scale-down, metrics and dashboard.
  4. Weeks 9 to 11: simulator, policy comparison across workloads.
  5. Weeks 12 to 14: validation against the real cluster, write-up and demo.

Path to a product

The realistic path is open source plus consulting. Publish the simulator as a tool that takes a team's exported job history and recommends warm-pool and scale-down settings for ARC or the Terraform module; that is useful even to teams who never run your controller. A software house that runs its own runners is a good first user. It is also a strong portfolio centrepiece for platform and infrastructure engineering roles, because it shows control loops, cost thinking and measured results.

Scope warning

One CI system and one environment (a local cluster or one cloud provider). Do not build a CI system, a build cache or a multi-cloud scheduler. The scaling policy and its evaluation are the contribution; keep the rest thin.

Learn what you need on Sefism

Get help with this idea

This project succeeds when the evaluation is honest and the scope stays narrow. Tauseef can help you pick the CI system, design the simulator and choose workload patterns that convince examiners. If you are new here, create a free account first.

Ideas and guidance, not finished projects

These are project ideas and scoping guidance, published free for students to use as a starting point. I do not build, write, or sell final-year projects, and I do not complete coursework for anyone. Take an idea, make it yours, and build it.

Not sure this one fits you?

I help students pick an idea that matches their skills and their deadline, then scope it down until it is finishable. Guidance only, never done for you.

Discuss this idea
Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.