## Essbase Statistics DW: How to automatically administrate Essbase using ODI (Part 3: Calculator Cache)

Hey guys, how are you? Continuing the Essbase Statistics DW: How to automatically administrate Essbase using ODI series (Part 2 Here), today we’ll talk about Calculator Cache.

The concept behind the Calculator cache is a little tricky but I think is very nice to understand since it gives us a very good tip about Essbase design. This cache is used to track what Essbase already calculated and what he didn’t yet.

Essbase split the sparse dimensions in 2 groups:

- Bitmap dimensions: they are all the sparse dimension that fits inside the bitmap
- You can think about this bitmap as a matrix that will hold all members from one or more sparse dimension, depending of the available memory. Each member occupies 1 bit of memory. (it’s like a check that says if the member was calculated or not)

- Anchoring dimensions: For the rest of the sparse dimensions that didn’t fit in the bitmap. The anchoring dimension will define the number of bitmaps that Essbase can create at same time, if there’s enough memory.

The calculator cache controls the size of the bitmap, what means, the number of sparse dimensions that can fit in the bitmap and the amount of anchoring dimensions depends of the size calculator cache

But how it works? Essbase will start from the first sparse dimension in the outline and will try to fit as much dimensions possible inside the bitmap until he cannot put the next sparse dimensions completely inside the bitmap.

All the remain sparse dimension becomes anchoring dimensions.

The number of bitmaps that can be created at same time is determined by the maximum number of dependent parents in the anchoring dimensions.

Dependent parent is the number of parents that is above a leaf member. We need to find the member that has the biggest number of levels above him, meaning, the max number of dependent parents is the same as the number of Levels in a dimension

If the leaf member with most parents above him has 3 parents the level of that dimension will also be 3, then for dependent parents we just need to ask for the level of the dimensions.

The size of the bitmap and the number of anchoring dimensions depends of the size of the calculator cache.

What that means? Let’s consider this outline for example:

Sparse Dims | # of Members | Dependent Parents |

S1 | 10 | NA |

S2 | 10 | NA |

S3 | 20 | NA |

S4 | 30 | NA |

S5 | 200 | 3 |

In this outline we have 5 sparse dimensions, 4 flat ones (S1 to S4) and one with a 3-level hierarchy (S5).

We have 3 options of cache settings that we can choose from:

- Single anchoring multiple bitmaps.
- Single anchoring single bitmap.
- And multiple anchoring single bitmap.

To use the first option, we need to get the first 4 sparse dimensions from the outline and multiply all of them, split the result by 8 to transform it in bytes and this will define the size of the bitmap.

After that we need to define how many bitmaps we will have at same time in memory. For that we need to get the level of the anchoring dimensions and sum 2 on it. (2 is a constant number). This will define the number of bitmaps.

Finally, we just need to multiply the size of the bitmap by the number of bitmaps and this will give us the size of the cache we must set to use option 1.

The other options are a smaller version of the first one. Option 2 we don’t have multiple bitmaps, we just set the anchoring to 1, and option 3 we fit in the bitmap less dimensions.

We can see the calculations for each option below:

Option | Calculator Cache |

Single anchoring, multiple bitmaps | (10*10*20*30)/8=7500 3+2=5 7500*5=37500 bytes |

Single anchoring, single bitmap | (10*10*20*30)/8=7500 1 7500*1=7500 bytes |

Multiple anchoring, single bitmap | (10*10*20)/8=250 1 250*1=250 bytes |

The interesting thing here is to see why is important to have our outline designed as hourglass for this cache. If we put the most complex sparse dimension in other position than the last one, we will never be able to have concurrent bitmaps and the size of the bitmap will be huge.

Then after this trick explanation the only information we need to calculate the calculator cache are:

- The amount of member in each sparse dimension.
- The amount of levels in the biggest sparse dimension.
- The biggest sparse dimensions should be placed in the last place on the outline.

All this information can be acquired by:

EAS | MAXL | ESSCMD | JAVA |

Amount of members Right click in a cube edit properties->Dimensions | None | None | selection.executeQuery(dimension.getName(), IEssMemberSelection.QUERY_TYPE_DESCENDANTS, 0, null, null, null); |

Levels Double click in outline-> count the parents | None | None | IEssDimension dimension = (IEssDimension) otl.getDimensions().getAt(i); IEssIterator level = dimension.getLevels(); |

Then resuming everything we saw in this post:

- Calculator cache is a buffer in memory that Essbase uses to create and track data blocks during calculation operations
- Essbase split the sparse dimensions in 2 groups:
- Bitmap dimensions: Any sparse dimensions that can be fit inside the bitmap. Each member combination placed in the bitmap occupies 1 bit of memory, and the entire dimension must fit inside the bitmap.

- Anchoring dimensions: The remaining sparse dimensions that do not fit into the bitmap.

- Because the calculator cache controls the size of the bitmap, the number of sparse dimensions that can fit in the bitmap and anchoring dimensions depends on the size of the calculator cache
- Essbase starts with the first sparse dimension in the outline and fits as many as possible into the bitmap.
- Essbase stops the process when it cannot fit another complete sparse dimension into the bitmap.
- All the remaining sparse dimensions becomes anchoring dimensions
- The number of bitmaps used is determined by the maximum number of dependent parents for any members in the anchoring dimension
- The max number of dependent parents is the same as the number of Levels in a dimension
- Depending of the cache setting we can have 3 options
- Single anchoring multiple bitmaps.

- Single anchoring single bitmap.

- And multiple anchoring single bitmap.

- And to calculate everything we just need 2 things:
- The amount of member in each sparse dimension.

- The amount of levels in the biggest sparse dimension.
- The biggest sparse dimensions should be placed in the last place on the outline.

I hope you guys enjoy it, be safe and see you next time.

## Leave a Reply