Fullgc引发redis超时异常
1、现象
-| 2019 - 11 - 14 11 : 50 : 01.095 |ERROR|TID: 2254.3964 . 15737033664569521 |DubboServerHandler- 192.168 . 58.20 : 10880 -thread- 317 |c.s.c.s.p.StoreSkuRpcServiceImpl.selectStoreSkuByOneId: 67 -查询店铺商品信息出错,skuId= 28190648 org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 6 second(s) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java: 70 ) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java: 41 ) at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java: 44 ) at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java: 42 ) at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java: 268 ) at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.convertLettuceAccessException(LettuceStringCommands.java: 799 ) at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java: 68 ) at org.springframework.data.redis.connection.DefaultedRedisConnection.get(DefaultedRedisConnection.java: 253 ) at sun.reflect.GeneratedMethodAccessor229.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 43 ) at java.lang.reflect.Method.invoke(Method.java: 498 ) at org.springframework.data.redis.core.CloseSuppressingInvocationHandler.invoke(CloseSuppressingInvocationHandler.java: 61 ) at com.sun.proxy.$Proxy188.get(Unknown Source) at com.xxx.chaos.server.common.redis.XxxRedisTemplate$ 11 .doInRedis(XxxRedisTemplate.java: 288 ) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java: 224 ) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java: 184 ) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java: 171 ) at com.xxx.chaos.server.common.redis.XxxRedisTemplate.get(XxxRedisTemplate.java: 285 ) at com.xxx.chaos.server.common.redis.XxxRedisTemplate.gets(XxxRedisTemplate.java: 308 ) at com.xxx.chaos.server.common.redis.XxxRedisTemplate.multiGet2Map(XxxRedisTemplate.java: 376 ) at com.xxx.chaos.server.service.impl.StoreSkuServiceImpl.selectStoreSkuBySkuId(StoreSkuServiceImpl.java: 47 ) at com.xxx.chaos.server.service.impl.StoreSkuServiceImpl$$FastClassBySpringCGLIB$$c1612837.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java: 218 ) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java: 749 ) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java: 163 ) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java: 93 ) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java: 186 ) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java: 688 ) at com.xxx.chaos.server.service.impl.StoreSkuServiceImpl$$EnhancerBySpringCGLIB$$d569daea.selectStoreSkuBySkuId(<generated>) at com.xxx.chaos.server.provider.StoreSkuRpcServiceImpl.selectStoreSkuByOneId(StoreSkuRpcServiceImpl.java: 62 ) at com.alibaba.dubbo.common.bytecode.Wrapper6.invokeMethod(Wrapper6.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$ 1 .doInvoke(JavassistProxyFactory.java: 47 ) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java: 76 ) at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java: 52 ) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java: 56 ) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java: 62 ) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.csp.sentinel.adapter.dubbo.SentinelDubboProviderFilter.invoke(SentinelDubboProviderFilter.java: 66 ) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke$original$b6dOrsVO(MonitorFilter.java: 75 ) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke$original$b6dOrsVO$accessor$6uvazkPi(MonitorFilter.java) at com.alibaba.dubbo.monitor.support.MonitorFilter$auxiliary$BaEkbyx9.call(Unknown Source) at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java: 93 ) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java: 42 ) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java: 78 ) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java: 72 ) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java: 131 ) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java: 38 ) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java: 38 ) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$ 1 .invoke(ProtocolFilterWrapper.java: 72 ) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$ 1 .reply(DubboProtocol.java: 103 ) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java: 96 ) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java: 172 ) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java: 51 ) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java: 80 ) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java: 1142 ) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java: 617 ) at java.lang.Thread.run(Thread.java: 748 ) Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 6 second(s) at io.lettuce.core.ExceptionFactory.createTimeoutException(ExceptionFactory.java: 51 ) at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java: 114 ) at io.lettuce.core.cluster.ClusterFutureSyncInvocationHandler.handleInvocation(ClusterFutureSyncInvocationHandler.java: 123 ) at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java: 80 ) at com.sun.proxy.$Proxy187.get(Unknown Source) at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java: 66 ) ... 58 common frames omitted |
2、通过 falcon、及grafana监控,发现应用与redis系统资源压力正常
3、由于间歇出现,然后查看GC 情况
应用FullGC了且时间持续12.8s,时间点也刚好与报警异常时间对上,基本确认 FullGC原因引起
4、由于多环境混合部署(阿里云docker+IDC),然后查看了一下 docker 节点应用情况
查看发现 IDC 与 docker 节点的 GC 差异较大,docker节点对应gc时间都在>100ms,而 idc基本都< 100ms,
(1)请假了秋伟大神,sudo /usr/local/jdk1.8.0_131/bin/jstack pid | grep 'Paralle'
idc 结果为2,而 docker 里为96个,恰巧 docker 宿主机的cpu 配置未96,难道应用拿到的是宿主机的 cpu 核数?
(2)然后验证了一下 dubbo io线程sudo /usr/local/jdk1.8.0_131/bin/jstack 7004 | grep 'New I/O server worker',IDC 为3,docker 里为37,基本确认应该是这个引起的差异;
(3)于是配置了-XX:ParallelGCThreads=2 -XX:ConcGCThreads=2 上线后,容器的 gc线程数据与 idc 一致,且时间也缩短了。到此基本确定差异原因就是docker 节点获取的是宿主机资源导致,
(4)请教运维雍志后给出终极方案:
(5)其实这个问题一早las遇到过(项目基于 openresty 里面有 nginx 配置文件),其中worker_processes auto导致 openresty nginx woker 起了96个,这在4C8G 的 docker 节点上运行性能很差,后来运维部署用模板替换掉了 auto 配置项
5、总结
https://www.robberphex.com/java-and-docker-memory-and-cpu-limits/
Fullgc引发redis超时异常的更多相关文章
- redis 超时失效key 的监听触发使用
redis自2.8.0之后版本提供Keyspace Notifications功能,允许客户订阅Pub / Sub频道,以便以某种方式接收影响Redis数据集的事件. 可能收到的事件的例子如下: 所有 ...
- redis超时问题分析
redis超时问题分析 06/04. 2014 Redis在分布式应用中占据着越来越重要的地位,短短的几万行代码,实现了一个高性能的数据存储服务.最近dump中心的cm8集群出现过 几次redis超时 ...
- StackExchange.Redis超时的问题
最近公司有个项目,在请求量大的情况下,有大量的错误日志是关于redis超时的问题: Timeout performing SET XXX, inst: 27, mgr: ProcessReadQueu ...
- python中自定义超时异常的几种方法
最近在项目中调用第三方接口时候,经常会出现请求超时的情况,或者参数的问题导致调用异代码异常.针对超时异常,查询了python 相关文档,没有并发现完善的包来根据用户自定义的时间来抛出超时异常的模块.所 ...
- Python urllib2 设置超时时间并处理超时异常
可以使用 except: 捕获任何异常,包括 SystemExit 和 KeyboardInterupt,不过这样不便于程序的调试和使用 最简单的情况是捕获 urllib2.URLError try: ...
- Redis发生异常WRONGTYPE Operation against a key holding the wrong kind of value
Redis发生异常WRONGTYPE Operation against a key holding the wrong kind of value Redis发生异常WRONGTYPE Operat ...
- 一场由fork引发的超时,让我们重新探讨了Redis的抖动问题
摘要:一次由fork引发的时延抖动问题. 背景介绍 华为云数据库GaussDB(for Redis) 是一款基于计算存储分离架构,兼容Redis生态的云原生NoSQL数据库:它依靠共享存储池实现了强一 ...
- Springboot2.x集成lettuce连接redis集群报超时异常Command timed out after 6 second(s)
文/朱季谦 背景:最近在对一新开发Springboot系统做压测,发现刚开始压测时,可以正常对redis集群进行数据存取,但是暂停几分钟后,接着继续用jmeter进行压测时,发现redis就开始突然疯 ...
- 双十一问题:在洪峰数据来临的瞬间,redis出现连接超时异常
如图所示,在大数据量来袭时,部署服务的机器中存在一台机器突然出现该报错,并且一直持续下去,直到洪峰数据结束也未恢复,重启机器后该问题解决 原因分析: 在请求redis过多时,因为未及时的释放掉redi ...
随机推荐
- sql注入搞事情(连载二)
sql注入(连载二)安信华web弱点测试系统注入 好多人问我sql怎么学习,我一下也说不出来.我就在此做统一的解答: sql语句分为两种,不管怎么用还是怎么学习主要是要理解SQL语句的基本概念,框架, ...
- 【转】tar命令详解
原文:http://www.cnblogs.com/qq78292959/archive/2011/07/06/2099427.html tar -c: 建立压缩档案-x:解压-t:查看内容-r:向压 ...
- IPC之shm.c源码解读
// SPDX-License-Identifier: GPL-2.0 /* * linux/ipc/shm.c * Copyright (C) 1992, 1993 Krishna Balasubr ...
- Activity的跳转及返回值 的四种方法
Activity生命周期 从创建到销毁的生命周期: onCreate()→onStart()→onResume()→onPouse()→onStop()→onDestroy() 从起动到后台再到前台: ...
- 下载好的vue项目如何在自己电脑环境上运行,步骤!!
本文链接:https://blog.csdn.net/qq_39309900/article/details/84837659首先第一步,需要安装node.js 下载地址:https://nodejs ...
- python读取txt文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x8e in position 8: illegal multibyte sequence
python读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x8e in position 8: illegal multibyte ...
- Java常用类(一)Math类和Random类
一.Math类 Math类中有一些常用的数学函数,比较简单,不进行详细解释,仅举例说明: 1.绝对值和取整 import java.lang.Math; public class Mat { publ ...
- java.io.WinNTFileSystem
Unicode-aware FileSystem for Windows NT/2000. Since: 1.4 Author: Konstantin Kladko
- PHP swoole websocket协议上机指南
这一上机实验的开发环境用的是jetbrain公司的phpstorm 上级步骤如下: 创建websocket服务端 <?php $server = ); function onopen($serv ...
- Ubuntu下python开发环境搭建
配置语言 1) 依次点击设置--Region & Language--Manage Installed Languages --install/remove language--chinese ...