Skip to content

Commit

Permalink
Loadtest (#26)
Browse files Browse the repository at this point in the history
Load test
  • Loading branch information
pierre-yves-monnet authored Jul 6, 2023
1 parent dc01031 commit f49249a
Show file tree
Hide file tree
Showing 93 changed files with 6,624 additions and 1,048 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# docker build -t zeebe-cherry-officepdf:1.0.0 .
FROM openjdk:17-alpine
EXPOSE 9081
COPY target/process-execution-automator-*-exec.jar /app.jar
COPY src/main/resources /app/scenarii
COPY src/test/resources /app/scenarii
ENTRYPOINT ["java","-jar","/app.jar"]

283 changes: 49 additions & 234 deletions README.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions doc/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# Docker

## Manual

````
> docker build -t pierreyvesmonnet/processautomator:1.0.0 .
> docker push pierreyvesmonnet/processautomator:1.0.0
````
7 changes: 7 additions & 0 deletions doc/flowscenario/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Unit Scenario

## Goal

## Scenario definition

## execute
7 changes: 7 additions & 0 deletions doc/kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Kubernetes


## Start

cd k8s
kubectl create -f pa-DiscoverySeedExtraction.yaml
176 changes: 176 additions & 0 deletions doc/scenarioreference/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Scenario reference



A scenario is a JSON file. A scenario explains one execution, from the process creation until a
point. It may not be the end of the process: Automator can be used to advance process instances
until a specific task. It contains:

* Information on the process: which process has to start? Some information on a delay between two
creations can be set
* Service task can be registered: Automator will check the process instance executes the task (but
does not execute it)
* The end event can be registered to verify that the process goes to the end The process instance
can execute other tasks: Automator does not verify that, except if the "mode verification" is set
to "Strict."


# Different BPM

The Automator executes a process instance. It does not care about the definition of the process:
does the process instance call a sub-process? An Event sub-process? It does not matter.

## Call Activity and sub-process

Automator does not care about these artifacts. An execution is a suite of Activities. These
activities are in the process, or a sub-process does not change the execution.

## User Multi-instance

A process can have a multi-instances task. In the scenario, each task may have multiple executions.
It is possible to execute a multi-instance and give different values for each execution.

## External operation

A scenario may consist of executing some task and then sending a Cancellation message or starting a
process instance in a different process to get a Cancellation message. This is possible to describe
this operation in a step.

## Example

`````json


{
"name": "execution Round 14",
"version": "1.2",
"processId": "MergingInclusive",
"executions": [
{
"name": "multinstance",
"policy": "STOPATFIRSTERROR",
"numberProcessInstances": 100,
"numberOfThreads": 5,
"steps": [
{
"type": "STARTEVENT",
"taskId": "StartEvent_1"
},
{
"type": "SERVICETASK",
"taskId": "Get context",
"executiontargetms": 10000
},
{
"type": "USERTASK",
"taskId": "Review level 1",
"waitingTime": "PT5S",
"numberofexecution": 10,
"taskvariable": {
"statusreview": "YES"
}
}
],
"verifications": {
"activities": [
{
"type": "USERTASK",
"taskId": "Review level 1",
"state": "ACTIVE"
},
{
"type": "ENDEVENT",
"taskId": "Application Done"
}
],
"variables": [
{
"variableName": "Score",
"variableValue": 120
}
],
"performances": [
{
"taskIdBegin": "getScore",
"taskIdEND": "getScore",
"performanceTarget": "PT0.5S"
},
{
"taskIdBegin": "getScore",
"taskIdEND": "riskLevel",
"performanceTarget": "PT4S"
}
]
}
}
]
}
`````

## Execution parameters

| Parameter | Explanation | Example |
|------------------------|--------------------------------------------------------------------------------------------------------|---------------------------------|
| Name | Name of execution | "name": "This is the first run" |
| policy | "STOPATFIRSTERROR" or "CONTINUE": in case of error, what is the next move. Default is STOPATFIRSTERROR | "policy": "STOPATFIRSTERROR" |
| numberProcessInstances | Number of process instance to create. Each process instance follows steps. | "numberProcessInstances": 45 |
| numberOfThreads | Number of thread to execute in parallel. Default is 1. | "numberOfThreads": 5 |
| execution | if false, the execution does not start. Unot present, the default value is TRUE. | "execution" : false |

Then the execution contains a list of steps

## STARTEVENT step

Start a new process instance

| Parameter | Explanation | Example |
|--------------------|-------------------------------|---------------------------|
| type | Specify the type (STARTEVENT) | type: "STARTEVENT" |
| taskId | Activity ID of start event | actiityId= "StartEvent_1" |

## USERTASK step

The step wait for a user task, and execute it.

| Parameter | Explanation | Example |
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| type | Specify the type (USERTASK) | type: "USERTASK" |
| delay | Deplay to wait before looking for the task, in ISO 8601 | delay="PT0.1S" waits 100 ms |
| waitingTime | Wait maximum this time, before returning an error. Automator query the engine every 500 ms, until this delay. Default value is 5 minutes | waitingTime="PT10S" |
| taskId | Activity ID to query | actiityId= "review" |
| variables | List of variable (JSON file) to update | {"amount": 450, "account": "myBankAccount", "colors": ["blue","red"]} |
| numberOfExecutions | Number of execution, the task may be multi instance. Default is 1 | numberOfExecutions = 3 |

## SERVICETASK step

The step wait for a service task, and execute it.

It's depends on the usage of the scenario: if a CD/CI, the service task should be executed by the
real workers, not by the automator But in some environment, or to advance quickly the task to a
certain position, you may want to simulate the worker. Then, the automator can execute a service
task. The real worker should be deactivate then. If the service task is not found, then the scenario
will have an error.

| Parameter | Explanation | Example |
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| type | Specify the type (SERVICETASK) | type: "USERTASK" |
| delay | Deplay to wait before looking for the task, in ISO 8601 | delay="PT0.1S" waits 100 ms |
| waitingTime | Wait maximum this time, before returning an error. Automator query the engine every 500 ms, until this delay. Default value is 5 minutes | waitingTime="PT10S" |
| taskId | Activity ID to query | actiityId= "review" |
| topic | Topic to search the task (mandatory in C8) | get-score |
| variables | List of variable (JSON file) to update | {"amount": 450, "account": "myBankAccount", "colors": ["blue","red"]} |
| numberOfExecutions | Number of execution, the task may be multi instance. Default is 1 | numberOfExecutions = 3 |

## Verification

Each execution can declare verifications. Verification are executed after the execution.

It's possible to check:

* active activity: does the process instance is correctly waiting on the task "Final Review" after
the execution?
* any completed activity : does the process instance executed the task "GetScore"? Does the process
instance ended on the end event "Application Done" ?
* any variable value : does the process variable "ApplicantScore" is 150?
* any performance: does the execution of the activity "getScore" stay under 500 milliseconds? Does
the execution from the activity "getScore" to "GetRiskLevel" stay under 4 seconds?
48 changes: 48 additions & 0 deletions doc/unitscenario/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Unit Scenario

## Goal



### Verification

![Process](doc/explanationProcess.png)

in a CD/CI, you want to verify that a process follows the same behavior in the same performance
time. Running every day (or hours) or asking via an API call to replay a scenario is useful to
verify there is no difference. If the customer is 4555, do we still move the process instance to
Review Level 1"? The second verification is the performance. The scenario can record an expected
duration target (for example, 4 seconds to execute the Get Context service task. Does the execution
still at this time?

### Coverage report

Execute multiple scenarios to be sure that all the process is covered correctly. An "Execution
round" is a set of scenarios executed at the same time. At the end of the execution, a coverage test
can be performed. A CD/CI verification may be to check the scenario execution, the target time, and
the coverage.

### Advance process instances to a step for development

During the development, you verify the task "Notify applicant". To test it in the situation, you
must have a process instance in the process and pass four user tasks. Each test takes time: when you
deploy a new process or want a new process instance, you need to execute again the different user
task. Using Automator with the correct scenario solves the issue. Deploy a new process, but instead
of starting from the beginning of a new process instance, start it via Automator. The scenario will
advance the process instance where you want it.


# Build a Scenario

<Soon>

Automator can generate a scenario from a real execution. The user creates a process instance and
executes it. It executes user tasks until the end of the process instance or at a certain point. Via
the UI (or the API), the user gives the process instance. Automator queries Camunda Engine to
collect the history of the process and, for each user task, which variable was provided. A new
scenario is created from this example.


## Scenario definition

## execute
21 changes: 21 additions & 0 deletions docker-processautomator/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Image versions ##
CAMUNDA_CONNECTORS_VERSION=0.19.1
CAMUNDA_OPTIMIZE_VERSION=3.10.0
CAMUNDA_PLATFORM_VERSION=8.2.4
CAMUNDA_WEB_MODELER_VERSION=8.2.2
ELASTIC_VERSION=7.17.9
KEYCLOAK_SERVER_VERSION=19.0.3
MAILPIT_VERSION=v1.5.4
POSTGRES_VERSION=14.5-alpine
HOST=localhost

## Configuration ##
# By default the zeebe api is public, when setting this to `identity` a valid zeebe client token is required
ZEEBE_AUTHENTICATION_MODE=none
ZEEBE_CLIENT_ID=zeebe
ZEEBE_CLIENT_SECRET=zecret

# Set to 'true' to enable resource based authorizations for users and groups
# This can be used to limit access for users or groups to view/update specific
# processes and decisions in Operate and Tasklist
RESOURCE_AUTHORIZATIONS_ENABLED=false
3 changes: 3 additions & 0 deletions docker-processautomator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Docker process automator

## Example
2 changes: 2 additions & 0 deletions docker-processautomator/connector-secrets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# add secrets per line in the format NAME=VALUE
# WARNING: ensure not to commit changes to this file
60 changes: 60 additions & 0 deletions docker-processautomator/docker-compose-automator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: "3"
services:

processautomatorDiscovery:
image: pierreyvesmonnet/processautomator:1.0.0
container_name: processautomatorDiscovery
ports:
- "8380:8380"
environment:
- automator.servers.camunda8.zeebeGatewayAddress=zeebe:26500
- automator.servers.camunda8.operateUserName=demo
- automator.servers.camunda8.operateUserPassword=demo
- automator.servers.camunda8.operateUrl=http://operate:8080
- automator.servers.camunda8.taskListUrl=
- automator.servers.camunda8.workerExecutionThreads=500
- automator.startup.scenarioPath=/app/processautomator/src/main/resources/loadtest
- automator.startup.scenarioAtStartup=DiscoverySeedExtraction.json
- automator.startup.waitWarmup=PT1M
- automator.startup.policyExecution=CREATION|SERVICETASK|USERTASK
- automator.startup.loglevel=MAIN
- ZEEBE_CLIENT_SECURITY_PLAINTEXT=true
# - ZEEBE_CLIENT_CLOUD_REGION=
# - ZEEBE_CLIENT_CLOUD_CLUSTERID=
# - ZEEBE_CLIENT_CLOUD_CLIENTID=
# - ZEEBE_CLIENT_CLOUD_CLIENTSECRET=
- LOGGING_LEVEL_ROOT=INFO
volumes:
- ../:/app/processautomator
networks:
- camunda-platform
depends_on:
- zeebe
- operate

processautomatorVerification:
image: pierreyvesmonnet/processautomator:1.0.0
container_name: processautomatorVerification
ports:
- "8381:8380"
environment:
- automator.servers.camunda8.zeebeGatewayAddress=zeebe:26500
- automator.servers.camunda8.operateUserName=demo
- automator.servers.camunda8.operateUserPassword=demo
- automator.servers.camunda8.operateUrl=http://operate:8080
- automator.servers.camunda8.taskListUrl=
- automator.servers.camunda8.workerExecutionThreads=500
- automator.startup.scenarioPath=/app/processautomator/src/main/resources/loadtest
- automator.startup.scenarioAtStartup=Verification.json
- automator.startup.waitWarmup=PT1M
- automator.startup.policyExecution=CREATION|SERVICETASK|USERTASK
- automator.startup.logLevel=MAIN
volumes:
- ../:/app/processautomator
networks:
- camunda-platform
depends_on:
- zeebe
- operate
networks:
camunda-platform:
Loading

0 comments on commit f49249a

Please sign in to comment.