首页 > 数据库 >【Azure Redis 缓存】使用StackExchange.Redis,偶发ERROR - Timeout performing HSET (15000ms)

【Azure Redis 缓存】使用StackExchange.Redis,偶发ERROR - Timeout performing HSET (15000ms)

时间:2023-03-07 20:58:12浏览次数:53  
标签:performing 15000ms Min cache Redis Free Busy StackExchange

问题描述

使用StackExchange.Redis 作为Redis客户端SDK,连接Azure Redis服务,长期运行后发现,每天都偶发 Timeout Error。

错误消息如下:

 

  • StackExchange.Redis.RedisTimeoutException: Timeout performing HGETALL (15000ms), next: HGETALL new_town, inst: 0, qu: 0, qs: 17, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: xxxxxxxx.redis.cache.chinacloudapi.cn:6380, mc: 1/1/0, mgr: 10 of 10 available, clientName: xxxxxxxxxxxx, IOCP: (Busy=0,Free=1000,Min=2,Max=1000), WORKER: (Busy=17,Free=8174,Min=2,Max=8191), v: 2.1.30.38891 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)

 

  •  ERROR log - Timeout performing HSET (15000ms), next: HGET token, inst: 1, qu: 0, qs: 35, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: xxxxxxxx.redis.cache.chinacloudapi.cn:6380, mc: 1/1/0, mgr: 10 of 10 available, clientName: xxxxxxxxxxxx, IOCP: (Busy=0,Free=1000,Min=50,Max=1000), WORKER: (Busy=29,Free=8162,Min=100,Max=8191), v: 2.1.30.38891 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)

 

  •  ERROR log - Timeout performing EXPIRE (15000ms), next: HGET token, inst: 0, qu: 0, qs: 35, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: xxxxxxxx.redis.cache.chinacloudapi.cn:6380, mc: 1/1/0, mgr: 10 of 10 available, clientName: xxxxxxxxxxxx, IOCP: (Busy=0,Free=1000,Min=50,Max=1000), WORKER: (Busy=29,Free=8162,Min=100,Max=8191), v: 2.1.30.38891 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)

 

排查方向

在第一个错误中,可以发现 WORKER 的Busy 数量 远大于 Min 数量 WORKER: (Busy=17,Free=8174,Min=2,Max=8191),,所以可以通过设置Worker/IOCP的线程数来解决这个问题。详细的说明见文档:https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-management-faq#recommendation

 

而之后继续出现Timeout 问题,这需要从如下几个方面优化:

1)查看慢指令(slowlogs) : 

there are slowlogs like HGET, HGETALL, HSCAN on this cache. Some commands are more expensive than others to execute, depending on their complexity. Because Redis is a single-threaded server side system, the time needed to run some more time expensive commands may cause some latency or timeouts on client side, as server can be busy dealing with these expensive commands.
Please refer Troubleshoot Azure Cache for Redis latency and timeouts | Microsoft Learn

 

2)查看客户端CPU及网络带宽

Check client host CPU or Network bandwidth. Please refer https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-troubleshoot-timeouts#high-cpu-on-client-hosts

 

3)查看大键值(bigkeys)

  • Optimize your application for a large number of small values, rather than a few large values.
  • The preferred solution is to break up your data into related smaller values.

Please refer: https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-troubleshoot-timeouts#large-key-value

 

4)升级Azure Redis到更高的定价层

5)Additional suggestion:
The memory reservations are not configured properly: Maxmemory-reserved and Maxfragmentationmemory-reserved have only set 50 MB each. Recommend to update the maxmemory-reserved and maxfragmentationmemory-reserved [atleast equal to 10% of the cache size].
For more details refer : Best practices for memory management - Azure Cache for Redis | Microsoft Learn

 

标签:performing,15000ms,Min,cache,Redis,Free,Busy,StackExchange
From: https://www.cnblogs.com/lulight/p/17189607.html

相关文章

  • 缓存数据库redis 及各种value数据类型的使用
    Redis介绍与安装redis:缓存数据库(大部分时间做缓存,不仅仅可以做缓存),非关系型数据库【区别与mysql关系型数据库】nosql:非关系型数据库c语言写的服务(监听端口)......
  • 路飞-day8——前端登陆注册页面、redis介绍与安装、redis普通连接与连接池、redis之字
    目录一、前端登录注册页面1.1分析1.2登陆组件多方式登录短信登录1.3注册组件1.4代码展示Login.vueRegister.vueHeader.vue二、Redis介绍与安装三、Redis普通连接和连接池5.......
  • Redis 的16种妙用方法
    1、缓存String类型例如:热点数据缓存(例如报表、明星出轨),对象缓存、全页缓存、可以提升热点数据的访问数据。2、数据共享分布式String类型,因为Redis是分布式的独立服......
  • redis缓存数据库
    redis缓存数据库redis介绍与安装缓存数据库,非关系型数据库(nosql),由c语言写的服务端用于在内存中存取数据(读取速度快)速度快的原因有纯内存操作网络模型使用的IO多......
  • Redis的介绍安装以及启动与使用还有五大数据类型
    目录一、介绍Redis1.详细介绍2.介绍总结二、安装启动以及运行Redis1.Redis的安装步骤2.Redis的启动方法3.图形化界面使用Redis4.pycharm使用Redis三、redis五大数据类......
  • Redis
    目录Redis介绍与安装官网下载安装启动redis存储方式图形化客户端操作下载图形化工具连接redis服务器python连接redis下载模块导入模块链接池链接单例模式多线程链接池链接R......
  • redis 基础1(包含介绍,安装)
    Redis介绍安装#关于redis-1.redis是一个缓存型数据库【大部分时间做缓存,但是不仅仅可以做缓存】-2.redis是一个非关系型(nosql)数据库【区别于mysql】-3......
  • Ubuntu 通过 docker 运行 redis
    1、首先拉取redis的镜像dockerpullredis2、运行redis容器dockerrun--nameredis-p6379:6379-dredis--nameredis#容器实例的名称-p6......
  • 1 登录页面分析 2 登录页面 3 注册页面 4 Redis介绍与安装 5 Redis普通连接和连接池 6
    目录1登录页面分析1.1Login.vueHeader.vue2登录页面2.1Login.vue3注册页面Register.vueHeader.vue4Redis介绍与安装5Redis普通连接和连接池5.1普通连接5.2连接池......
  • redis缓存雪崩、击穿、穿透
    用户的数据一般都是存储于数据库,数据库的数据是落在磁盘上的,磁盘的读写速度可以说是计算机里最慢的硬件了。当用户的请求,都访问数据库的话,请求数量一上来,数据库很容易就奔......