This is a migrated thread and some comments may be shown as answers.

Redis Cache - Entries never expires

9 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jacques
Top achievements
Rank 1
Jacques asked on 21 Dec 2020, 09:54 AM

Hi all,

I hope that you can help me.
I want to start using Redis cache for my reports but the initial few tests seem problematic as the entries in Redis have a TTL of -1 and therefore also never expires. I must be doing something wrong, any help would be appreciated.

Tech. stack:

  • ASP.NET Core 3.1
  • HTML5 Report Viewer
  • Telerik Reporting Version 14.2.20.916
  • Telerik.Reporting.Cache.StackExchangeRedis.2 Version 14.2.20.916

Code sample of the report configuration:

public ReportConfiguration(ApplicationConfiguration appConfig,
                           IConfiguration configuration,
                           IWebHostEnvironment webRoot,
                           ConnectionMultiplexer redisConnectionMultiplexer )
{
    var reportsPath = Path.Combine(webRoot.WebRootPath, "Reports");
    ReportingEngineConfiguration = configuration;
    HostAppId = "MyApp";
    Storage = new RedisStorage(redisConnectionMultiplexer, RedisCacheKeys.WebReport);
    ReportSourceResolver = new TypeReportSourceResolver().AddFallbackResolver(new UriReportSourceResolver(reportsPath));
    ClientSessionTimeout = 5;
    ReportSharingTimeout = 5;
}


Thanks in advance for your help.

Kind regards,
Jacques

9 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 23 Dec 2020, 04:22 PM

Hi Jacques,

The Storage implementation for Redis doesn't set the expiration of the keys. Instead, the database keys deletion is triggered by the REST service through a common interface applicable to all Storage implementations.

In other words, the entries from the Redis database will be deleted when the reportSharingTimeout and/or clientSessionTimeout expire. These settings are defined in the configuration of the RestReportService and you can read more about them in the restReportService Element article

More information on Cache Management in the HTML5 Report Viewer can be found in the HTML5 Report Viewer and Reporting REST services article.

Basically, the entries of expired clients are removed automatically when a new HTML5 Viewer(client) is registered in the cache storage.

Please let me know if you have any other questions.

Regards, Dimitar Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Jacques
Top achievements
Rank 1
answered on 23 Dec 2020, 05:18 PM

Hi Dimitar, 

 

Thank you for your prompt response.

I can confirm that the entries are never deleted. Each new report generates a new set of keys in Redis and the old keys are never removed.

I tested this by opening a single report, then closing the browser. I leave it like that for 12 hours and the keys are still there. I then open the browser, open a new report and this generates a new set of keys, leaving the old keys untouched in the Redis database.

 

Please see the code snippet I included in the original post. 

 

What am I missing here? 

 

Kind regards, 

Jacques 

0
Dimitar
Telerik team
answered on 29 Dec 2020, 08:09 AM

Hi Jacques,

The observed behavior may be explained if the service has stopped or been restarted without cleaning the storage.

The service caches each client (viewer) session in the Storage. If a viewer gets closed there is no notification and the service does not know that. 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.

To avoid this behavior you may delete the storage, for example when the application hosting the REST Service is closed.

Please attach a Trace Listener to the REST Service to hopefully get more information on the problem. In the logs you may see details like the following that state when and what assets have been deleted from the storage:

Worker rendering threads count: 1
Cache Cleanup (1/7/2020 6:08:51 AM): 'Delete expired cache assets' should be performed as of 1/7/2020 12:08:50 PM, as it is not performed since 1/7/2020 11:56:04 AM and the check period is 00:05:00
Cache Cleanup (1/7/2020 6:08:51 AM): Staring to execute 'Delete expired cache assets'
Cache Cleanup (1/7/2020 6:08:51 AM): Staring to execute 'Delete expired clients'
Cache Cleanup (1/7/2020 6:08:51 AM): 2 clients survived expiration, namely: 4aebf68746a, 2f5c037db1e
Cache Cleanup (1/7/2020 6:08:51 AM): Finished executing 'Delete expired clients'; elapsed: 00:00:00.0076482
Cache Cleanup (1/7/2020 6:08:51 AM): Staring to execute 'Delete expired refreshes & instances'
Cache Cleanup (1/7/2020 6:08:51 AM): Finished executing 'Delete expired refreshes & instances'; elapsed: 00:00:00.0072254
Cache Cleanup (1/7/2020 6:08:51 AM): Finished executing 'Delete expired cache assets'; elapsed: 00:00:00.0272415
w3wp.exe Information: 0 : Unit.DotsPerInch = 96
Assembly ref successfully loaded: AccutracXE.ReportLibrary, Culture=neutral
Rendering thread 10 starts work. 

*** ReportProcessor.ProcessReport STARTED *** 

*** ProcessReport #0 STARTED ***
*** ProcessReport #0 DONE in 00:00:00.8648090 *** 

*** ReportProcessor.ProcessReport DONE in 00:00:00.8908360 ***

Looking forward to receiving an update from you.

Regards, Dimitar Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Jacques
Top achievements
Rank 1
answered on 04 Jan 2021, 08:09 AM

Hi Dimitar,

Thank you, that makes sense.

I can confirm that the trace listeners are printing out the expected output but the keys in Redis is not being removed. (This output was after client 52df476ea20 has been closed)

The trace output:

Cache Cleanup (2021/01/04 09:46:21): 'Delete expired cache assets' should be performed as of 2021/01/04 07:46:20, as it is not performed since 2021/01/04 07:37:51 and the check period is 00:05:00
Cache Cleanup (2021/01/04 09:46:21): Staring to execute 'Delete expired cache assets'
Cache Cleanup (2021/01/04 09:46:21): Staring to execute 'Delete expired clients'
Cache Cleanup (2021/01/04 09:46:21): Deleted client 52df476ea20, who expired @ 2021/01/04 07:45:36
Cache Cleanup (2021/01/04 09:46:21): 1 clients survived expiration, namely: aee1b8c3a5f
Cache Cleanup (2021/01/04 09:46:21): Finished executing 'Delete expired clients'; elapsed: 00:00:00.0213914
Cache Cleanup (2021/01/04 09:46:21): Staring to execute 'Delete expired refreshes & instances'
Cache Cleanup (2021/01/04 09:46:21): Deleted refresh 76ec6acb605 that expired on 2021/01/04 07:42:52
Cache Cleanup (2021/01/04 09:46:21): Deleted instance f0b650cf164
Cache Cleanup (2021/01/04 09:46:21): Finished executing 'Delete expired refreshes & instances'; elapsed: 00:00:00.0438257
Cache Cleanup (2021/01/04 09:46:21): Finished executing 'Delete expired cache assets'; elapsed: 00:00:00.0792854
Rendering thread 69 starts work.

 

But all the keys that client 52df476ea20 created is still active/available in Redis.

 

Your thoughts?

 

Regards,

Jacques

0
Dimitar
Telerik team
answered on 05 Jan 2021, 07:55 AM

Hi Jacques,

Thank you for the provided information.

That's strange behavior that we will need to further investigate. We are going to try to reproduce the issue.

Could you please share the version of Redis DB that you are using? Also, any additional information that you think might be related to the problem, would be more than welcome.

I will be looking forward to receiving an update from you.

Regards, Dimitar Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Jacques
Top achievements
Rank 1
answered on 05 Jan 2021, 02:04 PM

Hi Dimitar,

Thank you, I appreciate your help with this.

Please see my first post for details about my setup.

Redis version (Running on Ubuntu 20.0.4 LTS):

Redis server v=5.0.7 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=636cde3b5c7a3923

Please let me know if I can be of more assistance.

 

Kind regards,

Jacques

0
Dimitar
Telerik team
answered on 06 Jan 2021, 02:34 PM

Hello Jacques,

Thank you for the information.

So far we have tested our Telerik Reporting using the Redis storage only with Windows.

We are going to proceed to investigate if there could be a possible issue with Linux based systems.

I will update you when I have new information.

Regards, Dimitar Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Jacques
Top achievements
Rank 1
answered on 15 Jan 2021, 09:08 AM

Hi Dimitar,

I am just following up to see if there is any feedback yet?

Regards,

Jacques

0
Dimitar
Telerik team
answered on 18 Jan 2021, 02:51 PM

Hi Jacques,

Our testing on Linux has so far not been able to reproduce this issue. Here's our setup:

Redis-server v=4.0.9 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=9435c3c2879311f3

Ubuntu 18.04.4 LTS

We are going to need some time to test with the same setup as yours.

I will update you as soon as I have new information.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Jacques
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Jacques
Top achievements
Rank 1
Share this question
or