(四) Redis连接的客户端(connected_clients)数过高或者不减的问题解决方案

最近的项目上使用ServiceStack.Redis上了Redis缓存,其中遇到了很多问题。。 比如说 某一天发现redis做的缓存竟然失效了,然后查了下日志  报错max number of clients reached, sPort: 0, LastCommand:   。。首先考虑的是是不是项目中redis使用完后没有dispose..结果查了半天没发现有哪里忘记dispose。。 之后觉得是redis服务端可能出了问题 重启了下,过了段时间查看redis状态  info指令。

 

可以看到connected_clients很高 。。多次监控后发现虽然有下降 但是还是在4000以上。

之后在用client list 指令 查看客户端连接情况

其中idle(以秒计算的空闲时长)竟然这么长时间。。很多空闲连接都没有被及时释放掉从而导致connected_clients非常高

查看redis的配置timeout (当客户端闲置多长时间后关闭连接,如果指定为0,表示关闭

然后设置timeout

再次查看connected_clients

瞬间就降下来了。。 至此问题解决!

请根据下述 Prometheus 采集得到的 redis 监控指标,给出 redis 集群建议的监控告警指标,并附上对应的告警表达式 redis_active_defrag_running、redis_allocator_active_bytesredis_allocator_allocated_bytes redis_allocator_frag_bytes redis_allocator_frag_ratio redis_allocator_resident_bytes redis_allocator_rss_bytes redis_allocator_rss_ratio redis_aof_base_size_bytes redis_aof_buffer_length redis_aof_current_rewrite_duration_sec redis_aof_current_size_bytes redis_aof_delayed_fsync redis_aof_enabled redis_aof_last_bgrewrite_status redis_aof_last_cow_size_bytes redis_aof_last_rewrite_duration_sec redis_aof_last_write_status redis_aof_pending_bio_fsync redis_aof_pending_rewrite redis_aof_rewrite_buffer_length redis_aof_rewrite_in_progress redis_aof_rewrite_scheduled redis_blocked_clients redis_client_recent_max_input_buffer_bytes redis_client_recent_max_output_buffer_bytes redis_cluster_connections redis_cluster_current_epoch redis_cluster_enabled redis_cluster_known_nodes redis_cluster_messages_received_total redis_cluster_messages_sent_total redis_cluster_my_epoch redis_cluster_size redis_cluster_slots_assigned redis_cluster_slots_fail redis_cluster_slots_ok redis_cluster_slots_pfail redis_cluster_state redis_cluster_stats_messages_auth_ack_sent redis_cluster_stats_messages_auth_req_received redis_cluster_stats_messages_fail_received redis_cluster_stats_messages_fail_sent redis_cluster_stats_messages_ping_received redis_cluster_stats_messages_ping_sent redis_cluster_stats_messages_pong_received redis_cluster_stats_messages_pong_sent redis_cluster_stats_messages_update_received redis_cluster_stats_messages_update_sent redis_commands_duration_seconds_total redis_commands_processed_total redis_commands_total redis_config_io_threads redis_config_maxclients redis_config_maxmemory redis_connected_clients redis_connected_slave_lag_seconds redis_connected_slave_offset_bytes redis_connected_slaves redis_connections_received_total redis_cpu_sys_children_seconds_total redis_cpu_sys_seconds_total redis_cpu_user_children_seconds_
最新发布
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值