I am using StackExchange.Redis 1.2.6 on my client server to connect with redis server version 3.0.504 installed on a windows server. I face the below timeout exception in my client server causing inconsistency of the application.
My observations:
- There is no much CPU or Memory usage at the time of exception in my client server.
- I looked into the slowlog and I was not able to find any command at that time.
Below is my configuration and I maintain a single connection to redis throughout my application.
private static ConfigurationOptions GetRedisClusterConfiguration() {
ConfigurationOptions configuration = null;
try {
RedisConfigSection config = System.Configuration.ConfigurationManager.GetSection(RedisConfigSection.SECTION_NAME) as RedisConfigSection;
configuration = new ConfigurationOptions();
configuration.AbortOnConnectFail = false;
configuration.ConnectTimeout = 15000;
configuration.ConfigCheckSeconds = 60;
configuration.AllowAdmin = true;
configuration.ConnectRetry = 5;
if (!string.IsNullOrEmpty(config.Servers.Password)) configuration.Password = config.Servers.Password;
foreach(var server in config.Servers) {
configuration.EndPoints.Add($ "{server.Host}:{server.Port}");
}
}
catch(Exception ex) {
log.Error(ex);
}
return configuration;
}
public static ConnectionMultiplexer Instance {
get {
if (instance == null) {
lock(safetyLock) {
if (instance == null) {
try {
ConfigurationOptions configuration = GetRedisClusterConfiguration();
StringWriter loginfo = new StringWriter();
instance = ConnectionMultiplexer.Connect(configuration, loginfo);
if (instance != null && !instance.IsConnected) log.Info(loginfo.ToString());
}
catch(Exception ex) {
log.Error(ex);
}
}
}
}
return instance;
}
}
Exception:
StackExchange.Redis.RedisTimeoutException: Timeout performing SETEX vuprodgenericgenevaservice_executormsg_geneva prod parallel, inst: 1, mgr: ExecuteSelect, err: never, queue: 3, qu: 0, qs: 3, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, clientName: xxxx, serverEndpoint: Unspecified/xxxx:6379, keyHashSlot: 3134, IOCP: (Busy=0,Free=1000,Min=8,Max=1000), WORKER: (Busy=78,Free=1969,Min=8,Max=2047) (Please take a look at this article for some common client-side issues that can cause timeouts: http://stackexchange.github.io/StackExchange.Redis/Timeouts)