> ## Documentation Index
> Fetch the complete documentation index at: https://controlplanecorporation-majid-docs-content-expansion.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Replica

> A pod in Kubernetes terms. Autoscaling decides how many run in each location, the readiness probe decides which ones receive traffic, and Control Plane replaces any that stop.

A [workload](/concepts/workload) describes your application; a replica is one running copy of it, with all of its containers running together. Control Plane runs several copies at once: replicas in the same location share its traffic and cover for one another, and replicas in other [locations](/concepts/location) take over when a whole location fails. That is the high-availability model, and the [99.999% availability SLA](/whatis#availability-and-routing) applies once a workload runs at least two replicas across at least two locations.

## How It Fits

In Kubernetes terms, a replica is a pod. A workload runs in every location its [GVC](/concepts/gvc) spans. What runs in one location is a set of replicas, and that set is the workload's [deployment](/concepts/deployment) in that location.

| Relationship | Rule                                                                                                                                                                                                                                |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Workload     | One replica runs every container the workload defines, all of them together on one machine. Scaling adds and removes whole replicas, never single containers.                                                                       |
| Deployment   | One per location. Its replicas run and serve traffic in that location only.                                                                                                                                                         |
| Traffic      | The workload's endpoints balance requests across the location's ready replicas; the [readiness probe](/reference/workload/containers#probes) decides which those are.                                                               |
| Resources    | Each container asks for CPU and memory, and the replica reserves the total for as long as it runs; reservations are what you pay for.                                                                                               |
| Storage      | Each replica of a `stateful` or `vm` workload keeps a volume of its own from a [volume set](/reference/volumeset); replicas of every other type start on blank [local disk](/reference/workload/general#default-ephemeral-storage). |

<img src="https://mintcdn.com/controlplanecorporation-majid-docs-content-expansion/rUryc3z9dDsnWr_V/images/concepts/replica-per-location.svg?fit=max&auto=format&n=rUryc3z9dDsnWr_V&q=85&s=c99819b9fca5e6b15b29eb73c08717e6" alt="The same workload, my-app, in three locations, each marked with its provider's logo: aws-us-east-1 on AWS, gcp-us-central1 on Google Cloud, and my-hardware on a Kubernetes cluster of your own. Each location runs two replicas, 01 and 02, each holding the same containers, app and sidecar. Each replica runs every container in the workload, and each panel is one deployment, the workload's replicas in one location. One workload, six replicas across three locations, none of them created by hand." style={{maxWidth:'720px',width:'100%',margin:'1.75rem auto',display:'block'}} width="720" height="300" data-path="images/concepts/replica-per-location.svg" />

The deployment for each location reports the live picture: the count autoscaling currently targets, and how many replicas of each version are ready.

## Key Behaviors

* **Each location scales on its own.** [Autoscaling](/reference/workload/autoscaling) raises and lowers each location's replica count between `minScale` and `maxScale` (defaults 1 and 5), steering toward the target you set: concurrent requests, requests per second, CPU, memory, or latency, whichever of those the workload's [type](/reference/workload/types) supports. The metric `disabled` pins every location at `minScale`.
* **A replica reserves CPU and memory; the reservation is what you pay for.** Each container states its CPU and memory (defaults `50m` and `128Mi`), and the replica holds that capacity whether the process uses it or not. [Capacity AI](/reference/workload/capacity) can size the reservation from real usage instead. Every container also gets at least 1GB of local SSD scratch space, and 1GB per CPU core when it requests more than one.
* **Zero replicas is a working state.** A `serverless` workload with no traffic scales to zero after a delay (default 300 seconds), and a request that arrives while no replica is running waits for the first one to start instead of failing. Whether a workload can reach zero at all depends on its type.
* **A failing container is restarted; a stopped replica is replaced.** A container that crashes or stops passing its liveness probe is restarted in place, inside its replica. `cpln workload replica stop` deletes the whole replica, and Control Plane starts a replacement to keep the count; use it to clear a wedged process without touching the workload's other replicas.
* **Replicas of a `stateful` workload keep their identity.** Each is numbered from 0 up; a replacement keeps the same number and reattaches the same volume, and [replica-direct](/reference/workload/general#finding-replica-hostnames) gives each numbered replica a stable network address, which is how database nodes find each other.
* **Every replica has a name you can act on.** [Logs](/core/logs) and [metrics](/guides/default-metrics) carry a `replica` label, so one failing replica stands out from its peers. `cpln workload replica get` lists the names of the running replicas, [`cpln workload connect`](/guides/cli/workload/connect) opens a shell in one of them, and with [debug headers](/reference/workload/general#debug) on, the `x-cpln-replica` response header names the replica that served the request.
* **Replicas spread out for availability.** Control Plane places a location's replicas on separate machines, and [multi-zone](/reference/workload/general#multi-zone) spreads them across the location's availability zones too. Running in every location the GVC spans is the widest layer of the same idea: separate regions, separate providers.

## Gotchas

* **`maxScale` caps a location, not the workload.** A GVC spanning three locations with `maxScale: 5` can run 15 replicas, so count locations when you size the range and the bill.
* **A fresh workload runs one replica per location.** `minScale` defaults to 1, which is a single point of failure in each location and below the two replicas the SLA requires; raise it to 2 for production.
* **Raising `maxScale` meets a quota.** The default cap is 5 replicas per workload, counted separately for replica-direct workloads, and a higher value is rejected with `One or more containers exceed the autoscaling.maxScale of 5 (quota: replicas-per-workload). Request quota increase`. See [quotas](/concepts/quota) for raising it.
* **Local disk dies with the replica.** Everything a container writes outside a volume-set mount is scratch space, gone when the replica is replaced, and writing past the scratch allowance is itself what gets a replica replaced.
* **A replica name is an address only on `stateful` workloads.** Every other type's replicas take a new name at each replacement, and replica-direct elsewhere is rejected with `replicaDirect is only available for stateful workloads`.

## Learn More

<CardGroup cols={2}>
  <Card title="Deployment reference" icon="wave-pulse" href="/reference/deployment">
    The per-location report: replica counts per version, readiness, restarts, and how to read a rollout.
  </Card>

  <Card title="Autoscaling reference" icon="arrows-up-down" href="/reference/workload/autoscaling">
    Every strategy and option behind the replica count, from fixed to latency-based to KEDA.
  </Card>

  <Card title="Workload" icon="https://mintcdn.com/controlplanecorporation-majid-docs-content-expansion/Ry1Mkgc7uPHC-gur/icons/workload.svg?fit=max&auto=format&n=Ry1Mkgc7uPHC-gur&q=85&s=3331c4f59aa584e932c875493f66d359" href="/concepts/workload" width="512" height="512" data-path="icons/workload.svg">
    The unit a replica copies: containers, type, identity, endpoints, and firewall.
  </Card>

  <Card title="Connect to Workloads" icon="square-terminal" href="/guides/cli/workload/connect">
    Open a shell inside a running replica from the Console or the CLI.
  </Card>
</CardGroup>
