StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.88k stars 1.51k forks source link

[StackExchange.Redis 2.7.4] Timeout performing SADD (30000ms) and Timeout performing GET (30000ms) with no/minimal busy threads #2609

Open Nav-Pandher opened 10 months ago

Nav-Pandher commented 10 months ago

Hi,

I'm new to Redis and StackExchange. I have been looking through the articles but haven't been able to figure my issue out.

I am using a single Redis instance with Stack exchange 2.7.4 with the following configuration:

 private static ConnectionMultiplexer NotLazyConnection;

        public static void CreateRedisConnection()
        {
            var configurationOptions = new ConfigurationOptions
            {
                SyncTimeout = 30000,
                EndPoints = { "localhost:6379" }
            };

            NotLazyConnection = ConnectionMultiplexer.Connect(configurationOptions);
        }

        public static IDatabase NoLazyRedisCache => NotLazyConnection.GetDatabase();

I have been receiving the following timeout exceptions, but in both instances, I can't see there being any/many busy threads that would cause this.

StackExchange.Redis.RedisTimeoutException: Timeout performing SADD (30000ms), next: SADD ConnectorData, inst: 0, qu: 0, qs: 2, aw: False, bw: Inactive, rs: ReadAsync, ws: Idle, in: 0, in-pipe: 0, out-pipe: 0, last-in: 1, cur-in: 0, sync-ops: 515, async-ops: 0, serverEndpoint: localhost:6379, conn-sec: 557.14, aoc: 1, mc: 1/1/0, mgr: 10 of 10 available, clientName: ASSET2326(SE.Redis-v2.7.4.20928), IOCP: (Busy=0,Free=1000,Min=20,Max=1000), WORKER: (Busy=1,Free=32766,Min=20,Max=32767), POOL: (Threads=3,QueuedItems=0,CompletedItems=2889,Timers=2), v: 2.7.4.20928 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts) at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server, T defaultValue) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 2108 at StackExchange.Redis.RedisDatabase.SetAdd(RedisKey key, RedisValue value, CommandFlags flags) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 1613 at ParagonConnect.Connector.ConnectorSocket.RedisFilterSet(String name, Object t) in D:\Git\RFiD-Discovery\Discovery_Connect\ParagonConnect.Connector\ConnectorSocket.cs:line 124 at ParagonConnect.Connector.ConnectorSocket.AddFilterData(List`1 assets) in D:\Git\RFiD-Discovery\Discovery_Connect\ParagonConnect.Connector\ConnectorSocket.cs:line 219 at ParagonConnect.Connector.ZebraSDKConnector.Connect() in D:\Git\RFiD-Discovery\Discovery_Connect\ParagonConnect.Connector\ZebraSDKConnector.cs:line 153

AND sometimes:

StackExchange.Redis.RedisTimeoutException: Timeout performing GET (30000ms), next: GET Connectors, inst: 0, qu: 0, qs: 1, aw: False, bw: Inactive, rs: ReadAsync, ws: Idle, in: 0, in-pipe: 0, out-pipe: 0, last-in: 1659, cur-in: 0, sync-ops: 988, async-ops: 0, serverEndpoint: localhost:6379, conn-sec: 1061.45, aoc: 1, mc: 1/1/0, mgr: 10 of 10 available, clientName: ASSET2326(SE.Redis-v2.7.4.20928), IOCP: (Busy=0,Free=1000,Min=20,Max=1000), WORKER: (Busy=1,Free=32766,Min=20,Max=32767), POOL: (Threads=2,QueuedItems=0,CompletedItems=4382,Timers=2), v: 2.7.4.20928 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts) at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server, T defaultValue) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 2108 at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server, T defaultValue) in /_/src/StackExchange.Redis/RedisBase.cs:line 62 at StackExchange.Redis.RedisDatabase.StringGet(RedisKey key, CommandFlags flags) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 2995 at ParagonConnect.Connector.ConnectorSocket.GetConnectorStop(Connector connector) in D:\Git\RFiD-Discovery\Discovery_Connect\ParagonConnect.Connector\ConnectorSocket.cs:line 44 at ParagonConnect.Connector.ConnectorEngine.ProcessConnector() in D:\Git\RFiD-Discovery\Discovery_Connect\ParagonConnect.Connector\ConnectorEngine.cs:line 68 at ParagonConnect.Connector.ConnectorEngine.RunEngine() in D:\Git\RFiD-Discovery\Discovery_Connect\ParagonConnect.Connector\ConnectorEngine.cs:line 53

I'm using Another Redis Desktop Manager to view my Redis DB in a GUI, according to that, the "Connectors" object that causes the second error is only 1.62KB, so it can't be payload size I think.

Any help, advice or areas to investigate is much appreciated.

Nav-Pandher commented 10 months ago

Update:

Increasing the SyncTimeout of the connection to 5 minutes has stopped all timeout issues from occurring after 24 hours of running the app.

Any idea on what could be causing the initial delay? Just so I have the information incase upping the SyncTimeout is just masking the issue.

Thanks

NickCraver commented 9 months ago

The command that follows is Connectors - what's the size of the current key though? If it possible that's much larger?