Setting up a Konakart environment for testing Akamas

This page describes how to setup a simple yet complete performance testing environment that you can use for running Akamas offline optimization study:

  • The target application is Konakart, a real-world Java-based e-commerce application

  • JMeter will be used to execute stress tests, with built-in sample scenarios

  • Prometheus will be used to monitor the environment (load test, JVM and OS metrics)

Reference Architecture

The following picture describes the high-level Akamas architecture that is enabled by this setup.

Setup Docker Swarm

First of all, install Docker on your Linux box:

sudo apt update && sudo apt install docker.io

Now enable the user ubuntu to run docker without sudo:

sudo usermod -aG docker $USER
newgrp docker

In this environment we leverage Docker Swarm, a Docker native container orchestration system. Even though in this scenario everything runs on a single machine, Swarm is handy as it provides the ability to specify container resource limits (e.g. how many CPUs and how much memory the container can use) which can be very useful from a tuning perspective.

At this point, we can initialize Docker Swarm with this simple command:

docker swarm init

You should see a message stating that Docker Swarm has been setup.

You now create a Docker network that all the containers will use to communicate:

docker network create -d overlay --attachable akamas_lab

Setup Konakart

In order to setup Konakart, first clone this repository:

git clone https://github.com/akamaslabs/konakart-docker.git

Now you can start Konakart by running:

docker stack deploy --compose-file konakart-docker/konakart/docker-compose.yml sut

You can now verify that Konakart is up and running by accessing your instance on port 8780:

Setup JMeter (optional)

Unless you plan to use a different load testing tool (such as LoadRunner Enterprise or Neotys NeoLoad), JMeter is a great choice to start using Akamas.

Setting up JMeter is straightforward as a JMeter container comes already configured with test plans built for performance testing Konakart. Moreover, JMeter is already configured with the Prometheus integration so that performance test metrics (e.g. transaction throughput and transaction response time) are collected via Prometheus Listener for JMeter. You just need to verify the ability to launch a performance test in this environment.

You can launch a first manual performance test by running the following command, where you need to replace YOUR_INSTANCE_ADDRESS with the address of your Konakart instance:

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=YOUR_INSTANCE_ADDRESS

You should see an output similar to the one displayed here below, indicating that JMeter is running successfully:

START Running Jmeter on Fri Apr  2 06:35:35 UTC 2021
jmeter log level = OFF
jmeter defautl args -n -Dlog_level.jmeter=OFF -Jprometheus.ip=0.0.0.0
jmeter user args -t ramp_test_plan.jmx -JTARGET_HOST=konakart.dev.akamas.io -JTHREADS=40
Creating summariser <summary>
Created the tree successfully using ramp_test_plan.jmx
Starting standalone test @ Fri Apr 02 06:35:37 GMT 2021 (1617345337225)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary +    153 in 00:00:23 =    6.8/s Avg:    44 Min:     9 Max:  1300 Err:     0 (0.00%) Active: 5 Started: 5 Finished: 0
summary +    612 in 00:00:30 =   20.4/s Avg:    25 Min:     5 Max:   324 Err:     0 (0.00%) Active: 11 Started: 11 Finished: 0
summary =    765 in 00:00:53 =   14.5/s Avg:    29 Min:     5 Max:  1300 Err:     0 (0.00%)
summary +   1071 in 00:00:30 =   35.8/s Avg:    26 Min:     4 Max:   335 Err:     0 (0.00%) Active: 17 Started: 17 Finished: 0
summary =   1836 in 00:01:23 =   22.2/s Avg:    27 Min:     4 Max:  1300 Err:     0 (0.00%)
summary +   1408 in 00:00:30 =   46.9/s Avg:    60 Min:     4 Max:  1087 Err:     0 (0.00%) Active: 23 Started: 23 Finished: 0
summary =   3244 in 00:01:53 =   28.8/s Avg:    41 Min:     4 Max:  1300 Err:     0 (0.00%)
summary +   1831 in 00:00:30 =   61.0/s Avg:    60 Min:     4 Max:  1634 Err:     0 (0.00%) Active: 29 Started: 29 Finished: 0
summary =   5075 in 00:02:23 =   35.6/s Avg:    48 Min:     4 Max:  1634 Err:     0 (0.00%)
summary +   1913 in 00:00:30 =   63.7/s Avg:   137 Min:     5 Max:  2024 Err:     0 (0.00%) Active: 35 Started: 35 Finished: 0
summary =   6988 in 00:02:53 =   40.5/s Avg:    72 Min:     4 Max:  2024 Err:     0 (0.00%)
summary +   1785 in 00:00:28 =   63.3/s Avg:   225 Min:     8 Max:  2833 Err:     0 (0.00%) Active: 0 Started: 40 Finished: 40
summary =   8773 in 00:03:21 =   43.7/s Avg:   103 Min:     4 Max:  2833 Err:     0 (0.00%)
Tidying up ...    @ Fri Apr 02 06:38:58 GMT 2021 (1617345538215)
... end of run
END Running Jmeter on Fri Apr  2 06:38:58 UTC 2021

In case you see any errors (check out the Err: column), chances are that JMeter cannot contact Konakart. Please verify that your instance address is correct and relaunch the manual test until you are sure JMeter is running correctly.

Test plans

The JMeter docker image includes a couple of test plans described here below:

Ramp test plan

This test allows you to stress test Konakart with a ramp load profile. This profile is included in the ramp_test_plan.jmx file.

You can customize the profile by setting the following JMeter variables (see the example above):

  • THREADS, the maximum number of virtual users (default 20)

  • RAMP_SEC, the load test duration in seconds (default 200)

Plateau test plan

This test allows you to do a performance test of Konakart with an initial ramp-up and then with a constant load. This profile is included in the plateau_test_plan.jmx file.

You can customize the scenario by setting the following JMeter variables (see the example above):

  • THREADS, the maximum number of virtual users (default 20)

  • RAMP_UP_MIN, the ramp-up duration in minutes (default 1)

  • RAMP_UP_COUNT, the number of steps in the ramp (default 5)

  • HOLD_MIN, the plateau duration in minutes (default 5)

Setup Prometheus (optional)

Unless you plan to use a different monitoring tool (such as Dynatrace), Prometheus is a great choice to start using Akamas.

Now that Konakart and JMeter are up and running, the last step is to setup Prometheus. In this scenario, Prometheus allows you to gather any metrics you will need for your Akamas optimizations, for example, the performance test metrics measured by JMeter (e.g. transaction throughput and response time) or related to application resource usage.

This environment also includes a number of useful dashboards that you can use to monitor the application, infrastructure and load testing key metrics.

By running the following command you can launch Prometheus and Grafana, plus a set of preconfigured dashboards to monitor your load tests:

docker stack deploy -c konakart-docker/monitoring/docker-compose.yml monitoring

Explore Grafana dashboards (optional)

The following is a quick overview of the preconfigured dashboards that you can use to monitor the application, infrastructure and load-testing key metrics. These dashboards are available as part of the Prometheus installation.

You can view this dashboard by accessing Grafana on port 3000 of your Konakart instance.

JMeter Exporter

The JMeter dashboard allows you to monitor your performance tests.

For example, run again the JMeter performance test described before and see the results in the JMeter dashboard:

Docker Container

The Docker dashboard allows you to see the resource consumption of your containers, including the Konakart application:

JMX Exporter

The Node dashboard allows you to see the OS-level Linux performance metrics of your instance:

At this point, you have a simple test environment for your Akamas optimizations.

Last updated