[rules-users] Parallelization

Greg Barton greg_barton at yahoo.com
Tue May 11 11:30:02 EDT 2010


If you're using the sun VM multiple Threads will use multiple cores just fine.  What version of java?

Are you intending to max out the CPU on the machine?  If so I suggest this configuration, for an 8 core box:

7 Threads, each running a StatefulKnowledgeSession.

Concurrent garbage collection, with VM startup parameters like this:

-XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxGCPauseMillis=150 -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=2 

Here's a good reference for GC parameters: http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html

And if you're feeling frisky, try out these to see if it improves performance:

-XX:+UseTLAB -XX:+UseSpinning -XX:+UseFastAccessorMethods

The default recommendation for maxing out the CPU is to use <num_cores>+1 Threads, but in this case since garbage collection may be an issue I'd reduce that by two.  You need one core "dedicated" to other stuff (I/O and whatnot) and some resources for GC.

--- On Tue, 5/11/10, djb <dbrownell83 at hotmail.com> wrote:

> From: djb <dbrownell83 at hotmail.com>
> Subject: Re: [rules-users] Parallelization
> To: rules-users at lists.jboss.org
> Date: Tuesday, May 11, 2010, 7:55 AM
> 
> Hi Wolfgang,
> 
> Ok, well I implemented my "option #2", which has cut it
> down to 23ms, which
> is a good start.  My timing is done by taking the time
> before, and after,
> and dividing by the number of claims processed.  (and
> averaging over a few
> runs)
> 
> I use one thread per StatefulKnowledgeSession... My machine
> has 2 cores, but
> it will eventually be running on an 8 core beast, so i
> reckon this was a
> good improvement.  I was just worried that I wouldn't
> be able to
> simultaneously process multiple K-Sessions, but apparently,
> Drools doesn't
> mind.  I'm pretty sure any machine with multiple cores
> supports parallel
> java threads, no? 
> 
> 
> 
> -----
> Regarding my Utilities method, eg. 
> isWithinTimePeriod("20100308",
> "20090405", 1, "Y")
> 
> I can get about 5ms off by commenting out the eval, so it's
> not going to be
> a big jump even if I fix it, but, well, I am using yyyyMMdd
> Strings, which
> in the method, I sub-stringed, converted to ints,
> instantiated DateMidnight
> objects, and compared using Joda-time
> daysBetween/monthsBetween/yearsBetween
> methods.  
> 
> My thought was that pre-converting to ints would help, so
> that each
> ClaimLine has year/month/day int variables, and pass them
> in instead. (i.e.,
> Saves 3 String.substring()'s, and 3
> Integer.parseInt()).  but that actually
> slowed it down a few milliseconds. (Maybe passing 6 params
> instead of 2?!)
> 
> I'm comparing two dates by an arbitrary period, like "2
> days" or "1 month",
> and need the framework of the Gregorian Calendar.  So,
> I don't think I can
> do anything about this.  2 months is never guaranteed
> to be a set number of
> milliseconds.  It all depends on the claim date, which
> is fact data, and
> therefore variable.
> 
> Regards,
> Daniel
> 
> -- 
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Parallelization-tp809341p809753.html
> Sent from the Drools - User mailing list archive at
> Nabble.com.
> _______________________________________________
> 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