<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
jBPM5 - Can't Scale, Won't Scale
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/m_arnold123">M Arnold</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/771731#771731">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I'm having great trouble designing an application which uses jBPM5 in a scalable way.  It seems to be impossible on a practical level.  I hope that this is just due to my misunderstandings of the way the jBPM5 works.  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have listed each of my assumptions, and the ramifications of each below.  I hope that someone from the community will be able to point out where these assumptions are incorrect.  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I would particularly appreciate it if anyone has managed to scale jBPM5, and could described how they achieved it.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>1. Everytime jBPM5 executes a process the database transaction updates the process instance info AND the session info, therefore: </p><p>1a. it's not scalable to use a single session to execute all processes, or you would suffer contention on the session info.</p><p>1b, it's not scalable to use a single session to execute all processes in a cluster, or the updated session info would have to be continually synchronised across the cluster.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>2. When using BPMN2 events, jBPM5 only allows you to send events to the process instances within a single session at a time.  You need to maintain a list of all the sessions which have incompleted process instances(*), and loop through them all to send events.  Therefore: </p><p>2a. you should execute all processes in as few sessions as possible, to lessen the number of iterations through this loop.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>3. jBPM5 persists BPMN2 timer info in the session info, but the session must be active (ie. loaded from persistence) in order for the timers to activate.  Therefore:</p><p>3a. when your application starts, you must load all sessions that have active process instances that have timers(**).  </p><p>3b. you must not have the same session active in two different nodes of a cluster, or the same timers will expire around the same time </p><p>3c. when a node crashes, your application must detect this and reload the sessions that were active in the crashed node</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>4. If you start a process instance in a session, that process instance must always be executed in that session.</p><p>4a. when a node wishes to resume a process instance that was persisted, it must first (due to 3b) ask all other nodes if they have the session active, and if so instruct them to dispose it.  It can then load the session, load and resume the process.  All while preventing race conditions.</p><p>4b. when a node receives an event it must (due to 2) carry out all the processing in 4a for each session with active process instances.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>(*) I don't think it's possible to know if a session has incompleted process instances..?</p><p>(**) I don't think it's possible to know if a session and timers..?</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/771731#771731">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>