Symptom

When using Azure Redis as a SessionState provider for Sitecore the following message “ERROR Exception Occured System.TimeoutException: Timeout performing” appears in the log file. This is due to a timeout when trying to retrieve data from the Azure Redis Cache instance.

Background

Redis is optimized for a large number of small values rather than fewer large values. Depending upon the amount of data in the session these objects could grow beyond

Microsoft has a great article on Azure Redis timeouts but within the context of Sitecore there are generally few common resolutions.

Azure Redis Cache and Sitecore Client in the same Azure Region

Validate if you your Azure Redis Cache and the Sitecore Client are in the same region in Azure. You may receive timeouts when the cache is in East US but the Sitecore Client is in West US and the request doesn’t complete in time. A quick and easy fix is to have the cache and in the client in the same Azure region.

Throttled IOCP or WORKER Threads

Azure Redis can hit timeouts if growth of either IOCP or WORKER threads become throttled due to the number of existing threads which are busy reach the “minimum” number of threads. When this occurs the ThreadPool will throttle the rate of injects new threads to one thread per 500 milliseconds. If the IOCP or WORKER threads are being throttled based upon checking the logs, use the “minIoThreads” configuration setting in the <processModel> configuration element of the machine.config. A good starting place is 200 or 300, then test and tweak as needed.

Error Message
System.TimeoutException: Timeout performing GET Session, inst: 2, mgr: Inactive,
queue: 6, qu: 0, qs: 6, qc: 0, wr: 0, wq: 0, in: 0, ar: 0,
IOCP: (Busy=10,Free=990,Min=5,Max=1000),
WORKER: (Busy=5,Free=995,Min=1,Max=1000)

The value specified is a per-core setting, for example with 4 cores if want your minIOThreads setting to be 100 at runtime, you would use

<processModel minIoThreads="25"/>

 Increase Azure Redis Size and/or Tier

Increase the Size and/or Tier of your Azure Redis Instance. For applications on the Standard Tier consider increasing the size based upon the amount of traffic your site receives, if this is not successful consider moving from the Standard Tier to Premier Tier. The Microsoft Azure Website has a page listing the available tiers and sizes along with the associated pricing.