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 to gather metrics through the dedicated NeoLoad Web operator and the NeoLoad Web provider.

Optimization setup

System

The following snippets contain the system definition composed by a JVM running the petstore web application.

System: webapplication

name: webapplication
description: Petstore server

Component: jvm

name: jvm
description: JVM underlying the petstore application
componentType: openjdk-11
properties:
  instance: "petstore"

Component: webapp

name: webapp
description: Petstore web-application
componentType: Web Application

Telemetry instance: NeoLoadWeb

provider: NeoLoadWeb
config:
  accountToken: NLW_TOKEN

Workflow

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:

name: neoloadweb_wf
tasks:
  - name: Set Java parameters
    operator: FileConfigurator
    arguments:
      source:
        hostname: app.petstore.com
        username: ubuntu
        key: # ...
        path: /home/ubuntu/akamas/conf_template
      target:
        hostname: app.petstore.com
        username: ubuntu
        key: # ...
        path: /home/ubuntu/akams/jvm.conf

  - name: Restart JVM
    operator: Executor
    arguments:
      command: bash /home/ubuntu/akamas/configure_and_restart.sh
      host:
        # script location ...

  - name: run NeoLoadWeb load test
    operator: NeoLoadWeb
    arguments:
      accountToken: NLW_TOKEN
      projectFile:
        # projectfile location ...

Study

Here’s a study in which Akamas tries 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 to ensure the configuration does not degrade the service performances (throughput, response time, and error rate) below the acceptance level.

name: optimize_webapp_memory
system: webapplication
workflow: neoloadweb_wf
goal:
  objective: minimize
  function:
    formula: heap
    variables:
      heap:
        metric: jvm.jvm_maxHeapSize

  constraints:
    - metric: webapp.transactions_throughput
      greaterThan: 300
    - metric: webapp.transactions_response_time_max
      lowerThan: 6500
    - metric: webapp.transactions_response_time
      lowerThan: 600
    - metric: webapp.transactions_error_rate
      lowerThan: 0.1

parametersSelection:
  - name: jvm.jvm_maxHeapSize
    domain: [16, 2000]
  - name: jvm.jvm_gcType
    categories: [-XX:+UseG1GC, -XX:+UseParallelGC, -XX:+UseConcMarkSweepGC, -XX:+UseSerialGC]

numberOfTrials: 3
steps:
  - name: baseline
    type: baseline
    values:
      jvm.jvm_maxHeapSize: 2000
      jvm.jvm_gcType: -XX:+UseG1GC

  - name: optimization
    type: optimize
    numberOfExperiments: 99
    maxFailedExperiments: 25

Last updated