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)
This is the YAML file providing the system definition for the reference use case:
1
name: Konakart
2
description: Konakart e-commerce application
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.
1
name: Konakart jvm
2
description: jvm layer of Konakart e-commerce
3
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.
Here is a (simplified) component types definition for the reference use case.
1
name: java-openjdk-11
2
description: The component type of Java OpenJDK and Oracle HotSpot version 11
3
4
parameters:
5
- name: jvm_maxHeapSize
6
domain:
7
type: integer
8
domain: [16, 102400]
9
defaultValue: 1024
10
operators:
11
FileConfigurator:
12
confTemplate: -Xmx${value}M
13
14
- name: jvm_gcType
15
domain:
16
type: categorical
17
categories: [Serial, Parallel, ConcMarkSweep, G1]
18
defaultValue: G1
19
operators:
20
FileConfigurator:
21
confTemplate: -XX:+Use${value}GC
22
23
metrics:
24
- name: jvm_heap_size
25
- name: jvm_gc_time
1
name: Web Application
2
description: Component-type containing the metrics representing a web application.
3
4
parameters: []
5
6
metrics:
7
- name: transactions_response_time
8
- name: transactions_throughput
9
- name: transactions_error_rate
These component types are included in the "Java" and "Web Application" Optimization Packs and are available in any Akamas installation.
Here is a (simplified) definition of the java parameters related to the java component type used for the reference use case.
1
parameters:
2
- name: jvm_maxHeapSize
3
description: Maximum heap size
4
unit: megabytes
5
6
- name: jvm_gcType
7
description: Type of the garbage collection algorithm
8
unit: ""
These parameters are included in the "Java" and "Web Application" Optimization Packs and are available in any Akamas installation.
Here is a (simplified) definition of the web-application metrics related to the web-application component type used for the reference use case.
1
metrics:
2
- name: transactions_response_time
3
description: The average transaction response time
4
unit: milliseconds
5
6
- name: transactions_throughput
7
description: The number of transactions executed per second
8
unit: transactions/s
9
10
- name: transactions_error_rate
11
description: The percentage of transactions flagged as error
12
unit: percent
These parameters are included in the "Web Application" Optimization Pack and are available in any Akamas installation.