Optimizing a web application
In this study, Akamas will optimize a web application by tuning the JVM parameters. The workflow leverages NeoLoad’s load generator through the dedicated NeoLoad Web operator and the NeoLoad Web provider to gather the metrics.
The following snippets contain the definition of the system composed by a JVM running the petstore web application.
System: _webapplication_
1
name: webapplication
2
description: Petstore server
Component: _jvm_
1
name: jvm
2
description: JVM underlying the petstore application
3
componentType: openjdk-11
4
properties:
5
instance: "petstore"
Component: _webapp_
1
name: webapp
2
description: Petstore web-application
3
componentType: Web Application
Telemetry instance: _NeoLoadWeb_
1
provider: NeoLoadWeb
2
config:
3
accountToken: NLW_TOKEN
Here’s a workflow that creates a new configuration file by interpolating the tuned parameters in a template file, restarts the application to apply the parameters, and triggers the execution of a load test:
1
name: neoloadweb_wf
2
tasks:
3
- name: Set Java parameters
4
operator: FileConfigurator
5
arguments:
6
source:
7
hostname: app.petstore.com
8
username: ubuntu
9
key: # ...
10
path: /home/ubuntu/akamas/conf_template
11
target:
12
hostname: app.petstore.com
13
username: ubuntu
14
key: # ...
15
path: /home/ubuntu/akams/jvm.conf
16
17
- name: Restart JVM
18
operator: Executor
19
arguments:
20
command: bash /home/ubuntu/akamas/configure_and_restart.sh
21
host:
22
# script location ...
23
24
- name: run NeoLoadWeb load test
25
operator: NeoLoadWeb
26
arguments:
27
accountToken: NLW_TOKEN
28
projectFile:
29
# projectfile location ...
Here’s a study in which Akamas tries to minimize to minimize the Java memory consumption by acting only on the heap size and on the type of garbage collector.
The web application metrics are used in the constraints in order to ensure the configuration does not degrade the service performances (throughput, response time, and error rate) below the acceptance level.
1
name: optimize_webapp_memory
2
system: webapplication
3
workflow: neoloadweb_wf
4
goal:
5
objective: minimize
6
function:
7
formula: heap
8
variables:
9
heap:
10
metric: jvm.jvm_maxHeapSize
11
12
constraints:
13
- metric: webapp.transactions_throughput
14
greaterThan: 300
15
- metric: webapp.transactions_response_time_max
16
lowerThan: 6500
17
- metric: webapp.transactions_response_time
18
lowerThan: 600
19
- metric: webapp.transactions_error_rate
20
lowerThan: 0.1
21
22
parametersSelection:
23
- name: jvm.jvm_maxHeapSize
24
domain: [16, 2000]
25
- name: jvm.jvm_gcType
26
categories: [-XX:+UseG1GC, -XX:+UseParallelGC, -XX:+UseConcMarkSweepGC, -XX:+UseSerialGC]
27
28
numberOfTrials: 3
29
steps:
30
- name: baseline
31
type: baseline
32
values:
33
jvm.jvm_maxHeapSize: 2000
34
jvm.jvm_gcType: -XX:+UseG1GC
35
36
- name: optimization
37
type: optimize
38
numberOfExperiments: 99
39
maxFailedExperiments: 25