Design Question

classic Classic list List threaded Threaded
6 messages Options
Earnest Dyke Earnest Dyke
Reply | Threaded
Open this post in threaded view
|

Design Question

Greetings all, I am evaluating Ignite for an application which we hope to develop that will take a customer's cart and determine the "best" warehouse from which to source the order. To that end my question is how to architect the data. Should we have separate caches for each warehouse where each cache contains just that warehouse's products and then send queries to each cache? One note: the data will be updated very often. As products are restocked and orders fulfilled the inventory balances for each product in each warehouse will be updated. Not sure how this would impact cache design. I was also reading about remote execution and was wondering if that could be used. We have a set of rules, implemented in JBoss' Drools, that we would want to execute against each warehouse to determine a "priority factor". This is what we would pass through a separate set of rules to determine "best" warehouse to source from. It just seems to me Ignite is a great fit for this use case just not sure how to architect the data. Thanks in advance for any and all relevant responses. Earnie!
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Design Question

Hi Earnie,

I think the best way to go is to create a cache per data type and execute cross-cache query. Note that if your query uses joins, you will have to properly collocate the data, like described here: https://apacheignite.readme.io/docs/affinity-collocation#collocate-data-with-data.

Let us know if you need more help.

-Val
Earnest Dyke Earnest Dyke
Reply | Threaded
Open this post in threaded view
|

Re: Design Question

Thanks Val for the advice. There is only one type of data in each cache, they are all product inventory at a warehouse objects. I am trying to determine if I can execute the Drools rules against each warehouses products and if so would it there be any benefit to separating data into a cache per warehouse or store all warehouses in the same cache.

Earnie!
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Design Question

Earnest Dyke wrote
I am trying to determine if I can execute the Drools rules against each warehouses products and if so would it there be any benefit to separating data into a cache per warehouse or store all warehouses in the same cache.
Hi Earnie,

I don't think so. I'm not sure I understand all the details of your use case, but it sounds like you just need to have an index on warehouse ID field which will allow you to execute fast queries against data for a particular warehouse. Will this work for you?

-Val
Earnest Dyke Earnest Dyke
Reply | Threaded
Open this post in threaded view
|

Re: Design Question

Thanks again for your reply. Let me try to define the requirements a little differently.

Currently in our legacy system we have inventory data for each product at each warehouse.
When an order is received I need to be able to determine which warehouse(s) can fulfill the order.
We have a set of rules that narrows the list of warehouses down to 5-10.
What I need to do then is determine if each item on the order is available in one or more warehouses.But this is not simply a matter of a simple if that says "if quantity in warehouse for this product >= quantity being ordered", we execute a set of Drools rules to make the determination.
My question is: would there be any benefit (parallelization for example) is we had a separate cache for each warehouse's products and to process an order we would run our rules to narrow the list of warehouses then dispatch code to each of those warehouses to execute the Drools rules for a single warehouse?

Earnie!
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Design Question

Hi Earnie,

How these Drools rules are implemented? Are they SQL queries?

I think that such separation would not give you performance benefit. It's more a matter of correct indexing configuration and optimization of queries. If you want parallelize the process, you should start more nodes, not more caches.

-Val