Business Process Simulation with JBoss jBPM · • Business Process Engine • POJO-Kern: Interne...
Transcript of Business Process Simulation with JBoss jBPM · • Business Process Engine • POJO-Kern: Interne...
• Consultant, Trainer, Coach
• Software Developer
• Committer of the JBoss jBPM-Project
– Commands
– Simulation (BPS)
Bernd RückerThat‘s me…
Bernd Rücker / [email protected] / 2
– Simulation (BPS)
– …
• Topics: BPM, SOA, Process Execution (jBPM,
BPEL, XPDL, …), Integration with Java EE
• Expert in the Software Experts Network
Stuttgart (SENS)
Basics
• Business Process Management (BPM)
• JBoss jBPM
• Business Process Simulation (BPS)
• Typical Simulation goals
Agenda
Bernd Rücker / [email protected] / 3
• Typical Simulation goals
• Discrete Event Simulation
The jBPM Simulation component
• Used Open Source components
• Combine BPM & Simulation
• Example & Demo
• Erzeugt einen definierten Output aus einem
gegebenen Input
• Geordnete Aktivitäten
• Erzeugt Wert („business value“)
• Lang laufend (bis zu Monaten oder Jahren)
Was ist ein Geschäftsprozess?Definition
Bernd Rücker / [email protected] / 4
• Lang laufend (bis zu Monaten oder Jahren)
• Enthält Wartezustände
• Aktivitäten können automatisiert (EAI/SOA) oder
durch Menschen (Human-Task-Management)
ausgeführt werden
Prozesse und SoftwareWerden Prozesse durch Software unterstützt?
GUI
Gui 1 Gui 2 Gui 3
Paper Email
Bernd Rücker / [email protected] / 5
Software
EAI-ToolWeb-Service
KundenKomponente
SAPServer
SoftwareintegrationVerschiedene Ebenen der Integration
Prozesse
Activity 1 Activity 2 Activity 3
Anwendungen
App 1 App 2
Prozess-integration
Services
Bernd Rücker / [email protected] / 6
Daten
DB 2DB 1
Logische Datenbank
Middleware
Funktions-integration
Daten-integration
Ein „digitaler“ ProzessDie Business Process Engine / Process Execution
TaskZuweisung
ServiceAufruf
TaskZuweisung
∆ Durchlaufzeit
Execution Engine
Bernd Rücker / [email protected] / 7
Zuweisung Aufruf Zuweisung
IT
Human Workflow Human WorkflowSOA
IT IT
Business Process EngineKomponenten & Features
Prozess-
Aufgaben-Verwaltung
Sachbearbeiter
Fremd-
Business Analyst
Bernd Rücker / [email protected] / 8
Business Process Engine
Persistenz
Ausführung
Prozess-definitionen Administration
Prozess-Logs
Anwendungen
Administrator
Entwickler
Das Versprechen der Anbieter: MagieDie magische Prozessmaschine?
Modeling Monitoring
Bernd Rücker / [email protected] / 9
EAI / SOAHuman Workflow
Business
IT
Magic Process Engine
Gemeinsame SpracheWas leistet die Business Process Engine
Bernd Rücker / [email protected] / 10
Quelle: Tom Baeyens, JBoss
• Versionierung, Persistenz & Interpretation von
Prozessmodellen
• Steuerung & Persistenz von Prozessinstanzen
• Task-Management & Wait-States
• Prozesskontext (Variablen zu Prozess speichern)
Was leistet die Business Process EngineFeatures
Bernd Rücker / [email protected] / 11
• Prozesskontext (Variablen zu Prozess speichern)
• Einbindung externer Services
• Verwalten von Ereignissen (wie Timeouts, …)
• Process Engine ist eigene Architekturschicht
• Domänenobjekte oder Referenzen als
Prozessvariablen
• Ansteuerung ext.
Services
Business Process Engine in JavaArchitektur
Bernd Rücker / [email protected] / 12
ServicesEJB-Container
BPM-Engine
Session
Bean
JCA JMS …EJB
• Business Process Engine
• POJO-Kern: Interne Prozessrepräsentation durch
Java-Modelle
• Persistenz über Hibernate (DB-Unabhängigkeit)
• Lauffähig mit oder ohne Application-Server
JBoss jBPMOpen Source Process Execution
Bernd Rücker / [email protected] / 13
• Lauffähig mit oder ohne Application-Server
• „Library“
• Klein und flexibel, leicht erweiterbar
• Aktuell Version 3.2, Version 4 in der Entwicklung
• Open Source (LGPL)
„Graph oriented programming“jBPM in a nutshell
Node
Transition
from to
**leaving
Transitions
arriving
Transitions
Token
current
Node
1
<process-definition>
Bernd Rücker / [email protected] / 14
...
<node-type-x name=“serve client”>
<transition name=“ok” to=“order” />
<transition name=“nok” to=“joke” />
</node-type-x>
<node-type-y name=“take order” />
<node-type-z name=“make joke” />
...
</process-definition>
• Task-Node: Human Tasks / Aufgaben
• State: Wait-States
• Fork / Join
• Decision: Automatische Entscheidung
• Start-State / End-State
Verschiedene Node-TypenjBPM in a nutshell
Bernd Rücker / [email protected] / 15
• Start-State / End-State
• …
• Eigene Node-Typen mit
Verhalten können
implementiert werden
• Einfache Java-API zur Steuerung der Engine
– Prozessstart
– Aufgabenliste
– …
• Aufrufen von „User-Code“
jBPM & JavajBPM in a nutshell
Bernd Rücker / [email protected] / 16
• Aufrufen von „User-Code“
– definierte Stellen im Prozess
– Interface & Java-Klassen
jBPM & JavajBPM in a nutshell
JbpmConfiguration conf = JbpmConfiguration.getInstance();
JbpmContext context = conf. createJbpmContext();
ProcessInstance pi = context.getGraphSession().
findLatestProcessDefinition("Ticket").createProcessInstance();
pi.getRootToken().signal();
List<TaskInstance> tasks = context.getTaskMgmtSession().
findTaskInstances("Vertrieb");
tasks.get(0).end("Ticket schliessen");
Bernd Rücker / [email protected] / 17
public class MyAction implements ActionHandler {
public void execute(ExecutionContext ctx) {
Object var = ctx.getVariable("var");
result = service.doSomething(var);
ctx.setVariable("result", result);
}
}
context.close();
Gemeinsame Sprache, Beispiel jBPM
Bernd Rücker / [email protected] / 18
Tooling: EclipsejBPM in a nutshell
Bernd Rücker / [email protected] / 19
The BPM life-cycle
Analysis
DesignControl
Bernd Rücker / [email protected] / 20
ImplementationExecution
Iterative Improvement
The problem with process changes
• The future is hard to predict
• Unintuitive results, especially if different processes
are involved
• Changes in processes are
– Expensive
Bernd Rücker / [email protected] / 21
– Expensive
– Explosive, e.g. for “team spirit” in companies
• Lots of risks
Simulation
Simulation is the process of describing
a real system and using this model for
experimentation, with the goal of
understanding the system’s behavior
Bernd Rücker / [email protected] / 22
understanding the system’s behavior
or to explore alternative strategies for
its operation.
Shannon
Business Process Simulation (BPS)
• Model of reality = business process + additional
information
• Helps to predict outcome without putting new
processes into production
Bernd Rücker / [email protected] / 23
Use cases:
• Process changes
• New processes (“Business Process
Reengineering”)
• Changed environment
BPS vision
process model & additional info
alternative process
(stochastic)simulation
benchmarks,KPI, …
Same model as for process execution
Bernd Rücker / [email protected] / 24
BAM
process structures
Life data from
history
Analysis
Design
ImplementationExecution
Control
Iterative Improvement
Typical Simulation Goals
• Identify cycle times for new or changed processes
• Identify process costs
• Benchmark alternative process structures
• Forecast effects of changing amount of input events
(for example the double amount of orders)
Bernd Rücker / [email protected] / 25
(for example the double amount of orders)
• Support capacity or staff planning
• Benchmark different parameter configurations
Example: Returned Goods
process runs: 195
100 95
195
Accountant180 (30)
SwimlaneAvg, duration (standard
derivation)
Bernd Rücker / [email protected] / 26
30
165
145 20
175 20
Clerk180 (60)
Accountant180 (30)
Tester732,25 (448)
dispatcher325.50 (182)
Example
process runs: 195
100 95
195
Accountant
180 (30)
SwimlaneAvg, duration (standard
derivation)
Questions:• How many people do I need for
a special amount of work?
• What is the best tradeoff
between too much and too less
people?
Bernd Rücker / [email protected] / 27
30
165
145 20
175 20
Clerk180 (60)
Accountant
180 (30)
Tester732,25 (448)
dispatcher325.50 (182)
Example
process runs: 195
100 95
195
Accountant180 (30)
SwimlaneAvg, duration (standard
derivation)
Questions:• Is it maybe cheaper to skip the
extended tests and so also
refund some not defect goods
• Is it maybe cheaper to skip all
tests?
Bernd Rücker / [email protected] / 28
30
165
145 20
175 20
Clerk180 (60)
Accountant
180 (30)
Tester732,25 (448)
dispatcher325.50 (182)
Simulation input
distribution of waiting time
distribution of start events (amount and time)
resource pools
Bernd Rücker / [email protected] / 29
distribution of waiting time
distribution of duration/processing time for task
distribution of duration/processing time for task
resource pools
Simulation
discrete simulation
Discrete Event
Bernd Rücker / [email protected] / 30
continuous
simulation
Simulation (DES)
Discrete Event Simulation
• State changes happen at discrete events in time
• Nothing happens between 2 neighboring points in
time
• Finite sequence of model states
• Model time is independent of real time
Bernd Rücker / [email protected] / 31
Event a
Event b
Event c
Event x
Event y
Components of DES
• Model state
• Simulation clock
• Event list
• Central controller
Bernd Rücker / [email protected] / 33
• Random number generator / Distributions
• Statistical counters / data collectors
The BPS tool – used components
• JBoss jBPM
– Business Process Engine
– Open Source (LGPL)
– Backed by RedHat / JBoss
• DESMO-J
Bernd Rücker / [email protected] / 35
• DESMO-J
– Java Simulation Framework (DES)
– Developed & maintained by the University of Hamburg
– Open Source (Apache License)
• JasperReports as reporting generator
Business Process Engine:
DES-Framework:
Combination of BPM & DES
Bernd Rücker / [email protected] / 36
Engine:
JBoss jBPM
Framework:
DESMO-J
Combination of BPM & DES in action
21:33
Eventlist
21:40 start process
21:33
Bernd Rücker / [email protected] / 37
Distributions
Counters &
data
collectors
21:33
21:40 start process21:40 start process
Combination of BPM & DES in action
21:40
Eventlist
22:07 start process
22:55 parcel arrived
21:40
Bernd Rücker / [email protected] / 38
22:55 parcel arrived
Distributions
Counters &
data
collectors
22:55 parcel arrived
Combination of BPM & DES in action
22:55
Eventlist
22:55
22:55 parcel arrived
Bernd Rücker / [email protected] / 39
Distributions
Counters &
data
collectors
Combination of BPM & DES in action
23:41
Eventlist
23:41
Bernd Rücker / [email protected] / 40
Distributions
Counters &
data
collectors
What was needed for combination?
• Special Events in DESMO-J
• Clock-Synchronization
• Event-Generation at special points in the process
execution
Bernd Rücker / [email protected] / 41
Additionally:
• Resource pools
• Queues
• Automatic decision taking
• Influence on service calls
Architecture
jBPM (used for
simulation)
Production
jBPM
jBPM Designer
Configuration BAM
support planned
Bernd Rücker / [email protected] / 42
jBPM Simulation
jBPM
DB
DESMO-JReporting
JasperReports
Data source
Event Generator & QueueIn memory objects
Simulation configuration example
<experiment name='ReturnDefectiveGoods' time-unit='second'
run-time='28800' real-start-time='30.03.1980 00:00:00:000'
currency='EUR' unutilized-time-cost-factor='0.0'>
<!-- 28800 seconds = 8 hours = 1 working day -->
<scenario name="status_quo">
<distribution name="start" sample-type="real"
type="erlang" mean="95"/>
<distribution name="parcel" sample-type="real"
type="normal" mean="28" standardDeviation="17"/>
...
<resource-pool name="tester" pool-size="5" costs-per-time-unit="0.025"/>
...
<experiment name='ReturnDefectiveGoods' time-unit='second'
run-time='28800' real-start-time='30.03.1980 00:00:00:000'
currency='EUR' unutilized-time-cost-factor='0.0'>
<!-- 28800 seconds = 8 hours = 1 working day -->
<scenario name="status_quo">
<distribution name="start" sample-type="real"
type="erlang" mean="95"/>
<distribution name="parcel" sample-type="real"
type="normal" mean="28" standardDeviation="17"/>
...
<resource-pool name="tester" pool-size="5" costs-per-time-unit="0.025"/>
...
Bernd Rücker / [email protected] / 43
...
<sim-process path="/.../ReturnDefectiveGoods/processdefinition.xml">
<process-overwrite start-distribution="start"/>
<state-overwrite state-name="wait for parcel" time-distribution="parcel">
<transition name="parcel arrived" probability="195"/>
</state-overwrite>
<decision-overwrite decision-name="ordered within the last two weeks?">
<transition name="YES" probability="100"/>
<transition name="NO" probability="95"/>
</decision-overwrite>
...
</sim-process>
</scenario>
...
<sim-process path="/.../ReturnDefectiveGoods/processdefinition.xml">
<process-overwrite start-distribution="start"/>
<state-overwrite state-name="wait for parcel" time-distribution="parcel">
<transition name="parcel arrived" probability="195"/>
</state-overwrite>
<decision-overwrite decision-name="ordered within the last two weeks?">
<transition name="YES" probability="100"/>
<transition name="NO" probability="95"/>
</decision-overwrite>
...
</sim-process>
</scenario>
Simulation configuration example 2
<process-definition name='FirstSteps' start-distribution='z'>
<resource-pool name='big machine' pool-size='3' />
...
<swimlane name='tester' pool-size='2' />
...
<task-node name='task one'>
<task swimlane='tester' time-distribution='time required for task one' />
<transition to='task two' />
<process-definition name='FirstSteps' start-distribution='z'>
<resource-pool name='big machine' pool-size='3' />
...
<swimlane name='tester' pool-size='2' />
...
<task-node name='task one'>
<task swimlane='tester' time-distribution='time required for task one' />
<transition to='task two' />
Bernd Rücker / [email protected] / 44
<transition to='task two' />
</task-node>
...
<state name='automated state' time-distribution='xyz'>
<resource-needed pool='big machine' amount='2' />
<transition to='end' />
</state>
...
</process-definition>
<transition to='task two' />
</task-node>
...
<state name='automated state' time-distribution='xyz'>
<resource-needed pool='big machine' amount='2' />
<transition to='end' />
</state>
...
</process-definition>
Simulation Results SimulationResult
scenarioNamesimulationRunTime
ValueStatistics
namemeanstandardDerivation
QueueStatistics
namestrategyobservations
Distributions
name…
***
Bernd Rücker / [email protected] / 45
standardDerivationmaximumminimumnumberOfObservations
observationsqueueLimitlengthminLengthmaxLengthaverageLengthzeroWaitsmaxWaitTimeaverageWaitTimerefusedstdDevLength
Waiting times for
resources / process
cycle times
Ressource Pool
statistics
Information
about input
distributions
Further topics
• Analyzing simulation results
– Results are just “samples”
– Repetitions are needed
– Use statistical theory to calculate confidence
• Optimization
Bernd Rücker / [email protected] / 47
• Optimization
– Not addresses by simulation itself
– Simulation only evaluate given scenarios
• Open Issues / Possible future work
– GUI, support all jBPM features, better reporting, process
animation, optimization
Conclusion
• Tool was developed and is working
• Source Code contributed to JBoss jBPM
• A showcase / tutorial was developed and is
available on camunda homepage
• A real-life case study was done with dataphone
Bernd Rücker / [email protected] / 48
• A real-life case study was done with dataphone
(Vienna)
• Tool can leverage BPS to a wider range of people
Fragen & Antworten
Unsere Themen• Ganzheitliches BPM
Bernd Rücker
Geschäftsführer
Berater, Trainer & Coach
+49 711 3278645
Bernd Rücker / [email protected] / 49
• Ganzheitliches BPM
• Prozessautomatisierung
• SOA, BPEL, XPDL, jBPM, Drools, ESB
• BPMN
• BPM-Toolauswahl
Unsere Leistungen• Beratung
• Seminare
• Process as a Service
(Hosting)