Tips & Tricks

Profilers

Hyperon Runtime gives you built-in profilers, which you can use to figure out hot spots or verify your assumptions. You are able to use four types of profiles:

  • SQL profiler
  • Parameter usage profiler
  • Function usage profiler
  • Domain attribute usage profiler

1. Checking statistics

1.1. Hyperon Runtime

SQL profiler

JdbcProfiler is responsible for collecting SQL query statistics. It provides the following details:

  • totalTime = total time in milliseconds
  • count = number of times given SQL was invoked
  • sql = SQL query that was invoked

JDBC query statistics in Hyperon Runtime can be fetched by using the pl.decerto.hyperon.runtime.profiler.jdbc.JdbcProfiler class. To get statistics just invoke getQueryStats() method, as shown below:

JdbcProfiler profiler = JdbcProfiler.getSingleton();
List<QueryStat> queryStats = profiler.getQueryStats();
//do something with fetched stats

To reset load stats, invoke clear() method as shown below:

JdbcProfiler.getSingleton().clear()

Parameter usage profiler

Parameter profiler provides invoke and load statistics:

  • totalTime = total invoke time in milliseconds
  • minTime = minimal invoke time in milliseconds
  • maxTime = maximal invoke time in milliseconds
  • count = number of times given parameter was invoked
  • key = parameter's code

Remember that the first invocation of a parameter performs two heavy operations:

  • fetching a whole matrix,
  • building an in-memory index for fast searches.

All subsequent invocations are fast, as no I/O is needed - just in-memory index look up.

Parameter profiler in Hyperon Runtime can be fetched by using the pl.decerto.hyperon.runtime.profiler.engine.EngineProfiler.PARAMETER enum. To get invoke statistics just invoke getInvokeStats() method, as shown below:

List<ProfilerStat> invokeStats = EngineProfiler.PARAMETER.getInvokeStats(); 
//do something with invoke stats

To reset invoke stats, invoke clear() method as shown below:

EngineProfiler.PARAMETER.getInvokeProfiler().clear()

To get load statistics just invoke getLoadStats() method, as shown below: 

List<ProfilerStat>  loadStats = EngineProfiler.PARAMETER.getLoadStats();
//do something with load stats

To reset load stats, invoke clear() method as shown below:

EngineProfiler.PARAMETER.getLoadProfiler().clear()

Function usage profiler

Function profiler provides invoke and load statistics:

  • totalTime = total invoke time in milliseconds
  • minTime = minimal invoke time in milliseconds
  • maxTime = maximal invoke time in milliseconds
  • count = number of times given function was invoked
  • key = function's code

Remember that the first invocation of function performs function compiling that might take some time. All subsequent invocations are fast, as no compilation is needed.

Function profiler in Hyperon Runtime can be fetched by using the pl.decerto.hyperon.runtime.profiler.engine.EngineProfiler.FUNCTION enum. To get invoke statistics just invoke getInvokeStats() method, as shown below:

List invokeStats = EngineProfiler.FUNCTION.getInvokeStats();
//do something with invoke stats

To reset invoke stats, invoke clear() method as shown below:

EngineProfiler.FUNCTION.getInvokeProfiler().clear()

To get load statistics just invokegetLoadStats() method, as shown below:

List<ProfilerStat> loadStats = EngineProfiler.FUNCTION.getLoadStats();
//do something with load stats

To reset load stats, invoke clear() method as shown below:

EngineProfiler.FUNCTION.getLoadProfiler().clear()

Domain attribute usage profiler

Domain attribute profiler provides invoke and load statistics:

  • totalTime = total invoke time in milliseconds
  • minTime = minimal invoke time in milliseconds
  • maxTime = maximal invoke time in milliseconds
  • count = number of times given attribute was invoked
  • key = domain attribute's code

Domain attribute profiler in Hyperon Runtime can be fetched by using the pl.decerto.hyperon.runtime.profiler.engine.AttributeEngineProfiler.DOMAIN enum. To get invoke statistics just invoke getInvokeStats() method, as shown below: 

List<ProfilerStat> invokeStats = AttributeEngineProfiler.DOMAIN.getInvokeStats();
//do something with invoke stats

To reset invoke stats, invoke clear() method as shown below:

AttributeEngineProfiler.DOMAIN.getInvokeProfiler().clear()

To get load statistics just invoke getLoadStats() method, as shown below:

List<ProfilerStat> loadStats = AttributeEngineProfiler.DOMAIN.getLoadStats();
//do something with load stats

To reset load stats, invoke clear() method as shown below:

AttributeEngineProfiler.DOMAIN.getLoadProfiler().clear()

1.2 Hyperon Runtime-REST

For Hyperon Runtime-Rest profilers are available under respective REST endpoints.

SQL profiler

http://{host}:{port}/api/profiler/jdbc

Parameter usage profiler

http://{host}:{port}/api/profiler/parameter

Function usage profiler

http://{host}:{port}/api/profiler/function

Domain attribute usage profiler

http://{host}:{port}/api/profiler/domain/attr

1.3 Hyperon Studio

All profilers for Hyperon Studio are available under http://{host}:{port}/hyperon/profiler. In Hyperon Studio, profilers are providing information only about your tester executions.