English (Español a continuación)
The calculation cache is a buffer (temporary storage memory) that Essbase uses to create and locate blocks of data during calculation. Using this cache, the calculation finds existing blocks faster than if it had to go to disk, especially when the database is being calculated for the first time or when the data is sparse, which can significantly improve calculation times.
This calculation cache is used by Essbase to determine when it is necessary to create a parent block and which child blocks are necessary to calculate this parent block, without having to go to disk.
The size of the calculation cache (as well as the «index cache», «data file cache» and «data cache») impacts more when the calculations are based more on aggregations than on calculation formulas.
1.- Structure of the calculation cache
Essbase classifies sparse dimensions into «bitmap dimension» and «anchor dimension»:
- Essbase places the sparse dimensions in the calculation bitmap; it starts by selecting the first sparse dimension in the outline and moves to the next sparse dimension until a new full sparse dimension no longer fits in the bitmap.
- The rest of the dimensions that do not fit in the bitmap are the anchor dimensions.
- It is convenient to order the sparse dimensions in the outline so that the maximum number fits in the calculation bitmap: start with the smallest dimensions and progressively continue with the largest ones. So the anchor dimension is the last one, the one with the largest size.
- Each individual combination of the members of the sparse dimensions located in the bitmap occupies 1 bit of memory.
To know which are the bitmap dimensions and which are the anchor dimensions, use the SET MSG DETAIL instruction.
Essbase can use a single bitmap or multiple bitmaps:
- A single bitmap: when there are multiple anchor dimensions or if the calculation cache is not large enough to store multiple bitmaps.
- Multiple bitmaps: when there is only one anchor dimension.
Features of these options:
A single bitmap:
- It is used to locate the blocks of the children.
- Consumes less memory but is less efficient.
Multiple bitmaps:
- One bitmap locates the child blocks and another the parent blocks.
- Consumes more memory but is more efficient. This improvement is especially significant when calculating the database for the first time.
- The number of bitmaps is determined by the maximum number of parents that a member of the anchor dimension can have. Each member has a dependent parent except for a shared member.
In short, 3 possible situations, which ordered from highest to lowest level of efficiency are:
- A single anchor dimension and multiple bitmaps.
- A single anchor dimension and a single bitmap.
- Multiple anchor dimensions and a single bitmap.
Of these three options, Essbase will select the one that is most optimal for the calculation, a selection that will depend on the size that we have assigned to the calculation cache.
- If the size of the calculation cache is too small Essbase does not use it, which can negatively affect the efficiency of the calculation.
2.- Size of the calculation cache
The size of the calculation cache is calculated:
- Cache size: Bitmap size (in bytes) * number of bitmaps.
- Bitmap size (number of combinations of members of the bitmaps / 8 dimensions); the minimum size is 4 bytes.
- No. of bitmaps: maximum number of dependent parents in the anchor dimensions + 2 (constant bitmaps).
Let’s see an example:
Suppose 4 spare dimensions
- Dim1: 10 members
- Dim2: 15 members
- Dim3: 20 members
- Dim4: 10 members
Option 1: A single anchor dimension and multiple bitmap dimensions:
The dimensions «Dim1», «Dim2» and «Dim3» are bitmap dimensions.
The dimension «Dim4» is the anchor dimension; the maximum number of dependent parents is 3.
- Bitmap size: (10 * 15 * 20) / 8 = 375 bytes
- No. of bitmap: 3 + 2 = 5 bitmaps
- Calculation cache size: 375 * 5 = 1,875 bytes
Option 2: A single anchor dimension and a single bitmap:
The dimensions «Dim1», «Dim2» and «Dim3» are bitmap dimensions.
The dimension «Dim4» is the anchor dimension.
- Bitmap size: (10 * 15 * 20) / 8 = 375 bytes
- No. of bitmap: 1 bitmap
- Calculation cache size: 375 * 1 = 375 bytes
Option 3: Multiple anchor dimensions and a single bitmap:
The dimensions «Dim1», «Dim2» are bitmap dimensions.
Dimensions «Dim3» and «Dim4» are anchor dimensions.
- Bitmap size: (10 * 15) / 8 = 19 bytes
- No. of bitmap: 1 bitmap
- Calculation cache size: 19 * 1 = 19 bytes
Depending on the size of the calculation cache, Essbase will select one option or another, always looking for the most efficient one:
- If the calculation cache is equal to or greater than 1.875 bytes, select the first option (the most efficient).
- If the calculation cache is equal to or greater than 375 bytes but less than 1.875 bytes, it will select the second option (the second most efficient).
- If the calculation cache is equal to or greater than 19 bytes but less than 375 bytes, it will select the third option (the third most efficient).
- If the calculation cache is less than 19 bytes it will not apply it.
To find out the cache option that Essbase applies in a calculation, you can include the SET MSG SUMMARY command in the calculation script.
3.- Using the SET CACHE command
Essbase uses the calculation cache whenever:
- The database has at least two sparse dimensions.
- At least one complete sparse dimension is calculated (unless, as we will see below, the ALL parameter is used).
Essbase offers three levels of cache for calculation.
- High
- Default
- Low
The size of the cache corresponding to each of these levels is defined in the file «essbase.cfg.file» on the server where it can be modified.
- By default, Essbase applies the “Default” level, and the default size applied to this level is 200.000 bytes.
- The maximum cache level that can be defined is 200.000.000 bytes. According to some analysts, it is not recommended to allocate more than 50 MB to the compute cache (the algorithms that Esssbase uses to locate the blocks reach their limit at this size).
- To define the cache level corresponding to each level, use the instruction: CALCCACHE {HIGH / DEFAULT / LOW} in the file «essbase.cfg.file».
To change the cache level to be applied in the calculation, use the command:
- SET CACHE HIGH / DEFAULT / LOW;
In the log you can see the level of cache applied in the calculation by means of the command «SET MSG».
Through trials, it is possible to estimate the optimal size of the calculation cache.
This command also offers other possible parameters:
- SET CACHE OFF / ALL;
With the parameter “OFF” Essbase does not use the calculation cache (by default Essbase applies the calculation cache.
- This default option can also be changed in the file «essbase.cfg.file» by means of the CALCCACHE {TRUE / FALSE} instruction.
With the parameter “ALL” Essbase uses the calculation cache even when it does not calculate at least one full sparse dimension.
This SET CACHE command can be used more than once in a calculation script; at each moment it will apply the last one that it has read in the script.
Español
El caché de cálculo es un buffer (memoria de almacenamiento temporal) que Essbase utiliza para crear y localizar los bloques de datos durante el cálculo. Al utilizar este caché el cálculo localiza más rápidamente los bloques existentes que si tiene que acudir al disco, especialmente cuando la base de datos se calcula por primera vez o cuando los datos están dispersos, lo que puede mejorar significativamente los tiempos de cálculo.
Este caché de cálculo lo utiliza Essbase para determinar cuándo es necesario crear un block padre y qué bloques hijos son necesarios para calcular este bloque padre, sin tener que acudir al disco.
El tamaño del caché de cálculo (así como el “index cache”, “data file cache” y “data cache”) impacta más cuando los cálculos están basados más en agregaciones que en fórmulas de cálculo.
1.- Estructura del caché de cálculo
Essbase clasifica las dimensiones dispersas en “dimensión bitmap” y “dimensión de anclaje”:
- Essbase va situando en el bitmap de cálculo las dimensiones dispersas; comienza seleccionando la primera dimensión dispersa del outline y va pasando a la siguiente dimensión dispersa hasta que ya no cabe una nueva dimensión dispersa completa en el bitmap.
- El resto de dimensiones que no caben en el bitmap son las dimensiones de anclaje.
- Es conveniente ordenar las dimensiones dispersas en el outline para que el máximo número quepa en el bitmap de cálculo: comenzar con las dimensiones más pequeñas y continuar progresivamente con las mayores. De modo que la dimensión de anclaje sea la última, la que tiene mayor tamaño.
- Cada combinación individual de los miembros de las dimensiones dispersas situadas en el bitmap ocupa 1 bit de memoria.
Para conocer cuáles son las dimensiones bitmaps y cuales las de anclaje se utiliza la instrucción SET MSG DETAIL.
Essbase puede utilizar un único bitmap o múltiples bitmaps:
- Un único bitmap: cuando hay múltiples dimensiones de anclaje o si el caché de cálculo no tiene tamaño suficiente para almacenar varios bitmaps.
- Múltiples bitmaps: cuando hay una sola dimensión de anclaje.
Características de estas opciones:
Un único bitmap:
- Se utiliza para localizar los bloques de los hijos
- Consume menos memoria pero es menos eficiente
Múltiples bitmaps:
- Un bitmap localiza los bloques hijos y otro los bloques padres.
- Consume más memoria pero es más eficiente. Esta mejora es especialmente significativa cuando se calcula la base por primera vez.
- El número de bitmaps viene determinado por el máximo número de padres que pueda tener un miembro de la dimensión de anclaje. Cada miembro tiene un padre dependiente salvo en el caso de que sea un miembro compartido.
En definitiva se pueden plantear 3 situaciones, que ordenadas de mayor a menos nivel de eficiencia son:
- Una única dimensión de anclaje y múltiples bitmaps.
- Una única dimensión de anclaje y un único bitmap.
- Múltiples dimensiones de anclaje y un único bitmap.
De estas tres opciones Essbase seleccionará en cada momento la que resulte más óptima para el cálculo, selección que va a depender del tamaño que le hayamos asignado al caché de cálculo.
- Si el tamaño el cache de cálculo es muy pequeño Essbase no lo utiliza, lo que puede afectar negativamente a la eficiencia del cálculo.
2.- Tamaño del caché de cálculo
El tamaño del cache de cálculo se calcula:
- Tamaño del cache: Tamaño del bitmap (en bytes) * número de bitmaps.
- Tamaño del bitmap (número de combinaciones de miembros de las dimensiones bitmaps / 8); el tamaño mínimo es 4 bytes.
- Nº de bitmaps: número máximo de padres dependientes en las dimensiones de anclaje + 2 (bitmaps constantes).
Veamos un ejemplo:
Supongamos 4 dimensiones dispersas
- Dim1: 10 miembros
- Dim2: 15 miembros
- Dim3: 20 miembros
- Dim4: 10 miembros
Opción 1: Una única dimensión de anclaje y múltiples dimensiones bitmaps:
Las dimensiones “Dim1”, “Dim2” y “Dim3” son dimensiones bitmaps.
La dimensión “Dim4” es dimensión anclaje; el número máximo de padres dependientes es de 3.
- Tamaño del bitmap: (10 * 15 * 20) / 8 = 375 bytes
- Nº de bitmap: 3 + 2 = 5 bitmaps
- Tamaño del cache de cálculo: 375 * 5 = 1.875 bytes
Opción 2: Una única dimensión de anclaje y un único bitmap:
Las dimensiones “Dim1”, “Dim2” y “Dim3” son dimensiones bitmaps.
La dimensión “Dim4” es dimensión anclaje.
- Tamaño del bitmap: (10 * 15 * 20) / 8 = 375 bytes
- Nº de bitmap: 1 bitmap
- Tamaño del cache de cálculo: 375 * 1 = 375 bytes
Opción 3: Múltiples dimensiones de anclaje y un único bitmap:
Las dimensiones “Dim1”, “Dim2” son dimensiones bitmaps.
Las dimensiones “Dim3” y “Dim4” son dimensiones de anclaje.
- Tamaño del bitmap: (10 * 15) / 8 = 19 bytes
- Nº de bitmap: 1 bitmap
- Tamaño del cache de cálculo: 19 * 1 = 19 bytes
Dependiendo del tamaño del cache de cálculo Essbase seleccionara una opción u otra, siempre buscando la más eficiente:
- Si el caché de cálculo es igual o mayor que 1.875 bytes seleccionara la primera opción (la más eficiente).
- Si el caché de cálculo es igual o mayor que 375 bytes pero menor que 1.875 bytes seleccionara la segunda opción (la segunda más eficiente).
- Si el caché de cálculo es igual o mayor que 19 bytes pero menor que 375 bytes seleccionara la tercera opción (la tercera más eficiente).
- Si el caché de cálculo es menor que 19 bytes no lo aplicará.
Para conocer la opción de cache que aplica Essbase en un cálculo se puede incluir el comando SET MSG SUMMARY en el script de cálculo.
3.- Uso del comando SET CACHE
Essbase utiliza el caché del cálculo siempre que:
- La base de datos tenga al menos dos dimensiones dispersas.
- Se calcule al menos una dimensión dispersa completa (salvo que, como veremos a continuación, se utilice el parámetro ALL).
Essbase ofrece tres niveles de cache para el cálculo.
- High
- Default
- Low
El tamaño del cache que corresponde a cada uno de estos niveles viene definido en el fichero “essbase.cfg.file” del servidor donde se puede modificar.
- Por defecto, Essbase aplica al nivel “Default”, y el tamaño por defecto que aplica a este nivel es de 200.000 bytes.
- El nivel máximo de caché que se puede definir es de 200.000.000 bytes. Según algunos analistas, no es recomendable asignar más de 50 MB al caché de cálculo (los algoritmos que utiliza Esssbase para localizar los bloques alcanzan su límite en este tamaño).
- Para definir el nivel de cache correspondiente a cada nivel se utiliza la instrucción: CALCCACHE{HIGH / DEFAULT / LOW} en el fichero “essbase.cfg.file”
Para cambiar el nivel de caché que se quiere aplicar en el cálculo se utiliza el comando:
- SET CACHE HIGH / DEFAULT / LOW;
En el log se puede ver el nivel de caché aplicado en el cálculo mediante el comando “SET MSG”.
A través de ensayos se puede estimar cual es el tamaño óptimo del caché de cálculo.
Este comando también ofrece otros posibles parámetros:
- SET CACHE OFF / ALL;
Con el parámetro “OFF” Essbase no utiliza el caché del cálculo (por defecto Essbase si aplica el caché del cálculo.
- Esta opción por defecto también se puede cambiar en el fichero “essbase.cfg.file” mediante la instrucción CALCCACHE{TRUE / FALSE}
Con el parámetro “ALL” Essbase utiliza el caché del cálculo incluso cuando no calcula al menos una dimensión dispersa completa.
Este comando SET CACHE se puede utilizar más de una vez en un script de cálculo; en cada momento aplicará el último que haya leído en el script.