# Live Optimization Study

**Live Optimization studies** are [optimization studies](optimization-studies) where the workload is real: the system that needs to be optimized operates with respect to varying workloads observed while running live.

Live optimization studies are typically used to optimize systems in production environments. For example, a microservices application can be optimized while running in production by having Kubernetes and JVM parameters dynamically tuned for multiple microservices so as to minimize costs while matching response time objectives.

The following figure represents the iterative process associated with offline optimizations:

<figure><img src="https://1840531935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC1d2wNp5yTa9gnHgSILG%2Fuploads%2Fgit-blob-e32421620d1b56be2db4848c9d2942807b364a12%2FLive_Level%203.png?alt=media" alt=""><figcaption></figcaption></figure>

The following 5 phases can be identified for each iteration:

1. **Collect KPIs**: Akamas collects the [metrics](parameter) of the system required to observe its behavior under the current parameter configuration by leveraging the associated [telemetry provider](telemetry-providers) - here Akamas is also observing and categorizing the different workload contexts that are used to recommend configurations that are appropriate for each specific workload context
2. **Score vs Goal**: Akamas scores the applied parameter configuration under the specific workload context against the defined [goal and constraints](goals-and-constraints)
3. **Recommend Conf**: Akamas provides a recommendation for parameter configuration based on the observed behavior under the specific workload context and leveraging the Akamas AI
4. **Human Approval**: this is an optional step as there are two operational modes:
   * **autonomous mode**: no human intervention is required
   * **human-approval mode**: recommendations need to be approved by users before configuration changes get applied - recommendations can be changed by users
5. **Apply Conf**: Akamas applies the recommended (and possibly revisited) configuration, by leveraging the defined [workflow](workflows).

Notice that configurations can be applied by Akamas via integrations with native interfaces (e.g. Kubectl), by leveraging any orchestration and automation tool in place (e.g. OpenShift), or by triggering a pull request to a configuration repository (e.g. Git). This can be applied to either the entire target system or to a canary deployment.

### Safety Policies

Akamas provides several customizable policies for live optimization studies to ensure that recommended configuration changes to production environments are as safe as possible. Akamas safety policies include gradual optimization, smart constraints, and outlier detection. For more details, see [settings safety policies](../../using-akamas/preparing-optimization-studies/creating-optimization-studies/setting-safety-policies).

## Commands

A live optimization study is an [Akamas resource](../../cli-reference#clireference-operations) that can be managed via CLI using [resource management commands.](../cli-reference/cli-reference-2)

## User Interface

The Akamas UI shows live optimization studies in a specific top-level menu.

<figure><img src="https://1840531935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC1d2wNp5yTa9gnHgSILG%2Fuploads%2Fgit-blob-1a634452e5ad279dbbb0165fbbc6114938023f09%2FScreenshot%202022-12-22%20at%2011.32.35.png?alt=media" alt=""><figcaption></figcaption></figure>

The details and results of an offline optimization study are displayed when drilling down.

<figure><img src="https://1840531935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC1d2wNp5yTa9gnHgSILG%2Fuploads%2Fgit-blob-66cf7eda8652ed8a1e08aee3143c28720e5ae82e%2FScreenshot%202022-12-22%20at%2011.32.15.png?alt=media" alt=""><figcaption></figcaption></figure>
