达到Azure Redis缓存的最大连接数 [英] Azure Redis Cache max connections reached

查看:231
本文介绍了达到Azure Redis缓存的最大连接数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Azure Redis缓存存储一些快速查找数据,并且该缓存由10个客户端应用程序读取/连接。所有应用程序都是用.NET 4.6编写的,其中包括ASP.NET MVC Web应用程序,Web API和少数每1秒运行一次的工作角色。所有客户端都使用StackExchange.Redis连接到缓存。但是,我得到了间歇性的超时,并且发现在Azure Portal中,最大连接数已达到1000(对于我的定价层)。由于我只有10个客户端应用程序,而这些应用程序都不是多线程的,那么如何创建与缓存的1000个连接?

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 this includes ASP.NET MVC Web application, Web API and few worker roles that run in every 1 second. All clients are using StackExchange.Redis for connecting to the Cache. However, I get intermittent timeouts and I have observed that in Azure Portal, max connections has reached 1000 (for my pricing tier). Since I have only 10 client applications and none of these are multithreaded, what could create the 1000 connections to the cache?

是否有可遵循的最佳实践?

Are there any best practices available which I can follow for the Cache clients?

推荐答案

这与以下问题非常相似:为什么与Azure Redis Cache的连接如此之高?

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. 在您的连接字符串中将abortConnect设置为false

  2. 创建一个单例connectionMultiplexer并重用它。这对于大多数情况而言已经足够。一些高级方案可能需要为每个应用程序创建多个connectionMultiplexer对象,但大多数情况下只需要一个即可。我建议遵循此处显示的编码模式: https://azure.microsoft.com/zh-cn/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/#connect -to-the-cache

  3. 让ConnectionMultiplexer句柄重新连接-除非您已经非常彻底地测试过代码,否则请不要自己做。我看到的大多数连接泄漏是因为人们正在重新创建connectionMultiplexer,但是无法处置旧的连接。在大多数情况下,最好只是让多路复用器进行重新连接。

这篇关于达到Azure Redis缓存的最大连接数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆