Skip to content

KIE Performance Kit

Ivo Bek edited this page Jun 23, 2015 · 3 revisions

WikiKIE Performance Kit

KIE Performance Kit is a platform for running performance scenarios, measuring, and reporting metrics.

Supported scenario suites:

  • LoadSuite
  • ConcurrentLoadSuite

Both scenario suites expect scenarios to be located in the package "org.kie.perf.scenario.load".

Dependencies

`

<dependency>
    <groupId>org.kie</groupId>
    <artifactId>kie-performance-kit</artifactId>
</dependency>
<dependency>
    <groupId>io.dropwizard.metrics</groupId>
    <artifactId>metrics-core</artifactId>
</dependency>
<dependency>
    <groupId>io.dropwizard.metrics</groupId>
    <artifactId>metrics-jvm</artifactId>
</dependency>

`

Plugin

`

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <configuration>
        <executable>java</executable>
        <arguments>
            <argument>-Dscenario=${scenario}</argument>
            <argument>-classpath</argument>
            <classpath />
            <argument>org.kie.perf.Executor</argument>
        </arguments>
    </configuration>
</plugin>

`

New Scenario

Every scenario has to implement IPerfTest interface providing these operations:

  • init() - single time setup before all executions of the same scenario
  • initMetrics() - single time setup of all metrics
  • execute() - the main part during which we measure the metrics (beware that it is usually run many times)
  • close() - method to release resources just once at the end of all executions of this scenario

`

public class LIntermediateSignalProcess implements IPerfTest {

private JBPMController jc; // not available in kie-performance-kit but it is own management class (see jbpm-performance-tests in kie-tests)

private Timer startProcess;
private Timer signalDuration;
private Meter completedProcess;

@Override
public void init() {
    jc = JBPMController.getInstance();
    jc.addProcessEventListener(new DefaultProcessEventListener(){
        @Override
        public void afterProcessCompleted(ProcessCompletedEvent event) {
            completedProcess.mark(); // to be able to verify that under load the process behaves correctly
        }
    });
    
    jc.createRuntimeManager(ProcessStorage.IntermediateSignal.getPath());
}

@Override
public void initMetrics() {
    MetricRegistry metrics = SharedMetricRegistry.getInstance();
    completedProcess = metrics.meter(MetricRegistry.name(LIntermediateSignalProcess.class, "scenario.process.completed"));
    startProcess = metrics.timer(MetricRegistry.name(LIntermediateSignalProcess.class, "scenario.process.start.duration"));
    signalDuration = metrics.timer(MetricRegistry.name(LIntermediateSignalProcess.class, "scenario.signal.duration"));
}

@Override
public void execute() {
    Timer.Context context;

    context = startProcess.time(); // begin start process duration
    RuntimeEngine runtimeEngine = jc.getRuntimeEngine(); 
    KieSession ksession = runtimeEngine.getKieSession();
    ProcessInstance pi = ksession.startProcess(ProcessStorage.IntermediateSignal.getProcessDefinitionId());
    context.stop(); // end start process duration
    
    context = signalDuration.time(); // start signal duration
    ksession.signalEvent("MySignal", "value", pi.getId());
    context.stop(); // end signal duration
}

@Override
public void close() {
    jc.tearDown();
}

}

`

June 23, 2015

Clone this wiki locally