# \[AIAB-02] Automate performance tests

Next you will need to create a workflow that specifies how Akamas applies the parameters to be optimized, how to automate the launch of JMeter performance tests, and how to collect metrics from Prometheus telemetry. For now, you will create a simple automation workflow that executes a quick two-minute performance test to make sure everything is working properly.

The file `workflow-baseline.yaml` contains the definition of the steps to perform during the test:

```yaml
name: konakart-baseline
tasks:
  - name: Performance test
    operator: Executor
    arguments:
      command: "docker run --net=akamas_lab --rm --name jmeter -i -v $(pwd)/konakart-docker/jmeter:/tmp -w /tmp -p 9270:9270 chiabre/jmeter_plugins -t ramp_test_plan.jmx -JTARGET_HOST=target_host -JTHREADS=10 -JRAMP_SEC=120 -JRANDOM_DELAY_MAX_MS=0"
      host:
        hostname: target_host
        username: ubuntu
        key: /home/jsmith/.ssh/akamas.key
```

Please make sure to modify the `workflow-baseline.yaml` file replacing the following placeholders with the correct references to your environment:

* *hostname* should reference your Konakart instance in place of the placeholder *target\_host*
* *username* and *key* must reflect your Konakart instance user and SSH private key file (also check the path /home/jsmith)
* *TARGET\_HOST* in the JMeter command line should reference your Konakart instance in place of the placeholder *target\_host*

Then create the workflow:

```bash
akamas create workflow workflow-baseline.yaml
```

To execute this workflow we'll use a simple Akamas study that includes a single step of type `baseline`. This type of step simply executes one experiment without leveraging Akamas AI - you will add the AI-driven optimization step later.

The `study-baseline.yaml` file defines the study as follows:

```yaml
name: Baseline konakart
description: A first study to validate the automated testing process
system: konakart

goal:
  objective: maximize
  function:
    formula: konakart.transactions_throughput

workflow: konakart-baseline

steps:
  - name: baseline
    type: baseline
```

Create the study:

```bash
akamas create study study-baseline.yaml
```

Now, you can run the study by clicking **Start** from the UI, or by executing the following command:

```bash
akamas start study 'Baseline konakart'
```

You should now see the baseline experiment running in the **Progress** tab of the Akamas UI.

Notice that you can also monitor JMeter performance tests live by accessing Grafana on port `3000` of your Konakart instance, then selecting the *JMeter Exporter* dashboard:

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

You can relaunch the baseline study at any time you want by pressing the **Start** button again. If you want, you can also adjust the JMeter scenario settings in the workflow - see the Konakart setup guide for more details on the JMeter plans and variables you can set.

You will notice that the baseline experiment will fail on the telemetry task - see **Progress** tab in the UI. This is expected, as you still have not configured the Akamas telemetry, i.e. how Akamas can collect metrics - you will do this in the next section.


---

# 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-02-optimize-a-java-based-application-konakart-with-jmeter/aiab-02-automate-performance-tests.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.
