Optimizing a sample Java OpenJ9 application

In this example study we’ll tune the parameters of PageRank, one of the benchmarks available in the Renaissance suite, to minimize its memory usage. Application monitoring is provided by Prometheus, leveraging a JMX exporter.

Environment setup

The test environment includes the following instances:

  • Akamas: instance running Akamas

  • PageRank: instance running the PageRank benchmark and the Prometheus monitoring service

Telemetry Infrastructure setup

To gather metrics about PageRank we will use a Prometheus and a JMX exporter. Here’s the scraper to add to the Prometheus configuration to extract the metrics from the exporter:

- job_name: jmx-exporter
  static_configs:
    - targets: ['pagerank.akamas.io:5556']
      labels:
        instance: jvm

Application and Test tool

To run and monitor the benchmark we’ll require on the PageRank instance:

Here’s the snippet of code to configure the instance as required for this guide:

Optimization setup

In this section, we will guide you through the steps required to set up the optimization on Akamas.

If you have not installed the Eclipse OpenJ9 optimization pack yet, take a look at the optimization pack page Eclipse OpenJ9 to proceed with the installation.

System

System pagerank

Here’s the definition of the system we will use to group our components and telemetry-instances for this example:

To create the system run the following command:

Component jvm

We’ll use a component of type IBM J9 VM 8 to represent the JVM underlying the PageRank benchmark. To identify the JMX-related metrics in Prometheus the configuration requires the prometheus property for the telemetry service, detailed later in this guide.

Here’s the definition of the component:

To create the component in the system run the following command:

Workflow

The workflow used for this study consists of two main stages:

  • generate the configuration file containing the tested OpenJ9 parameters

  • run the execution using previously written parameters

Here’s the definition of the workflow:

Where the configuration template is j9_opts.template is defined as follows:

To create the workflow run the following command:

Telemetry

The following is the definition of the telemetry instance that fetches metrics from the Prometheus service:

To create the telemetry instance in the system run the following command:

This telemetry instance will be able to bind the fetched metrics to the related jvm component thanks to the prometheus attribute we previously added in its definition.

Study

The goal of this study is to find a JVM configuration that minimizes the peak memory used by the benchmark.

The optimized parameters are the maximum heap size, the garbage collector used and several other parameters managing the new and old heap areas. We also specify a constraint stating that the GC regions can’t exceed the total heap available, to avoid experimenting with parameter configurations that can’t start in the first place.

Here’s the definition of the study:

To create and run the study execute the following commands:

Last updated

Was this helpful?