Modeling a sample Java-based e-commerce application (Konakart)

This page provides code snippets for each Akamas construct by considering the Konakart, a Java-based e-commerce application (https://www.konakart.com/), as a reference and modeling it as a 2-tier application, with an application server and a database (MySQL) layers.

For simplicity's sake, the optimization use case is defined as follows:

  • Optimization scope: JVM parameters

  • Optimization goal: reduce the application memory footprint (i.e. heap max that can be allocated by the JVM)

  • Optimization constraints: no impact on service level (i.e. response times, throughput, and error rate have to be the same before/after the optimization)

System

This is the YAML file providing the system definition for the reference use case:

name: Konakart
description: Konakart e-commerce application

Component

Since the optimization scope only considers JVM parameters, only a java component needs to be modeled.

The following snippet defines a Konakart java component based on a java-openjdk-11 component type.

name: Konakart jvm
description: jvm layer of Konakart e-commerce
componentType: java-openjdk-11

A different optimization scope would have required a different modeling approach. For instance, a broader optimization scope including the Linux layers of both application and database and the database layer would have required 3 additional components: 2 distinct components (of the same component type) for the 2 Linux layers and 1 component for the database layer.

From a monitoring perspective, there are only 2 mandatory data sources: the JVM layer, which will provide the goal metric needed to evaluate the score (heap size), and the web application layer, which will provide the metrics needed to evaluate optimization constraints (response time, throughput and error rate). The web-application component is based on a particular component type that aims to ease the collection of end-users metrics and has no parameters attached. Generally speaking the definition of a component based on the web application component type can be handy every time an optimization foresees the execution of a performance test and it is required to evaluate the end-to-end metrics.

The following snippet defines a Konakart component based on a web-application component type.

name: Konakart
description: Web Application layer of Konakart e-commerce
componentType: Web Application

A more comprehensive approach to telemetries could include additional metrics and data sources to provide a better understanding of the system behavior. The example provided only focuses on the mandatory metrics and the components needed to model them.

Component Type

Here is a (simplified) component types definition for the reference use case.

name: java-openjdk-11
description: The component type of Java OpenJDK and Oracle HotSpot version 11

parameters:
  - name: jvm_maxHeapSize
    domain:
      type: integer
      domain: [16, 102400]
    defaultValue: 1024
    operators:
      FileConfigurator:
        confTemplate: -Xmx${value}M

  - name: jvm_gcType
    domain:
      type: categorical
      categories: [Serial, Parallel, ConcMarkSweep, G1]
    defaultValue: G1
    operators:
      FileConfigurator:
        confTemplate: -XX:+Use${value}GC

metrics:
  - name: jvm_heap_size
  - name: jvm_gc_time
name: Web Application
description: Component-type containing the metrics representing a web application.

parameters: []

metrics:
  - name: transactions_response_time
  - name: transactions_throughput
  - name: transactions_error_rate

These component types are included in the "Java" and "Web Application" Optimization Packs and are available in any Akamas installation.

Parameters

Here is a (simplified) definition of the java parameters related to the java component type used for the reference use case.

parameters:
  - name: jvm_maxHeapSize
    description: Maximum heap size
    unit: megabytes

  - name: jvm_gcType
    description: Type of the garbage collection algorithm
    unit: ""

These parameters are included in the "Java" and "Web Application" Optimization Packs and are available in any Akamas installation.

Metrics

Here is a (simplified) definition of the web-application metrics related to the web-application component type used for the reference use case.

metrics:
  - name: transactions_response_time
    description: The average transaction response time
    unit: milliseconds

  - name: transactions_throughput
    description: The number of transactions executed per second
    unit: transactions/s

 - name: transactions_error_rate
    description: The percentage of transactions flagged as error
    unit: percent

These parameters are included in the "Web Application" Optimization Pack and are available in any Akamas installation.

Last updated