HTML report viewer file cache cleanup

2 Answers 55 Views
Report Viewer - HTML5
Al
Top achievements
Rank 1
Iron
Iron
Iron
Al asked on 03 Dec 2021, 08:21 AM
I use the html report viewer with a custom reports controller and works great, I'm using a file cache in the default windows temp location ie. C:\WINDOWS\Temp\Html5App. I have noticed a massive amount of files in this folder (all quite small in size but there are so many that the total size is around 4G). I was wondering what the cleanup process is for this cache? should this be handled automatically or is it my responsibility to do the cleanup?

2 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 07 Dec 2021, 03:57 PM

Hi Alwin,

Indeed, when you use FileStorage, our REST Service generates a structure of folders and files that keeps the state of each client/viewer that uses the service. Periodically, the assets get cleaned by the service. How long a client will be kept alive depends on the REST Service properties ClientSessionTimeout - see the article HTML5 Report Viewer and Reporting REST services.

Periodically (each 5 min), the Rest Service performs cleaning of the expired sessions. Note that in order for the service to clean the inactive sessions it has to be awakened by a request from an active client/viewer. Hence, all inactive sessions will be deleted after some time that is determined by the ClientSessionTimeout and the time intervals in which the inactive sessions get removed from the service, provided the service is awake.

If the service stops before the client sessions have been deleted (including before it has been awakened to delete them), the uncleaned sessions will remain in the Storage. The data will be useless, but it will not be removed as the REST Service has already stopped before there has been a request to awaken it and let it automatically clean the expired storage data. In such cases, you need to manually clean the storage. That said, you need to delete manually the folder C:\WINDOWS\Temp\Html5App each time the REST Service stops. This way, you will remove the leftovers and prevent the unnecessary increase of occupied storage. While the REST Service runs normally, it takes care of its expired assets and the cleaning happens automatically.

Regards,
Todor
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
0
Al
Top achievements
Rank 1
Iron
Iron
Iron
answered on 10 Dec 2021, 10:50 AM

Thanks Todor, two questions:

1. Surely it will take some time for the inactive sessions to be removed and the REST service will only running for a relatively short time ie. just enough time to serve the report. It will only everrun for a few seconds and then stop - is this generally enough time for the cleanup to happen?

2. I noticed that in my resolver the timeout had been commented out, does this mean that some default timeout is applied or that there is no timeout hence why my cache files are not being deleted?


           configurationInstance = new ReportServiceConfiguration
            {
                HostAppId = "Html5App",
                Storage = new FileStorage(), 
                ReportResolver = new MyResolver(),
                // ReportSharingTimeout = 0,
                // ClientSessionTimeout = 15,                 
            };

 

Todor
Telerik team
commented on 15 Dec 2021, 08:20 AM

1. The REST Service initiates cleaning each 5min. In the worst case, you need to add also the ClientSessionTimeout to get the actual time after which the storage will be cleared from the expired assets, provided the service is awakened. If the service runs for a few seconds only and then is forced to stop, it cannot clean its storage and you need to do this manually.

2. Indeed, there is a default ClientSessionTimeout that is 15min - check ReportServiceConfiguration.ClientSessionTimeout Property. You may set it to a lower value. Still, the 5min period for initiating the cleaning process will remain.

Al
Top achievements
Rank 1
Iron
Iron
Iron
commented on 15 Dec 2021, 11:56 AM

I think I understand the behaviour, I just can't see what would cause the service to run for longer than a few seconds ever, I mean surely it only ever runs as long as it takes to serve the report (which will be quick)?

Based on this I see that ti would always be my responsibility to do the cleanup?

Todor
Telerik team
commented on 20 Dec 2021, 09:44 AM

Generally, the service runs while the project it is embedded in is running. Do you mean that you stop the project after rendering the reports? If so, indeed, you will have to take care of storage cleaning.

If the project with the service is running for a long period, the REST Storage will be cleaned periodically. Let's say the client "1" has expired and another client, "2" is accessing the service. In this scenario, the service is awakened by client "2" and the expired client "1" assets will be deleted by the service.

Tags
Report Viewer - HTML5
Asked by
Al
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Todor
Telerik team
Al
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or