[rules-users] Drools with Gemfire

Joe Ammann joe at pyx.ch
Mon Aug 6 11:17:49 EDT 2012


Hi Rich

On 08/06/2012 03:26 PM, rtella wrote:
>   I'm looking into integrating Drools with a system that has large (40GB+) 
> Gemfire Maps.  The rules would need to access the Gemfire Maps, which can be
> updated at any time.    I understand I can't access the Gemfire Maps as
> global data since they aren't immutable.  Inserting the maps also doesn't
> seem like a good idea either since I'd  have to call modify() frequently on
> Maps with as many as 1M elements.    Is there any alternative for accessing
> large amounts of changing data?
We had quite a similiar use case (financial instruments, millions of
associated prices in a Gemfire map, need to reason over many (~100'000)
instruments, in some cases taking price data (~300mio) into account).

We ended up asserting the instruments as facts into WM, do the majority
of the reasoning on them, and when really required, accessing the prices
from the Gemfire map with a "from" conditional expression

For example:

WHEN
    i : Instrument ( assetClass == "Bond" )
    ps : PriceSeries ( instrumentId = i.id, priceType = "EndOfDay" )
    price : Price ( ) from ps.getPrices()    // her we access the
Gemfire map
    .....

So instruments and price series (in our case) are facts in WM, while the
prices stay in the Gemfire maps. Of course, that has the drawback that
we can not react directly to new or modified prices. Which in our case
was ok. Only a minority of the rules needed to take prices into account
at all, so we first fired all rules that did not access the maps,
retracting all instruments we could. Then the rules with lower salience
that accessed the maps fired.

-- 
CU, Joe



More information about the rules-users mailing list