I have .net core 1.1 based web application and using Amazon ElastiCache of Redis for cache management. I am using "StackExchange.Redis": "1.1.608" version for cache related work. Following is the code used to establish connection public class CacheManager { private static Lazy connection; private static object lockObject = new Object(); private readonly ILogger logger;
public CacheManager(IConfiguration config, ILoggerFactory loggerFactory)
{
this.logger = loggerFactory.CreateLogger<CacheManager>();
if (connection == null)
{
lock (lockObject)
{
if (connection == null)
{
connection = new Lazy<ConnectionMultiplexer>(() =>
{
return ConnectionMultiplexer.Connect(config["Cache:ConnectionString"]);
});
}
}
}
}
public static ConnectionMultiplexer Connection
{
get
{
try
{
return connection.Value;
}
catch (Exception e)
{
return null;
}
}
}}
The cache get method try to fetch using the key and if data not found it just fetches it from database and the set it.
We are getting frequent timeout error on redis on production, and not only that, it's causing client to become unresponsive, i.e., the website gives an IIS 500 error. There is nothing in log and redis logs are very simple:
Failed to get cahced value: Timeout performing GET , inst: 61, queue: 2, qu: 0, qs: 2, qc: 0, wr: 0, wq: 0, in: 207, ar: 0, clientName: (Please take a look at this article for some common client-side issues that can cause timeouts: https://github.com/StackExchange/StackExchange.Redis/tree/master/Docs/Timeouts.md)
Redis is hosted on a separate server instance. How can I get a better idea what is the root cause of this ?