[rules-users] StatefulKnowledgeSession construction executes sequentially (no multithread)

Juan Carlos Fernández juancarlos.fernandez at safelayer.com
Tue Oct 11 06:49:21 EDT 2011


We create one StatefulKnowledgeSession for every client (if 20 clients at
same time, 20 StatefulKnowledgeSession are created) because every client has
different environment for rule evaluation. Facts for one client does not
have to collide with facts of other clients so this is the reason why we
create multiple sessions.

Let me explain all this in greater detail. When a client executes a SOAP
operation, one StatefulKnowledgeSession is created and associated to the
transaction. Every log generated by the transaction is inserted as a Fact.
When transaction finishes, we fire all rules for the current transaction
knowledge session in order to correlate all transaction logs. This
transaction logs do not have to collide with other transaction logs so every
thread (transaction) has its own StatefulKnowledgeSession.

Our app locks and begin to use only one CPU thread because of
newStatefulKnowledgeSession().

Do you think entry-points would be the solution? Is there any other
solution?

One solution is to use StatefulKnowledgeSession pool who creates instances
but we have to retract all facts when returning session to pool.

Concurrent executions and throughput is a key feature of our SOAP
application.

Thank you very much

--
View this message in context: http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-construction-executes-sequentially-no-multithread-tp3412107p3412222.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list