Ankitraut-6953 avatar image
0 Votes"
Ankitraut-6953 asked AnuragSharma-08 answered

StackExchange.Redis.RedisTimeoutException in Azure Redis Session State Provider

Hello Azure Team,

We have recently implemented Azure Redis Session state provider on DotNet 4.8 framework MVC application. It was working fine for up to 300 logged-in users on the Load test. When we are to step up the load test upto 10k users suddenly we keep getting the timeout exceptions.

Resource tier: Premium P3 (26 GB)
Region: Central US (Both Redis and Web Instance)

Web config setting :
<sessionState mode="Custom" timeout="20" customProvider="SessionStateProvider">
<add name="SessionStateProvider" type="Microsoft.Web.Redis.RedisSessionStateProvider" connectionString=",ssl=True,abortConnect=False" databaseId="1" loggingClassName=".Libraries.***.Utilities.Helper.RedisLogger" loggingMethodName="LogSessionStateActivity" connectionTimeoutInMilliseconds = "10000" operationTimeoutInMilliseconds = "3000" retryTimeoutInMilliseconds="5000"/>

Error :
Method WriteLine -[2022-05-09 11:47:10.107][Error]SetAndReleaseItemExclusive => StackExchange.Redis.RedisTimeoutException: The timeout was reached before the message could be written to the output buffer, and it was not sent (5000ms, inst=611, qs=8, in=0, active=EVAL), inst: 611, qs: 8, in: 0, serverEndpoint: Unspecified/, mgr: 10 of 10 available, clientName: NPR-WEB-02-STAP, IOCP: (Busy=0,Free=1000,Min=32,Max=1000), WORKER: (Busy=715,Free=32052,Min=32,Max=32767), v: 2.0.519.65453 (Please take a look at this article for some common client-side issues that can cause timeouts: at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 2175 at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in C:\projects\stackexchange-redis\src\StackExchange.Redis\RedisBase.cs:line 54 at StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) in C:\projects\stackexchange-redis\src\StackExchange.Redis\RedisDatabase.cs:line 1134 at Microsoft.Web.Redis.StackExchangeClientConnection.<>c_DisplayClass7_0.b0() at Microsoft.Web.Redis.StackExchangeClientConnection.OperationExecutor(Func`1 redisOperation) at Microsoft.Web.Redis.StackExchangeClientConnection.RetryLogic(Func`1 redisOperation) at Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) at Microsoft.Web.Redis.RedisConnectionWrapper.TryUpdateAndReleaseLock(Object lockId, ISessionStateItemCollection data, Int32 sessionTimeout) at Microsoft.Web.Redis.RedisSessionStateProvider.d_25.MoveNext() User Referrer: Browser Name: Firefox UserId: File Path: D:\SPP\znode-pro-staples\Projects\Libraries\Znode.Libraries.ECommerce.Utilities\Helper\RedisLogger\RedisLogWriter.cs Method Name: WriteLine Line Number: 126 Logger: RedisLogWriter.cs

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AnuragSharma-08 avatar image
0 Votes"
AnuragSharma-08 answered

Hi @Ankitraut-6953, welcome to Microsoft Q&A forum.

As per question, your application works fine with 300 logged sessions but when we increase the test load considerably then it times out. It could be due to traffic burst, large key values, high CPU usage etc.

All cache sizes support range of get request (1 KB size). If the requests cross these sizes cumulatively there are chances for timeouts. Check the below table for more details:


I would request you to increase sharding on the redis cache and try again once as mentioned in the below article:

Configure Redis clustering for a Premium Azure Cache for Redis instance

Can you also check the metrics of CPU, connections and Gets as per the Monitor Azure Cache for Redis?

image.png (39.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Ankitraut-6953, just wanted to follow up on this if you still are facing the issue.

0 Votes 0 ·