Oracle BI Server Query Cache
Oracle BI Server Query Cache
Manually. In the Administration Tool, in the Manage menu, select Cache to open the Cache Manager. Cache Manager provides the maximum flexibility in choosing which cache entries to purge and when to purge them, but it requires direct human involvement. For more information, refer to Using the Cache Manager.
Automatically. In the Administration Tool, you can disable cache for the system, set caching attributes for a specific physical table, and use Oracle BI event tables to purge cache automatically. For additional information about managing cache, Section 2.
Programmatically. The Oracle BI Server provides ODBC-extension functions for purging cache entries programmatically. These functions give you the choice and the timing flexibility of Cache Manager with the automation of event tables. You can write your own scripts to call these functions at times that fit your needs. For more information, refer to Purging and Maintaining Cache Using ODBC Procedures. The parameters that control query caching are located in the NQSConfig.INI file described in Oracle Business Intelligence Infrastructure Installation and Configuration Guide. NOTE: For information about how to use Delivers to seed the Oracle BI Server Cache, refer to Oracle Business Intelligence Presentation Services Administration Guide.
Advantages of Caching
The fastest way to process a query is to skip the bulk of the processing and use a pre computed answer. Aggregate tables are examples of pre computed answers. Aggregate tables contain pre calculated results for a particular aggregation level. For example, an aggregate table might store sales results for each product by month, when the granularity of detail for the database is at the day level. To create this aggregate table, a process (often a query) computes the results and then stores them in a table in the database. With query caching, the Oracle BI Server stores the pre computed results of queries in a local cache. If another query can use those results, all database processing for that query is eliminated. This can result in dramatic improvements in the average query response time. In addition to improving performance, being able to answer a query from a local cache conserves network resources and processing time on the database server. Network resources are conserved because the intermediate results do not have to come over the network to the Oracle BI Server. Not running the query on the database frees the database server to do other work. If the database uses a charge back system, it could save money in the budget as well. Another benefit of using the cache to answer a query is savings in processing time on the Oracle BI Server, especially if the query results are retrieved from multiple databases. Depending on the query, there might be considerable join and sort processing in the server. If the query is already calculated, this processing is avoided, freeing server resources for other tasks. To summarize, query caching has the following advantages:
Dramatic improvement of query performance. Less network traffic. Reduction in database processing and charge back.
Costs of Caching
Query caching has many obvious benefits, but also certain costs:
Disk space for the cache Administrative costs of managing the cache Potential for cached results being stale Minor CPU and disk I/O on server machine
With proper cache management, the benefits will far outweigh the costs.
Disk Space
The query cache requires dedicated disk space. How much space depends on the query volume, the size of the query result sets, and how much disk space you choose to allocate to the cache. For performance purposes, a disk should be used exclusively for caching, and it should be a high performance, high reliability type of disk system.
Administrative Tasks
There are a few administrative tasks associated with caching. You need to set the cache persistence time for each physical table appropriately, knowing how often data in that table is updated. When the frequency of the update varies, you need to keep track of when changes occur and purge the cache manually when
necessary. You can also create a cache event polling table and modify applications to update the polling table when changes to the databases occur, making the system event-driven. The Oracle BI Server also provides ODBC-extension functions for purging cache entries programmatically. You can write your own scripts to call these functions at the appropriate times.
To set the caching attributes for a specific physical table In the Physical layer, double-click the physical table. In the Physical Table properties dialog box, in the General tab, make one of the following selections: To enable caching, select the Make table cacheable check box. To prevent a table from ever being cached, clear the Make table cacheable check box. To set an expiration time (maximum lifetime), perform the following steps: In the Cache persistence time drop-down list, select a value. If you select Infinite or until you select a different value, the Cache Persistence time field will not be available. Complete the Cache persistence time field. Click OK.
In a clustered environment, Oracle BI Servers can be configured to access a shared cache called the global cache. This global cache resides on a shared file system storage device and stores purging events, seeding events (often generated by agents), and result sets that are associated with seeding events. The seeding and purging events are sorted by time and stored on the shared storage as a logical event queue. Individual Oracle BI Server nodes push to and pull from the logical event queue. Each Oracle BI Server still maintains its own local query cache for regular queries. Figure below depicts global caching in a clustered environment. It shows three Oracle BI Server nodes sharing a global cache. The global cache stores seeding or purging events held in a logical event queue. The arrows from Node 2 and Node 3 to the shared cache show Oracle BI Server Node 2 pushing a seeding event to the queue and Oracle BI Server Node 3 pushing a purging event to the queue. The arrows from the shared storage to each Oracle BI Server node show each node pulling from the common location. This occurs on a periodic basis and enables participating Oracle BI Server nodes to obtain updates to the logical event queue made by other Oracle BI Servers.
Description of "Global Caching" The Oracle BI Server node processes a seeding or purging event locally first in its caching system. It then pushes the event to the global cache on the shared storage. During the push event, the active Oracle BI Server node locks the logical event queue on the shared storage and then pushes in the seeding or purging event. If there is a conflict between seeding and purging (for example, one node wants to seed a query and another node wants to purge the same query), then the event that comes in last wins. The logical event queue in the global cache on the shared storage is composed of seeding and purging events from individual Oracle BI Server nodes. The queue is sorted according to the timestamp of the events. Hence, clocks on all Oracle BI Server nodes participating in cluster must be synchronized. Each Oracle BI Server node polls the global cache on a periodic basis for new cache entries. This polling frequency is configurable. A snapshot of the queued logical events on the shared storage is pulled back to the node and a local logical event queue is constructed and then processed.
Note: The process of populating or purging seeded caches across all Oracle BI Server nodes that participate in the cluster does not occur in real time, and the elapse of the process is affected by multiple factors, such as the predefined polling interval, network bandwidth, and CPU loads. Because the query cache result set tends to get large, network bandwidth might pose a constraint. Therefore, the following must be chosen carefully:
The set of caches that qualify for seeded cache The time interval for BI nodes to pick up seeded caches from shared storage (to avoid network congestion)
The primary global cache parameters are configured in Fusion Middleware Control. Additional, optional parameters are configured in the NQSConfig.INI file for each Oracle BI Server node that participates in the cluster. For more information about configuring these parameters, see "Using Fusion Middleware Control to Set Global Cache Parameters" and "Manually Editing Additional Global Cache Parameters." A seeding or purging procedure is submitted to a specific Oracle BI Server node. If that Oracle BI Server is a node in a BI cluster and the global cache parameters have been defined in Oracle BI Server configuration files, then the seeding or purging events are propagated across all Oracle BI Server nodes that participate in the same clustered environment.