Run-to-dry set of reports to improve the performance of the controllable cache

Source: Internet
Author: User

Using caching to improve report performance is an indisputable fact that the general high-end reporting tool provides the functionality of the report cache to cache the entire report calculation to the file system so that users can quickly read the cached results for report presentation the next time they access the same parameter report, and the aggregate report has this general caching capability. However, in some cases, report developers want to be able to control the content of the cache, for example, sometimes they want to cache not the entire report results, but some of them, sometimes cached content can be reused by other reports or programs, and sometimes want to set different cache results to different time-outs in order to cope with the data volume and real-time situation. At this point, the general report cache will not meet the requirements.

The integrated report includes a programmable data computing engine that allows developers to flexibly control cached content. Here we refer to the cache content that developers can control in the development of the use of the aggregate report as a controlled cache. There are more flexibility and benefits that can be generated by caching, as described above in the three-point expansion.

Caching partial results

In report development, there are times when you do not want to cache all report results, which avoids costly cache costs (disk space and Application server resource overhead). In addition, when some of the data in the report real-time requirements are very high, need to interact with the database in real-time data query, then this part of the data is not suitable for caching, then through the collection of the controllable cache of the report can be less frequent changes in the intermediate results cache. When the report requests again, the real-time data is still read from the database in real time, and the data in the cache is calculated in the report, resulting in the final report result set. Conventional caching schemes do not have the ability to cache part of the results, only to set whether the entire report is cached, so that when the report involves the various parts of the data is different in the timeliness of the conflict, and the integrated report is more flexible and more efficient.

Cache result Reuse

The controllable cache in a collection report can be reused, and the cached results (partial or total) of one report can be read and used by other reports or programs without having to cache the same results again (the regular Report caching scheme repeats), which provides a significant overall cache efficiency. Similar to the caching of partial results for real-time requirements, when other reports or programs use the cached results of a report, they only need to be read from the cache (typically a disk file) and blended with other data sources in the report (possibly db, file, or another report's cache), resulting in a result set of the report. The general report cache is sole in the report template, it can not be reused, it will cause some waste of resources and increase some performance cost, and the set report is more flexible and more efficient.

Set different time-outs

The cache that we all know is bound to have a time-out, the cache is cleared when the time-out expires, and the cache file is regenerated when the report is accessed. The cache timeout for a generic report tool is set in the configuration file, such as 3600s or 7200s, which is valid for reports in the app in all parameters and even all reports, in other words, the entire report or even the entire system must use the same settings.

However, this is not the case, and it would be more effective if you could set a different time-out for different reporting scenarios. For example, for a large number of historical data query report, because the historical data change is not big, we want the report cache results can be saved for a long time, so that each query can be quickly read from the cache results, you need to set a longer time-out, and for data changes frequently, Reports with higher real-time requirements will have shorter time-outs to meet the real-time requirements of data.

The result cache for a collection report allows developers to set different time-outs for different reports to address the reporting scenarios mentioned above. Similarly, this approach provides greater flexibility to make the report cache truly human-controllable.

Example

The specific implementation can refer to the relevant documents of the set calculation report, here is a simple example of how to use the results cache, you can refer to the following steps (for example):

1. Use the built-in collector to write scripts to generate/read cache files, the process is in the calculation phase of the report data source.


The above script first specifies the cache directory, and sets the cache file name according to the parameter, and finds the cache file exists (A4) based on the file name, if it exists and does not time out , reads the cache directly; otherwise, the database fetch operation is connected and the result is generated.

If the report does not use caching, then the script only needs to write this:


2. Call the above set-up script in the Set calculation report, edit the report expression to finish the report production.

It should be noted that the controllable cache of the collection report also has its own scenario, and does not completely replace the regular cache, the general cache means with the results of the report and the rendering properties, and here the controllable cache only cache the data, in the rendering of the appearance of the calculation again, more suitable for the data calculation intensity is higher, But the appearance of low computational intensity of the scene. In practical applications, both can be used in combination.


Collection report: www.raqsoft.com.cn/?p=208.

Run-dry set report to improve the performance of the controlled cache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.