[jboss-user] [jBPM] - Using drools in a web app is my approach correct
gerasalus
do-not-reply at jboss.com
Wed Sep 26 08:12:25 EDT 2012
gerasalus [https://community.jboss.org/people/gerasalus] created the discussion
"Using drools in a web app is my approach correct"
To view the discussion, visit: https://community.jboss.org/message/761632#761632
--------------------------------------------------------------
Hi all,
some newbie questions. I'm wondering is my thinking and my architecture correct?
Preconditions:
1. We have a set of rules stored in DB.Rules will be reloaded from DB only once a day
2. We have a set of meta-facts. Retrieval of those facts is expensive, and they only get updated once a day, after midnight - current meta-facts are immutable for a day.
3. We have user facts - some user specific data which we should be using together with meta-facts and producing output for specific user.
4. Our SLA is 150 req/s.
Typical flow would be something like: we have rules together with meta facts. Along comes user with his general facts and request specific facts. For this input we run rules and produce results - calculate some data.
Basically a typical quote calculation, just we are not calculating quotes :)
Rules may change working memory (cart explosion pattern)
So how would i make this work for multi user environment in a spring web apps? My ideas:
1. Create a custom Spring scope that will cache KnowledgeBase and invalidate it once it expires (at the beginning of new day)
2. Cache meta-facts (they are expensive to retrieve) for given time
3. For each user request (user comes in with its own facts) - create a new StatefulKnowledgeSession from existing KnowledgeBase byt inserting meta-facts and user specific facts and execute fireAllRules
4. Retrieve the result and dispose the StatefulKnowledgeSession()
As i unserstand, if my rules are modifying working memory, i cannot reuse StatefulKnowledgeSession for different users (as they bring their own facts). Is there a better approach ? By reading forums and mailing lists i have mixed data about StatefulKnowledgeSession creation. There are threads that state cpu spikes while creating sessions.
Maybe i should be considering pool of StatefulKnowledgeSession and inserting/retracing user facts while keeping meta-facts?
Thanks!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/761632#761632]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120926/a5c530b1/attachment.html
More information about the jboss-user
mailing list