Azure Redis Cache max connections reached

前端 未结 1 1052
天命终不由人
天命终不由人 2021-02-10 11:33

I am using Azure Redis Cache for storing some quick lookup data and this Cache is read/connected by 10 client applications. All the applications are written in .NET 4.6, and thi

1条回答
  •  情深已故
    2021-02-10 11:41

    This is very similar to this question: Why are connections to Azure Redis Cache so high?

    Here are the best practices we recommend for most customers:

    1. set abortConnect to false in your connection string
    2. create a singleton connectionMultiplexer and reuse it. This is sufficient for most scenarios. Some advanced scenarios may require creating multiple connectionMultiplexer objects per application, but most are fine with just one. I would recommend following the coding pattern shown here: https://azure.microsoft.com/en-us/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/#connect-to-the-cache
    3. Let the ConnectionMultiplexer handle reconnecting - don't do it yourself unless you have tested your code very thoroughly. Most connection leaks I have seen are because people are re-creating the connectionMultiplexer but fail to dispose the old one. In most cases, it is best to just let the multiplexer do the reconnecting.

    0 讨论(0)
提交回复
热议问题