> ## Documentation Index
> Fetch the complete documentation index at: https://aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Optimizing CI runners

> Tune Aspect Workflows CI runners for CI speed and cost: instance size, runner group scaling and warming.

export const gatedAccess = (user, group) => {
  const loggedIn = !!(user && user.loggedIn);
  const groups = user && user.tenantMetadata && user.tenantMetadata.docsGroups || [];
  if (loggedIn && (!group || groups.indexOf(group) >= 0)) {
    return "entitled";
  }
  return loggedIn ? "signed-in" : "anonymous";
};

export const GatedLink = ({access, href, group, children}) => {
  const note = group ? "Aspect Enterprise customers" : "free Aspect account";
  const muted = {
    fontSize: "0.85em",
    opacity: 0.7,
    whiteSpace: "nowrap"
  };
  if (access === "entitled") {
    return <a href={href}>{children}</a>;
  }
  if (access !== "signed-in") {
    return <span>
        <a href={"/login?redirect=" + encodeURIComponent(href)}>{children}</a>
        <span style={muted}> (sign in: {note})</span>
      </span>;
  }
  return <span>
      {children}
      <span style={muted}> ({note})</span>
    </span>;
};

export const gatedHref = (user, href, group) => {
  const loggedIn = !!(user && user.loggedIn);
  const groups = user && user.tenantMetadata && user.tenantMetadata.docsGroups || [];
  if (loggedIn && (!group || groups.indexOf(group) >= 0)) {
    return href;
  }
  return loggedIn ? undefined : "/login?redirect=" + encodeURIComponent(href);
};

Try these on the runners themselves. They're independent, and each one changes speed and cost, so measure after each. For the build running on them, see [Optimizing your Bazel build](/docs/bazel/guides/optimizing-builds).

## Tune instance type size

The right instance size depends on your workload's parallelism and memory profile. An undersized machine serializes actions; an oversized one pays for idle cores.

1. Review available instance types from your cloud provider, noting regional availability.
2. Use a binary search: double or halve the instance size and measure wall-clock CI time against cost. Stop when the speed gain no longer justifies the cost increase.
3. Evaluate Arm instances. They typically offer better price-to-performance for CPU-bound workloads.

<Note>
  A resize replaces the running instances and their local output bases, so the first builds afterwards run cold. On a self-hosted deployment, instance types are runner group settings in Terraform; see the <a href={gatedHref(user, "/docs/aspect-workflows/enterprise/customers/self-hosted/reference/terraform-config-aws#runners", "workflows-subscriber")}>AWS</a> and <a href={gatedHref(user, "/docs/aspect-workflows/enterprise/customers/self-hosted/reference/terraform-config-gcp#runners", "workflows-subscriber")}>GCP</a> references.
</Note>

## Tune runner group scaling

These settings control how a runner group scales. On a deployment hosted by Aspect, [ask for the values you want](/docs/aspect-workflows/enterprise/deployment-options/hosted#what-stays-yours); on a self-hosted deployment, they're runner group settings in Terraform:

* `min_runners` (minimum size): the minimum number of runners always allocated. Set this to absorb burst traffic without a cold start.
* `max_runners` (maximum size): the upper bound. Set this based on your peak concurrent job count and budget.
* `min_free_runners` (idle runners): the number of idle runners to keep ready. A value of 1–2 removes the wait for a new runner to provision when several jobs arrive at once.

## Configure runner warming

Turn on <GatedLink access={gatedAccess(user, "workflows-subscriber")} href="/docs/aspect-workflows/enterprise/customers/connect/ci-setup/workflows-runners/warming" group="workflows-subscriber">warming</GatedLink> for groups that scale up often, so a new runner's first job starts with external repositories fetched and repository rules run.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.