'Connections to Azure Redis Cache are high
I am using StackOverflow Redis on the Azure with the version 3.2.7 and I see the same issue of high counts of Clients Connections mentioned in below URLs. Is there any way to pass some params while connecting to Redis from client to ensure the connection should be closed automatically after certain idle time? OR Azure Redis itself should automatically close the same after seeing the idle property of the client?
I have already followed the best practices mentioned in the following blogs, but still, no luck in reducing the connections count. Why are connections to Azure Redis Cache so high? Azure Redis Cache max connections reached https://gist.github.com/JonCole/925630df72be1351b21440625ff2671f
I came across this https://pranavprakash.net/2016/02/05/kill-idle-connections-to-redis/ article to kill them in bulk for idle one. Was looking for some properties or settings which will help us to do it automatically. Seems I am still missing something.
Thanks in advance Gangadhar
Solution 1:[1]
Implement IDisposable to dispose the object after its use
public void Dispose()
{
try {
if (connection.IsValueCreated)
{
connection.Value.Dispose();
}
} catch { }
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sanju Kushwaha |