> For the complete documentation index, see [llms.txt](https://docs.akamas.io/quick-guides/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.akamas.io/quick-guides/quick-guides-akamas-in-a-sandbox/aias-03-guide-create-a-study-to-optimize-k8s-microservices-costs-using-the-akamas-cli/aias-03-create-the-study.md).

# \[AIAS-03] Create the Study

It's now time to define the optimization study. The overall objective is to increase the cost efficiency of the application, without impacting application reliability in terms of response time or error rates.

To achieve that objective, you create an Akamas study with the **goal** of maximizing the ratio between application throughput and cloud cost, where:

* Application throughput is the transactions per second as measured by the load-testing tool
* Cloud cost is the total cost to run Kubernetes microservices on the cloud, and is a function of the CPU and memory requests assigned to each container. We assume a sample pricing of $29 per CPU core/month and $3.2 per memory GB/month.

Hence, a good configuration is one that either increases throughput with the same cloud cost, or that keeps throughput constant but with a lower cloud cost.

To avoid impacting **application reliability**, you can define Akamas metric constraints on transaction response time lower than 500 milliseconds and error rate below 2%.

Here is the relevant section of the study:

```yaml
goal:
  objective: maximize
  function:
    formula: online_boutique.transactions_throughput / online_boutique.cost
  constraints:
    absolute:
      - name: response_time
        formula: online_boutique.transactions_response_time <= 500
      - name: error_rate
        formula: online_boutique.transactions_error_rate <= 0.02
```

Regarding the **parameters to optimize**, in this example Akamas is tuning CPU and memory limits (requests are set equal to the limits) of each deployment in the Online Boutique application, for a total of 22 parameters. Here is the relevant section of the study:

```yaml
parametersSelection:
  - name: frontend.cpu_limit
    domain: [100, 300]
  - name: frontend.memory_limit
    domain: [64, 512]
  - name: adservice.cpu_limit
    domain: [100, 300]
  - name: adservice.memory_limit
    domain: [64, 512]
    ...
```

{% hint style="info" %}
You can review the complete optimization study by looking at the `study.yaml` file in the `akamas/studies` folder.
{% endhint %}

You can now create the optimization study:

```bash
akamas create study kubernetes-online-boutique/akamas/studies/study.yaml
```

and then start the optimization:

```bash
akamas start study 'Maximizing Kubernetes Online Boutique cost efficiency while matching SLOs'
```

You can now explore this study from the Study menu in the Akamas UI and then move to the Analysis tab.

<figure><img src="/files/lfJ52HIM4t1JES3rsMS2" alt=""><figcaption></figcaption></figure>

As the optimization study executes the different experiments, this chart will display more points and their associated score.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.akamas.io/quick-guides/quick-guides-akamas-in-a-sandbox/aias-03-guide-create-a-study-to-optimize-k8s-microservices-costs-using-the-akamas-cli/aias-03-create-the-study.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
