Skip to content

KIE Performance Kit

Ivo Bek edited this page Oct 2, 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>-DprojectName=${projectName}</argument>
            <argument>-Dsuite=${suite}</argument>
            <argument>-Dscenario=${scenario}</argument>
            <argument>-DstartScriptLocation=${startScriptLocation}</argument>
            <argument>-DrunType=${runType}</argument>
            <argument>-Dduration=${duration}</argument>
            <argument>-Diterations=${iterations}</argument>
            <argument>-DwarmUp=${warmUp}</argument>
            <argument>-DwarmUpCount=${warmUpCount}</argument>
            <argument>-DauditLogging=${auditLogging}</argument>
            <argument>-Dthreads=${threads}</argument>
            <argument>-DreporterType=${reporterType}</argument>
            <argument>-Dperiodicity=${periodicity}</argument>
            <argument>-DreportDataLocation=${reportDataLocation}</argument>
            <argument>-Dmeasure=${measure}</argument>
            <argument>-DperfRepo.host=${perfRepo.host}</argument>
            <argument>-DperfRepo.urlPath=${perfRepo.urlPath}</argument>
            <argument>-DperfRepo.username=${perfRepo.username}</argument>
            <argument>-DperfRepo.password=${perfRepo.password}</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();
}

}

`

Real Usage

October 02, 2015

Clone this wiki locally