--- title: "How Replica optimization works" slug: "how-replica-optimization-works" updated: 2026-07-15T12:08:37Z published: 2026-07-15T12:08:37Z canonical: "docs.zesty.co/how-replica-optimization-works" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zesty.co/llms.txt > Use this file to discover all available pages before exploring further. # How Replica optimization works The following steps summarize how the Replica optimization solution works: 1. **Collect and store metrics:** VictoriaMetrics continuously collects container-level metrics and calculates derived performance metrics from the cluster. 2. **Run recommendation cycle:** The recommendation-maker runs its pipeline to calculate optimal CPU/memory requests per Pod and determine optimal target utilization before passing these outputs to the min replica recommender. 3. **Execute algorithm and validate safety:** The min replica calculator fetches active HPA parameters from the Kubernetes API, retrieves metrics from VictoriaMetrics, applies base or enhanced scenario algorithm logic, and validates safety constraints. 4. **Update action plan:** If changes are needed, the system generates and updates an Action CR with the required min replica recommendation details. 5. **Apply changes:** The action-taker reads the Action CR and applies the optimization by updating the HPA's minReplicas field in the cluster. 6. **HPA scaling response:** The native Kubernetes Horizontal Pod Autoscaler adjusts the actual running replica count fluidly based on the new minimum baseline and current workload load.