Quick Guides
  • Free Trial options
  • Quick Guides: Akamas in a sandbox
    • [AIAS-01] Guide: Explore an Optimization Study for a Kubernetes microservices application
      • [AIAS-01] Architecture overview
      • [AIAS-01] Explore the Study
      • [AIAS-01] Explore the System
      • [AIAS-01] Explore the Workflow
      • [AIAS-01] Explore the analysis
      • [AIAS-01] Explore the results
    • [AIAS-02] Guide: Create a study to optimize Java performance using the Akamas UI
      • [AIAS-02] Architecture overview
      • [AIAS-02] Create the Study
      • [AIAS-02] Define the optimization goal
      • [AIAS-02] Define the optimization parameters
      • [AIAS-02] Define the performance metrics
      • [AIAS-02] Define the optimization steps
      • [AIAS-02] Explore the results
    • [AIAS-03] Guide: Create a study to optimize K8s microservices costs using the Akamas CLI
      • [AIAS-03] Architecture overview
      • [AIAS-03] Create the system
      • [AIAS-03] Create the Workflow
      • [AIAS-03] Create the Study
      • [AIAS-03] Explore the results
  • Quick Guides: Akamas in a box
    • [AIAB-00] Install Akamas-in-a-box
      • [AIAB-00] Setup your Linux box
      • [AIAB-00] Install Akamas
    • [AIAB-01] Optimize a Java-based application (Renaissance benchmark)
      • [AIAB-01] Architecture overview
      • [AIAB-01] Create the System and its associated components
      • [AIAB-01] Configure the Telemetry
      • [AIAB-01] Create the workflow
      • [AIAB-01] Create and run the study
      • [AIAB-01] Explore the results
    • [AIAB-02] Optimize a Java-based application (Konakart) with JMeter
      • [AIAB-02] Architecture overview
      • [AIAB-02] Create the system and its components
      • [AIAB-02] Automate performance tests
      • [AIAB-02] Create the Telemetry Provider
      • [AIAB-02] Create the workflow
      • [AIAB-02] Create the study
      • [AIAB-02] Explore the results
    • [AIAB-03] Optimize a Java-based application (Konakart) with LRE
      • [AIAB-03] Architecture overview
      • [AIAB-03] Setup LoadRunner Enterprise
      • [AIAB-03] Create the system and its components
      • [AIAB-03] Create the telemetry instances
      • [AIAB-03] Create the workflow
      • [AIAB-03] Create the optimization study
    • [AIAB-04] Optimize a Java-based Kubernetes application (Online Boutique)
      • [AIAB-04] Architecture overview and setup
      • [AIAB-04] Setup Online Boutique
      • [AIAB-04] Setup Akamas
      • [AIAB-04] Create the system and its components
      • [AIAB-04] Create the workflow
      • [AIAB-04] Create the Study
      • [AIAB-04] Explore the results
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Quick Guides: Akamas in a box
  2. [AIAB-02] Optimize a Java-based application (Konakart) with JMeter

[AIAB-02] Create the workflow

You can now create a new workflow that you will use in your optimization study.

A workflow in an optimization study is typically composed of the following tasks:

  • Apply a new configuration of the selected optimization parameters to the target system: in this example, you will leverage the Akamas FileConfigurator operator - this operator can be used to write parameter values into a generic file, which could represent a shell script, an application configuration file, or any other file used to apply parameters to the target systems

  • Restart the application (optional): in this example, the Konakart docker container needs to be restarted in order to launch the Konakart JVM for the new configuration to be effectively applied

  • Launch the performance test: in this example, the JMeter performance tests are launched as described in a previous section (same as the baseline workflow)

The file workflow-optimize.yaml contains the pre-configured workflow, you only need to include the correct references to your environment:

name: konakart-optimize

tasks:
- name: Configure JVM options
  operator: FileConfigurator
  arguments:
    source:
      hostname: target_host
      username: ubuntu
      key: /home/jsmith/.ssh/akamas.key
      path: /home/ubuntu/konakart-docker/konakart/docker-compose.yml.templ
    target:
      hostname: target_host
      username: ubuntu
      key: /home/jsmith/.ssh/akamas.key
      path: /home/ubuntu/konakart-docker/konakart/docker-compose.yml

- name: Restart konakart
  operator: Executor
  arguments:
    command: "docker stack deploy --compose-file /home/ubuntu/konakart-docker/konakart/docker-compose.yml sut"
    host:
      hostname: target_host
      username: ubuntu
      key: /home/jsmith/.ssh/akamas.key

- name: Performance test
  operator: Executor
  arguments:
    command: "docker run --net=akamas_lab --rm --name jmeter -i -v /home/ubuntu/konakart-docker/jmeter:/tmp -w /tmp -p 9270:9270 chiabre/jmeter_plugins -t ramp_test_plan.jmx -JTARGET_HOST=target_host -JTHREADS=40 -JRAMP_SEC=300 -JRANDOM_DELAY_MAX_MS=0"
    host:
      hostname: target_host
      username: ubuntu
      key: /home/jsmith/.ssh/akamas.key

Please make sure to modify the workflow-optimize.yaml file so as to get some variables replaced with the correct references to your environment:

  • hostname should reference your Konakart instance instead of the placeholder target_host

  • username and key must reflect your Konakart instance user and SSH private key file (also change the path /home/jsmith)

  • path and commands should have the correct file paths to Docker Compose files

  • TARGET_HOST in the JMeter command-line variable should reference your Konakart instance instead of the placeholder target_host

  • RAMP_UP_TIME in the JMeter command-line variable should be set to the desired length of the test: you may set this value to 300 seconds (5 minutes) test to make sure everything works correctly, and then change it to 900 seconds (15 minutes), which is more appropriate for optimization purposes

Once you have edited this file, you can then run the following command to create the workflow:

akamas create workflow workflow-optimize.yaml

Enable parameter configuration

In the workflow, the FileConfigurator operator is used to automatically apply the configuration of the JVM parameters at each experiment. In order for this to work, you need to allow Akamas to set the parameter values being tested in each experiment. This is made possible by the following Akamas templating approach:

  • locate your application configuration file where the optimization parameters need to be set

  • find the place where the parameter that need to be optimized is specified - for example, the heap size of the JVM: tomcat_jvm_heapsize=1024

  • replace the hardcoded value with the Akamas parameter template string, where you specify both the component name and the name of the Akamas parameter - for example: tomcat_jvm_heapsize=${jvm.maxHeapSize}

  • at this point, every time the FileConfiguration operator is invoked in your workflow, a new application configuration file will be created where each of the parameter templates replaced with the parameter values being tested by Akamas in the corresponding experiment (e.g. tomcat_jvm_heapsize=537).

Therefore, you will now prepare the Konakart configuration file (a Docker Compose file).

First of all, you want to inspect the Konakart configuration file by executing the following command:

cat konakart-docker/konakart/docker-compose.yml

which should return the following output, where you can see that the JAVA_OPTS variable specifies a maximum heap size of 256 MB:

version: "3.8"
services:
  konakart:
    image: chiabre/konakart_jmx_exporter:latest
    environment:
      JAVA_OPTS: "-Xmx1024M"
    deploy:
      resources:
...

In order to allow Akamas to be able to apply this hardcoded heap size value (and any other required as optimization parameter) at each experiment, you need to prepare a new Konakart Docker Compose file docker-compose.yml.templ where you can put the Akamas parameter template.

First, copy the Docker Compose file and rename it so as to keep the original file:

cd konakart-docker/konakart
cp docker-compose.yml docker-compose.yml.templ
mv docker-compose.yml docker-compose.yml.orig

Now, edit this file docker-compose.yml.templ file and replace the hardcoded value for the JAVA_OPTS variable with the Akamas parameter template:

version: "3.8"
services:
  konakart:
    image: chiabre/konakart_jmx_exporter:latest
    environment:
      JAVA_OPTS: "${jvm.*}"
...

aside positive

Notice that instead of specifying one single parameter at a time, Akamas also allows you to put wildcards ('*') and have all the JVM parameters replaced in place.

Therefore, the FileConfigurator operator in your workflow will expand all. the JVM parameters and replace them with the actual values provided by Akamas AI-driven optimization engine.

At this point, you are ready to create your optimization study!

Previous[AIAB-02] Create the Telemetry ProviderNext[AIAB-02] Create the study

Last updated 2 years ago

Was this helpful?