# \[AIAB-03] Create the optimization study

In this guide, your goal is to optimize Konakart performance such that:

* throughput is maximized so that your e-commerce service can successfully support the high traffic peaks expected in the upcoming highly demanding season
* as you need to take into account the customer experience, you want also to make sure that the response time always remains within the required service-level objective (SLO) of 100ms.

This business-level goal translates into the following configuration for your Akamas study:

* goal: maximize `transactions_throughput` metric
* constraint: `transactions_response_time` metric to stay under 100ms

You can simply take the following description of your study and copy it in a `study-max-throughput-with-SLO.yaml` file:

```yaml
name: Optimize konakart throughput with response time SLO
description: Tune the JVM to increase transaction throughput while keeping good performance
system: konakart

goal:
  objective: maximize
  function:
    formula: konakart.transactions_throughput
  constraints:
    absolute:
    - name: ResponseTimeSLO
      formula: konakart.transactions_response_time <= 100    # 100ms service-level objective (SLO)

windowing:
  type: stability
  stability:
    metric: konakart.transactions_response_time
    width: 2
    maxStdDev: 1000000
    when:
      metric: konakart.transactions_throughput
      is: max

workflow: konakart-optimize

parametersSelection:
  - name: jvm.jvm_gcType
  - name: jvm.jvm_maxHeapSize
    domain: [32,1024]
  - name: jvm.jvm_newSize
    domain: [16,1024]
  - name: jvm.jvm_survivorRatio
  - name: jvm.jvm_maxTenuringThreshold
  - name: jvm.jvm_parallelGCThreads
    domain: [1,4]
  - name: jvm.jvm_concurrentGCThreads

parameterConstraints:
  - name: "JVM max heap must always be greater than new size"
    formula: jvm.jvm_maxHeapSize > jvm.jvm_newSize
  - name: "JVM GC concurrent threads must always be less than or equal to parallel"
    formula: jvm.jvm_parallelGCThreads >= jvm.jvm_concurrentGCThreads

steps:
  - name: baseline
    type: baseline
    values:
      jvm.jvm_maxHeapSize: 256

  - name: optimize
    type: optimize
    numberOfExperiments: 50
```

and then run the following command to create your study:

```bash
akamas create study study-max-throughput-with-SLO.yaml
```


---

# Agent Instructions: 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:

```
GET https://docs.akamas.io/quick-guides/quick-guides-akamas-in-a-box/aiab-03-optimize-a-java-based-application-konakart-with-lre/aiab-03-create-the-optimization-study.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
