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

# Right-sizing

> Find jobs on the wrong runner size and move them in one PR

export const ProductEmbed = ({story, title, width, height}) => {
  const embedOrigin = "https://docs-embeds.blacksmith.sh";
  const designWidth = width || 960;
  const designHeight = height || 600;
  const frameRef = useRef(null);
  const [ready, setReady] = useState(false);
  useEffect(() => {
    const frame = frameRef.current;
    const box = frame && frame.parentElement;
    if (!box) return undefined;
    const fit = () => {
      frame.style.transform = `scale(${box.clientWidth / designWidth})`;
    };
    fit();
    const observer = new ResizeObserver(fit);
    observer.observe(box);
    return () => observer.disconnect();
  }, [designWidth]);
  useEffect(() => {
    const onMessage = event => {
      if (event.origin !== embedOrigin) return;
      if (!frameRef.current || event.source !== frameRef.current.contentWindow) return;
      if (event.data && event.data.source === "blacksmith-docs-embed" && event.data.type === "ready") {
        setReady(true);
      }
    };
    window.addEventListener("message", onMessage);
    return () => window.removeEventListener("message", onMessage);
  }, []);
  return <iframe ref={frameRef} className={ready ? "is-ready" : undefined} src={`${embedOrigin}/iframe?id=${story}&viewMode=story&globals=theme:light`} width={designWidth} height={designHeight} title={title} loading="lazy" tabIndex={-1} />;
};

A job on a runner that's too big pays for idle cores. A job on a runner that's too small runs slowly or runs out of memory. Blacksmith records CPU and memory for every job, so \[code]smith can find the jobs on the wrong size and open a PR that moves them.

<div className="product-embed not-prose">
  <div className="product-embed-window">
    <div className="product-embed-screen">
      <img className="product-embed-poster" src="https://mintcdn.com/blacksmith/JnM6lCVC23qG1T2T/images/embeds/rightsize.png?fit=max&auto=format&n=JnM6lCVC23qG1T2T&q=85&s=dff119f09ff12dd10480fcf4232a199c" alt="Starting a right-sizing session from the Rightsize page and migrating the recommended jobs" noZoom width="1920" height="1200" data-path="images/embeds/rightsize.png" />

      <ProductEmbed story="docs-embeds-rightsize--walkthrough" title="Starting a right-sizing session from the Rightsize page and migrating the recommended jobs" />
    </div>
  </div>
</div>

## Start a session

Open [**Rightsize**](https://app.blacksmith.sh/rightsize) in the Blacksmith dashboard and click **Rightsize with \[code]smith**. You can also type `/rightsize` in any \[code]smith session.

\[code]smith analyzes the last 7 days of jobs, so a repository needs a few days of job history before it gets recommendations.

## Review the recommendations

\[code]smith shows the results as a card. Each row is one job, with its current and suggested runner, the reason for the change, and the estimated effect on monthly cost and runtime. Rows are labeled by what they improve:

* **Cost:** the job leaves most of its CPU and memory unused, so a smaller runner costs less with little change in runtime.
* **Speed:** the job is CPU-bound, so a larger runner finishes it faster.
* **Reliability:** the job is close to its memory limit or getting OOM-killed, so it needs more headroom.

Low-confidence rows, usually jobs with few runs in the window, start unselected.

## Apply the changes

Select the rows you want and click **Migrate**. \[code]smith opens one PR per repository that updates the `runs-on:` lines for those jobs. Nothing changes until you merge the PR.

To dig into a workflow beyond its runner size, see [CI tuning](/codesmith/ci-tuning). To get the same recommendations in a terminal, run [`blacksmith jobs diagnose rightsize`](/blacksmith-cli/jobs).
