Redis “max number of clients reached“的分析过程
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Redis “max number of clients reached“的分析过程,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1419字,纯文字阅读大概需要3分钟。
内容图文
![Redis “max number of clients reached“的分析过程](/upload/InfoBanner/zyjiaocheng/861/165e62d03b1d44819d2a6b7e5967802a.jpg)
问题描述
生产环境上突然出现数据中断的情况,分析日志发现应用连接Redis出现“max number of clients reached”的异常。那么问题很明显了,某个应用将Redis的连接占满了。
分析方法
- 第一步,先分析Redis.conf文件,确认配置的连接数为多少,我们系统采用的默认值10000。
################################### CLIENTS ####################################
# Set the max number of connected clients at the same time. By default
# this limit is set to 10000 clients, however if the Redis server is not
# able to configure the process file limit to allow for the specified limit
# the max number of allowed clients is set to the current file limit
# minus 32 (as Redis reserves a few file descriptors for internal uses).
#
# Once the limit is reached Redis will close all the new connections sending
# an error 'max number of clients reached'.
#
# maxclients 10000
- 第二步,根据业务场景分析,系统的并发数远远小于10000,因此初步判断是某应用在使用连接后未及时释放导致。通过下列命令来分析目前连接的情况:
redis-cli -p 6379 -axxxx client list |wc -l
发现连接数已经几乎占满,因此进一步分析是通过连接的IP分布情况来确定出问题的应用:
redis-cli -p 6379 -axxxx client list |awk '{print $2}'|awk -F '=' '{print $2}'|awk -F ':' '{print $1}'|sort | uniq -c
1 192.168.1.4
1733 192.168.1.55
848 192.168.1.66
919 192.168.1.77
1857 192.168.1.88
- 最终分析发现链接数占用多的都来自同一个服务,此应用在订阅消息后,针对每个分区的消息都创建了一个Redis连接池,导致连接数暴增。
内容总结
以上是互联网集市为您收集整理的Redis “max number of clients reached“的分析过程全部内容,希望文章能够帮你解决Redis “max number of clients reached“的分析过程所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。