Controllable cache for improving the performance of computing reports with clear sets, and controllable reports

Source: Internet
Author: User

Controllable cache for improving the performance of computing reports with clear sets, and controllable reports

It is an indisputable fact that using cache can improve report performance. Generally, high-end report tools provide the report cache function to cache the computing results of the entire report to the file system, this allows you to quickly read the cache results for report presentation when you access reports with the same parameters next time. This is also a common cache function for computing reports. However, in some cases, report developers want to be able to control the cached content. For example, sometimes they want to cache not the entire report result but part of it, and sometimes the cached content can be reused by other reports or programs, sometimes you want to set different timeout times for different cache results to cope with different data volumes and real-time situations. In this case, the general report cache cannot meet the requirements.

A programmable data computing engine is built in computing reports, allowing developers to flexibly control cached content. Here, the cache content that developers can control in the use of computing report development is called controllable cache. Caching can bring more flexibility and benefits. The three points mentioned above are described below.

Cache partial results

In report development, you sometimes do not want to cache all report results. This avoids high cache costs (disk space and application server resource overhead ). In addition, when some data in a report has high real-time requirements and requires real-time interaction with the database for data query, this part of data is not suitable for caching, in this case, the intermediate results with less frequent changes can be cached through the controllable cache of the Set Computing report. When a report is requested again, the data with high real-time requirements is still read from the database in real time, and the report is calculated based on the cached data to obtain the final report result set. The conventional cache scheme does not support caching partial results. It can only set whether the entire report is cached. In this way, the timeliness of each part of the report may be different; the centralized computing reports are more flexible and efficient in this respect.

 

Reuse of cache results

The controllable cache in a computing report can be reused. The cached results (in part or in whole) of a report can be read and used by other reports or programs, instead of caching the same results again (Regular Report cache schemes will repeat), this will greatly improve the overall cache efficiency. Similar to the situations where some cached results meet real-time requirements, when other reports or programs use the cached results of a report, they only need to be read from the cache (usually disk files, it performs a hybrid operation with other data sources in the report (which may be DB, file, or cache of another report) to obtain the report result set. The regular report cache is stand-alone in a report template and cannot be reused with each other, resulting in a certain amount of waste of resources and increased performance overhead, the centralized computing reports are more flexible and efficient in this respect.

 

Set different timeout times

Cache, which we are familiar with, will certainly have a time-out period. The cache will be cleared out of the time-out period, and cache files will be regenerated during report access. The cache timeout time of a common report tool is set in the configuration file, such as 7200 s or s. This setting applies to reports in the application in all parameter conditions and even all reports. In other words, the same settings must be used for the entire report or even the entire system.

However, this is not expected to be more effective if you can set different time-out times for different report scenarios. For example, for reports that query a large amount of historical data, because the historical data does not change much, we hope that the report cache results can be saved for a long time, this allows you to quickly read results from the Cache during each query. In this case, you need to set a long time-out period. For reports with frequent data changes and high real-time requirements, the time-out period is shorter, in order to meet the real-time data requirements.

The result cache of the computing report allows developers to set different time-out times for different reports to cope with the aforementioned report scenarios. Similarly, this approach provides higher flexibility, so that the report cache can be controlled manually.

 

Example

For specific implementation, refer to the relevant documentation of the computing report. Here, an example is provided to briefly describe how to use the result cache. You can refer to the following steps (for example ):

1. write scripts to generate/read cache files using the preset set computing report. This process is in the computing stage of the report data source.


The above script first specifies the cache directory, sets the cache file name according to the parameters, and finds whether the cache file exists (A4) based on the file name. If the cache file exists and does not time out, it reads the cache directly; otherwise, connect to the database and generate cache files based on the calculation results.

 

If no cache is used in the report, you only need to write the script as follows:


2. Call the preceding set computing script in the Set Computing report to edit the report expression to complete report creation.

 

It should be noted that the controllable cache of the computing report also has its application scenarios, and it cannot completely replace the regular cache. The conventional cache means will be combined with the report calculation results and presentation attributes, the controllable cache here only caches data and performs appearance computing again during presentation. It is more suitable for scenarios with high data computing intensity but low appearance computing intensity. In practice, the two can be used in combination.


Computing Report: www.raqsoft.com.cn /? P = 208.

Related Article

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.