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

Swindells, Thomas TSwindells at nds.com
Tue Oct 11 07:08:51 EDT 2011


The problem is your test isn't calling fire all rules. You are testing just the creation of the sessions,
this is expected to be fast and low cost  and requires some synchronization for safety*.
The process that is expected to take a significant amount of time is the inserting of the facts,
firing the rules and getting the results, this should run in parallel correctly - but your test
isn't testing this.

Can you make a realistic test case then feed back the results.

Thomas

*I don't know the code, and it is possible that it could benefit from using a more sophisticated
read/write lock but that is only worth implementing if session creation really does take up a
significant amount of time.



> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of Juan Carlos Fernández
> Sent: 11 October 2011 11:49
> To: rules-users at lists.jboss.org
> Subject: Re: [rules-users] StatefulKnowledgeSession construction executes
> sequentially (no multithread)
>
> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************




More information about the rules-users mailing list