How much memory does a WorkingMemory consume?  How long does it take to create
one?

I have a large collection of frequently updated objects, and I need use a set
of rules to process each one against a different regularly updated object.
Let's call the first objects products, and the second markets (this is a made
up example, but it's close to what I'm doing).  Say I've got 200 products, and
7 markets.  The product specifications change many times a day, market
conditions change a few times a day.  The products must be evaluated
independently of each other (in other words, asserting them all into a single
working memory doesn't win me anything).  Several of the properties on the
products are complex (based on collections of other non-time-constant
objects), and thus it won't work to put PropertyChangeListeners on them.  I'll
have to modify() each product every time I update it.  It takes several
seconds to update each product (lots of database calls), so keeping everything
up to date (200 products * 7 markets * 5 seconds = 2 hours) takes a while.  To
add to the mess, I have two groups of products that update on different
cycles, so I need to have a different thread for processing each group.  I've
got around forty rules now, but I expect that number to grow.

So given the above constraints, I'm trying to decide between two possible
implementations:

*) Have a dedicated working memory (WM) for each product/market pair.  Assert
the market once, assert the product once, then modify() the product every time
it's updated from the db.  This means I'll be keeping 1400 WM's in memory.

*) Every time I update a product, create a new WM, assert the market and the
product.  This means I'll be creating a WM and asserting a market 150,000
times a day.

Hmm, waitaminute, I just had a better idea!  Amazing what you come up with
when you write things down.  Do you guys see anything wrong with this
implementation:

*) Have a dedicated WM for each market.  Create the memory, assert the market
once, stash it in memory.  Update a product, assert it, fire the rules, read
the results, retract the product.  Now I'm only keeping seven WM's in memory,
and I'm not asserting market objects every cycle.  I think this is also fairly
easy to do in a thread-safe manner.

So back to my original questions.  I need to have an idea of the tradeoffs
between memory consumption and time to fully evaluate the above implementations.

I'd appreciate any feedback y'all might have on this.

Thanks.

-- 
Dirk Bergstrom               [EMAIL PROTECTED]
_____________________________________________
Juniper Networks Inc.,          Computer Geek
Tel: 408.745.3182           Fax: 408.745.8905

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to