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:
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.
-
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. -
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. - 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:
- Cache Tunning in Sitecore
- Monitor and Tune the Cache on the CD Server
- IsLanguageFallbackValid Field Cache Tunning in Sitecore
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:
- Ensure CPU usage is not high. This is a limitation of StackExchange.Redis.
- Increase operationTimeoutInMilliseconds from 5000 ms to higher, according to Sitecore's recommendation in this KB article here Redis driver timeout issues
- 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
Post a Comment