Redis timeouts when used for session storage

Was seeing a lot of timeout errors in our apps in Azure through app insights. A lot meaning more than 50 per hour. Not to mention sporadic down time. All the timeouts were trying to talk to our redis caches that we use as simple session storage.

Timeout performing EVAL, inst: 1, mgr: Inactive, err: never, queue: 8, qu: 0, qs: 8, qc: 0, wr: 0, wq: 0, in: 43403, ar: 0,
clientName: ServerName1234, serverEndpoint: Unspecified/, keyHashSlot: 12345, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=6,Free=8185,Min=4,Max=8191), Local-CPU: unavailable
(Please take a look at this article for some common client-side issues that can cause timeouts:

I took a look at that article which lead to more articles. These 3 to be specific.

After perusing those I found I needed to add some connection timeout settings to the connection string. Probably obvious to some, but my extent of redis knowledge was knowing we used it and clicking some buttons in the portal to build caches for our environments. This is what I ended up adding to the connection string in the web.config.

connectionTimeoutInMilliseconds = "15000" 
operationTimeoutInMilliseconds = "1000"

That resolved the timeouts and performance and availability went back to normal.

Here is an example of the full connection string for session storage for context.

<! Example connection string -->    
<sessionState timeout="1440" mode="Custom" customProvider="MySessionStateStore">
        <add name="MySessionStateStore"
        connectionTimeoutInMilliseconds = "15000"
        operationTimeoutInMilliseconds = "1000"

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.