Simple approaches are often the best !

If I understand correctly, this means that you will have all users /web
threads accessing the one working memory instance - I am not sure if that is
what you are requiring or not. If it is, it might be worth looking at the
Synchronzed working memory wrapper class.
Alternatively you would use the one instance of the rulebase, "cached" in
the servlet context, and then everyone can access the rules from there
(creating a new working memory each time it is needed - creating a new
working memory is both fast and threadsafe) Alternatively you may keep a
working memory instance in each users session.

All of these approaches solve different problems, but the common best
practice is to cache the rulebase. Loading the rule base each time from the
DRL is generally not performant (with compiled rules though, it can be much
faster, but caching of the RuleBase is always optimal - you only need one
instance of the rulebase, but as with all caches, you need to know when and
how to update it on the fly when you need to change the rules).

On 12/17/05, Keith Marshall <[EMAIL PROTECTED]> wrote:
>
> We seemed to have solved this as follows:
>
> Created new ServletContext Initialization class in which we read in the
> rule .drl and set the created workingMemory into application scope. When
> needed in an action class it is pulled out and used. A little 'caveman'
> at this time, but a significant reduction in the processing time.
>
>
> Keith A. Marshall
> Ext: 1089
>
> -----Original Message-----
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 16, 2005 1:47 PM
> To: [email protected]
> Subject: Re: [drools-dev] Performance
>
> Hi Keith. I assume you are saying it takes 500 milliseconds versus 275
> for hard coded (not MEGA seconds !;)
>
> Can we have some more info on this. It sounds like there might be some
> kind of startup cost going on, if it is simple. Test cases are always
> good, if you are able to share them of course !
>
> Michael.
>
> On 12/17/05, Keith Marshall <[EMAIL PROTECTED]> wrote:
> >
> > We are very pleased with the results thus far for implementation of
> > Drools.  However, in some basic testing yesterday it appeared to take
> > 500Ms to process two very simple rules. The coded version is
> > processing in 275Ms. I  am looking for some advice in this area. The
> > next stage of this review is going to be to refine the performance,
> > this is an important criteria in the decision making process.  BTW - I
>
> > believe our JBoss Suite support is effective today.
> >
> > thanks
> >
> >
> > Keith A. Marshall
> > Ext: 1089
> >
> > -----Original Message-----
> > From: Michael Neale (JIRA) [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, December 15, 2005 6:01 PM
> > To: [email protected]
> > Subject: [drools-dev] [jira] Resolved: (DROOLS-467) compiled rules to
> > load from byte[]
> >
> >      [ http://jira.codehaus.org/browse/DROOLS-467?page=all ]
> >
> > Michael Neale resolved DROOLS-467:
> > ----------------------------------
> >
> >     Resolution: Fixed
> >
> > > compiled rules to load from byte[]
> > > -----------------------------------
> > >
> > >          Key: DROOLS-467
> > >          URL: http://jira.codehaus.org/browse/DROOLS-467
> > >      Project: drools
> > >         Type: New Feature
> >
> > >     Versions: 2.5
> > >     Reporter: Michael Neale
> > >     Assignee: Michael Neale
> > >      Fix For: 2.5
> >
> > >
> > >
> > > Need to be able to save/load compiled rules to byte[]
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the
> administrators:
> >    http://jira.codehaus.org/secure/Administrators.jspa
> > -
> > For more information on JIRA, see:
> >    http://www.atlassian.com/software/jira
> >
> >
> >
> >
>
>
>

Reply via email to