Archive for the ‘Optimization’ Category

On to Optimizing Business Rules, Territories/Regions, Filters, Conditions, etc.

January 24, 2008

So you implemented this brand new ICM system, but the application takes forever to run the batch jobs. While you are waiting for the compensation results, you are pulling your hair out, trying to think about a way to make the system run more quickly.

There are many advanced tricks to optimize sales compensation system performance, but here is a very quick and easy way to (sometimes) make the transaction processing run more quickly. It’s far from being a ground-breaking method, but it is often overlooked.

Business logic uses Boolean logic; it consists of conditions, separated by “AND” and “OR”, with a few sprinkled brackets. The order in which the elements are being evaluated is critical for the batch performance. The application will usually “read’ the equation from left to right.

For example, if we check that CONDITION A OR CONDITION B are true, the application will try to find out if CONDITION A is true, and if it can’t find what it’s looking for, it will move on to see if CONDITION B is true.

Optimizing OR
This means that when using an OR expression, it is preferable to try to put the condition the most likely to be true first. In this example, if CONDITION A is true, the application will not even need to check if CONDITION B is true.

Optimizing AND
For an AND expression, it works the other way around. Since both conditions need to be true, it is much preferable to put the condition the most likely to be false first.

Of course, to be able to achieve good results with this method, it is important to know if each condition is more likely to be true or false… it is also important for this likelihood to be as disproportionate as possible.

And putting Or and And Together:
Here is a slightly more complex example just to put in practice what I’m describing. If we are checking that CONDITION A is true, or that CONDITION B AND CONDITION C are true.

I would write the logic in this way if A was very likely to be true. Otherwise I would write the rule as (B AND C) OR A. I would further tweak this formula if I knew the likelihood of B and C to be false.

This is a bit confusing at first, but it will make complete sense with some practice.