Intermittent StackExchange.Redis.RedisTimeout Exception in Sitecore

I was encountering frequent time-out issues with Redis and my application deployed on Azure PaaS. Following are the sample exceptions from logs:

redis-timeout-sitecore

Solutions:

I have reviewed config files from our CD server according to Sitecore's recommendation in this KB article here Excessive load on ASP.NET Session State store, and checked some of the points.

  1. In the Web.config and Sitecore.Analytics.Tracking.config files, increase the pollingInterval attribute value on both Private and Shared session state provider definitions from 2 to 60 seconds.
    => For my case, the pollingInterval value is in the Sitecore.Analytics.Tracking.Azure.config file and the value is still 30. I have considered increasing the value further.
  2. In the Sitecore.Analytics.Tracking.config file, find the timeoutBetweenLockAttempts parameter. Increase its value from 10 to 200 milliseconds.
    => The value should be defined in the Sitecore.Analytics.Tracking.config file by default, however, I was not able to find this file in our CD app service. As We are on Sitecore XM instead of XP, we do not have Marketing features and the respective files in our solution.
  3. Changed "aspnet:RequestQueueLimitPerSession" setting value to 25 according to the recommendation. 

I also recommend you to check if the cache tuning is enough or not:

Sitecore uses Redis only for session storage, the data will be transferred to xDB on session timeout. My "redis_read" and "redis_write" connections share the same connection string as "redis.sessions". Since my custom code additionally uses Redis for custom operation, this may impact Sitecore's Redis session if they share one connection string.

  • I have Scaled our Redis and created a different Redis connection exclusively for our custom code. Now we are with two Redis servers, the default is Sitecore Redis, and another is for our Custom Redis.

If your problem persists, then:

  1. Ensure CPU usage is not high. This is a limitation of StackExchange.Redis.
  2. Increase operationTimeoutInMilliseconds from 5000 ms to higher, according to Sitecore's recommendation in this KB article here Redis driver timeout issues 
  3. Scale your Redis.

The last option I can suggest is to collect a few memory dumps when the Redis timeout exception occurs. Refer Sitecore KB article here Collecting A Memory Dump Using Procdump Utility

please consider the following example command to collect the dump:

procdump -accepteula -e 1 -f "StackExchange.Redis.RedisTimeoutException" -ma [Name or PID]

To further analyze the dump file, open it in Microsoft Visual Studio or any third-party tool.

Happy Sitecoreing ðŸ˜Š

Comments

Popular posts from this blog

Sitecore Installation Error: Failed to Start Service 'Sitecore Marketing Automation Engine'

Import CSV Data in Sitecore Using PowerShell: Part-3

Sitecore Technology MVP Journey 2022