com.sas.storage.olap
Class PerformanceTuning

com.sas.storage.olap.PerformanceTuning
All Implemented Interfaces:
java.lang.Cloneable

public class PerformanceTuning
implements java.lang.Cloneable

PerformanceTuning Object defines the performance settings for OLAP data. The OLAP data model s this information to make the remote calls more efficient by bringing over and storing the right amount of data. Each OLAP data model has a default PerformanceTuning object (with default values) associated with it. The model maintains different caches for the cells and tuples (for each axis). The performance properties can be set on any of the following cache types.

 CELL_TYPE,  FORMATTED_CELL_TYPE, ALL_CELL_TYPES, 
 COLUMNS_AXIS_TYPE,  ROWS_AXIS_TYPE, PAGES_AXIS_TYPE, 
 SECTIONS_AXIS_TYPE,  CHAPTERS_AXIS_TYPE, SLICERS_AXIS_TYPE, 
 ALL_AXIS_TYPES, ALL_TYPES.
 
A viewer or a r can let the model know how it is going to access the data by setting the properties on the PerformanceTuning Object. Any time a r or viewer wants to get data in blocks, they should set the page size to the display size of the viewer. This will enable the model to get the data in blocks of page sizes.
A Table or list viewer typically would set the page size on axis type cache - that is how many rows and columns are displayed at a time in the viewer.
If the viewer or r expects all the data to be displayed and does not mind taking an initial performance hit may set the pageSize/pageCount property to MAX_VALUE.
If the r wants to access the data in a random way (may not need all the data), it may be beneficial to disable the look ahead flag and make specific request for the data.
For example a viewer can let the model know of its display page size by using setPageSize(COLUMNS_AXIS_TYPE, 5) and setPageSize(ROWS_AXIS_TYPE, 10). A viewer may or may not want to set the page count.The page size and count is d together to figure out the look ahead value. In addition, a viewer can also set the page count using setPageCount(ALL_AXIS_TYPES, 10) to let the model know how many pages to look ahead. In the above example, the model will read 50 tuples at a time for columns, 100 tuples at a time for rows and 5000 cells.
An example of setting thePerformanceTuning object on the model by a viewer
                PerformanceTuning pf = ((OLAPDataSetNavigation)olapDataSet).getPerformanceTuning();
                if (pf == null)
                        pf = new PerformanceTuning();
     pf.setPageCount(PerformanceTuning.ALL_AXIS_TYPES, 4);
     pf.setPageSize(PerformanceTuning.COLUMNS_AXIS_TYPE, 5);
                pf.setPageSize(PerformanceTuning.ROWS_AXIS_TYPE, 10);
                ((OLAPDataSetNavigation)olapDataSet).setPerformanceTuning(pf);
 
                businessQueryToOLAPDataSetAdapter1 = new BusinessQueryToOLAPDataSetAdapter( );
                businessQueryToOLAPDataSetAdapter1 = new BusinessQueryToOLAPDataSetAdapter(  );
                businessQueryToOLAPDataSetAdapter1.setModel( dataSelection1 );
                
                PerformanceTuning pf = businessQueryToOLAPDataSetAdapter1.getPerformanceTuning();
                if (pf == null)
                        pf = new PerformanceTuning();
            pf.setPageSize(PerformanceTuning.ALL_AXIS_TYPES, 20);
                pf.setPageSize(PerformanceTuning.ALL_AXIS_TYPES, 5);
                ((OLAPDataSetInterface)businessQueryToOLAPDataSetAdapter1).setPerformanceTuning(pf);

                        //Do not set the model afterwards, otherwise  the performance tuning settings are lost.
                businessQueryToOLAPDataSetAdapter1.setModel( dataSelection1 );
 
Buffer size property is d to set the size of a cache. A r who does not want any data discarded once retrieved with a remote call would have to set the buffer size for all cache types to be the count of the data for that type, that is the tuple count for axis type and cell count for cell type. Or they can the constant MAX_VALUE to mean all the possible values. For example, in the above example pf.setBufferSize(ALL_TYPES, PerformanceTuning.MAX_VALUE The constant MAX_VALUE can be d with any property page count, page size etc.
NOTE:
Since the OLAP model has a default object associated with it, it is more efficient to get the object from the model and set the values on it.
The default values of these caches are dependent on the type of cache.
It is assumed that in most cases columns would have less tuples than the rows.
Setting Cell cache properties are not recommended. They are figured out internally using the axis cache properties.


Field Summary
static int ALL_AXIS_TYPES
          Constant to indicate All axis type
static int ALL_CELL_TYPES
          Constant to indicate both formatted and unformatted cell types
static int ALL_TYPES
          Constant to indicate all types, that is all cell and axis type
static int CELL_TYPE
          Constant to indicate the unformatted cell cache type
static int CHAPTERS_AXIS_TYPE
          Constant to indicate Chapter axis type
static int COLUMNS_AXIS_TYPE
          Constant to indicate Column axis type
static int FORMATTED_CELL_TYPE
          Constant to indicate theFormatted cell cache type
static int MAX_VALUE
          Constant indicating maximum value for any property.
static int PAGES_AXIS_TYPE
          Constant to indicate Page axis type
static java.lang.String RB_KEY
           
static int ROWS_AXIS_TYPE
          Constant to indicate Row axis type
static int SECTIONS_AXIS_TYPE
          Constant to indicate Section axis type
static int SLICERS_AXIS_TYPE
          Constant to indicate Slicer axis type
 
Constructor Summary
PerformanceTuning()
           
PerformanceTuning(int numAxes)
           
 
Method Summary
 java.lang.Object clone()
           
 com.sas.storage.olap.CacheProperties[] getAllCaches()
           
 int getBufferSize(int cacheType)
          Get the buffer size of the specified cache.
 com.sas.storage.olap.CacheProperties[] getCache(int cacheType)
           
 int getLookAhead(int cacheType)
           
 OLAPDataSetInterface getModel()
          Used internally
 int getPageCount(int cacheType)
          Get the value for the page count for the specified cache.
 int getPageSize(int cacheType)
          Get the page size for the specified cache.
 boolean isLookAheadEnabled(int cacheType)
          Check if the look ahead is set.
 void setBufferSize(int cacheType, int size)
          Set the size for the cache.
 void setLookAheadEnabled(int cacheType, boolean lookAheadEnabled)
          Set if the look ahead is enabled or not.
 void setModel(OLAPDataSetInterface model)
          Used internally
 void setPageCount(int cacheType, int pageCount)
          Set the number of pages to get with a remote call.
 void setPageSize(int cacheType, int size)
          Set the page size for the specified cache.
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

MAX_VALUE

public static int MAX_VALUE
Constant indicating maximum value for any property. When d for buffer size property it would mean to set it to the maximum value, that is the tuple count for axis type cache and cell count for cell type cache. When d for page count and/or page size, will mean all the tuples to be retrieved with one remote call


CELL_TYPE

public static int CELL_TYPE
Constant to indicate the unformatted cell cache type


FORMATTED_CELL_TYPE

public static int FORMATTED_CELL_TYPE
Constant to indicate theFormatted cell cache type


ALL_CELL_TYPES

public static int ALL_CELL_TYPES
Constant to indicate both formatted and unformatted cell types


COLUMNS_AXIS_TYPE

public static int COLUMNS_AXIS_TYPE
Constant to indicate Column axis type


ROWS_AXIS_TYPE

public static int ROWS_AXIS_TYPE
Constant to indicate Row axis type


PAGES_AXIS_TYPE

public static int PAGES_AXIS_TYPE
Constant to indicate Page axis type


SECTIONS_AXIS_TYPE

public static int SECTIONS_AXIS_TYPE
Constant to indicate Section axis type


CHAPTERS_AXIS_TYPE

public static int CHAPTERS_AXIS_TYPE
Constant to indicate Chapter axis type


SLICERS_AXIS_TYPE

public static int SLICERS_AXIS_TYPE
Constant to indicate Slicer axis type


ALL_AXIS_TYPES

public static int ALL_AXIS_TYPES
Constant to indicate All axis type


ALL_TYPES

public static int ALL_TYPES
Constant to indicate all types, that is all cell and axis type

Constructor Detail

PerformanceTuning

public PerformanceTuning()

PerformanceTuning

public PerformanceTuning(int numAxes)
Method Detail

getCache

public com.sas.storage.olap.CacheProperties[] getCache(int cacheType)

getAllCaches

public com.sas.storage.olap.CacheProperties[] getAllCaches()

getModel

public OLAPDataSetInterface getModel()
Used internally


setModel

public void setModel(OLAPDataSetInterface model)
Used internally


setBufferSize

public void setBufferSize(int cacheType,
                          int size)
                   throws OLAPException
Set the size for the cache. The cache will store only 'size' number of elements.

Parameters:
type - indicating the cache whose size you are setting. The types are
 CELL_TYPE,  FORMATTED_CELL_TYPE, ALL_CELL_TYPES, 
 COLUMNS_AXIS_TYPE,  ROWS_AXIS_TYPE, PAGES_AXIS_TYPE, 
 SECTIONS_AXIS_TYPE,  CHAPTERS_AXIS_TYPE, SLICERS_AXIS_TYPE, 
 ALL_AXIS_TYPES, ALL_TYPES.
 
size - new size of the cache.
Throws:
OLAPException

getBufferSize

public int getBufferSize(int cacheType)
                  throws OLAPException
Get the buffer size of the specified cache. Combination type is not supported.

Parameters:
type - indicating the cache whose size you are getting. The types are
 CELL_TYPE,  FORMATTED_CELL_TYPE,
 COLUMNS_AXIS_TYPE,  ROWS_AXIS_TYPE, PAGES_AXIS_TYPE, 
 SECTIONS_AXIS_TYPE,  CHAPTERS_AXIS_TYPE, SLICERS_AXIS_TYPE, 
 
Returns:
buffer size for the passed in cache type
Throws:
OLAPException

setLookAheadEnabled

public void setLookAheadEnabled(int cacheType,
                                boolean lookAheadEnabled)
                         throws OLAPException
Set if the look ahead is enabled or not. If look ahead is set to true, the model will get more elements from a remote call regardless of the requested value. The r will only get the requested value.

Parameters:
type - indicating the cache whose look ahead should be enabled or disabled. The types are
 CELL_TYPE,  FORMATTED_CELL_TYPE, ALL_CELL_TYPES, 
 COLUMNS_AXIS_TYPE,  ROWS_AXIS_TYPE, PAGES_AXIS_TYPE, 
 SECTIONS_AXIS_TYPE,  CHAPTERS_AXIS_TYPE, SLICERS_AXIS_TYPE, 
 ALL_AXIS_TYPES, ALL_TYPES.
 
lookAheadEnabled - if true, the remote call will get elements that are the size specified by page size and page count property, if false will only get the requested elements
Throws:
OLAPException

isLookAheadEnabled

public boolean isLookAheadEnabled(int cacheType)
                           throws OLAPException
Check if the look ahead is set. If look ahead is set the remote call will get number of elements specified by page count and page size property. The default value is true

Parameters:
type - indicating the cache for which the look ahead is requested. The types are
 CELL_TYPE,  FORMATTED_CELL_TYPE, ALL_CELL_TYPES, 
 COLUMNS_AXIS_TYPE,  ROWS_AXIS_TYPE, PAGES_AXIS_TYPE, 
 SECTIONS_AXIS_TYPE,  CHAPTERS_AXIS_TYPE, SLICERS_AXIS_TYPE, 
 ALL_AXIS_TYPES, ALL_TYPES.
 
Returns:
if look ahead is enabled or not.
Throws:
OLAPException

setPageCount

public void setPageCount(int cacheType,
                         int pageCount)
                  throws OLAPException
Set the number of pages to get with a remote call. If the look ahead property is enabled, a remote call will always get count number of pages, regardless of the number of requested elements. A r will always get the requested elements.

Parameters:
type - indicating the cache for which the page count is set.
pageCount - number of pages to request with a remote call.
Throws:
OLAPException

getPageCount

public int getPageCount(int cacheType)
                 throws OLAPException
Get the value for the page count for the specified cache. This along with the page size is the total number of elements d by a remote call.

Parameters:
type - indicating the type of cache to get the count.
Returns:
the number of pages to read with a remote call.
Throws:
OLAPException

setPageSize

public void setPageSize(int cacheType,
                        int size)
                 throws OLAPException
Set the page size for the specified cache. The page size is d with page count to get the total number of elements with a remote call. The model will bring over elements in blocks of page size to avoid unnecessary remote calls.

Parameters:
type - indicating the cache to set the page size.
pageSize - indicating size of the page, which is d to determine the block of reads.
Throws:
OLAPException

getPageSize

public int getPageSize(int cacheType)
                throws OLAPException
Get the page size for the specified cache. The page size indicates the block of elements to get with each remote read.

Parameters:
type - indicating the cache to set the page size.
Returns:
the page size for the specified cache
Throws:
OLAPException

getLookAhead

public int getLookAhead(int cacheType)
                 throws OLAPException
Throws:
OLAPException

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException



Copyright © 2009 SAS Institute Inc. All Rights Reserved.