[rules-users] A few general questions on scaling StatefulKnowledgeSessions

Stephen Masters stephen.masters at me.com
Fri Aug 17 09:54:41 EDT 2012


Actually, I do mean that! :D

But maybe I should explain…

To be more precise, most of the time in my apps is taken in marshalling facts and inserting them into the session. From firing rules, it tends to take 10s of microseconds for a decision to be made.

Obviously if the RHS is doing more than just making a decision based on facts already in the system (i.e. the RHS code queries databases, etc) then firing can get very slow. However, I tend to follow the best practices that I learned from various FICO (!) consultants, who recommended against doing anything heavy in the RHS, but rather getting back out of the rules engine ASAP and doing those heavy tasks in the invoking application.

This approach works nicely, because the rules engine does what it's good at (making decisions based on facts that are in working memory) and my Java (Spring) app does what it's good at (getting data and integrating with other systems).

The added benefit is that if I need to synchronise access to the session, it's not such an issue if each request is back out of the rules engine in microseconds.

Steve


On 17 Aug 2012, at 13:01, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:

> On 17/08/2012, Stephen Masters <stephen.masters at me.com> wrote:
> 
>> But here are some slightly more practical thoughts from my experience...
>> Inserting new facts is slow. (although still sub-millisecond)
>> Evaluating rules is fast.
> 
> Left hand sides of rules are evaluated while new facts are inserted,
> so the above distinction does not make sense for me. Perhaps you can
> explain what you mean by "evaluating rules"?
> 
> Executing ("firing") rules depends on what's done on the right hand
> side, so you can't mean that.
> 
> -W
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list