记一次tomcat启动慢的问题

相同的war包在本地启动大概在一分钟左右,现场测试环境里启动确需要八九分种,本地模拟未发现明显问题。查看现场发过来的日志

01-Jul-2020 09:37:05.340 INFO [localhost-startStop-1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' of type [class org.springframework.scheduling.annotation.SchedulingConfiguration$$EnhancerBySpringCGLIB$$fe80b2f4] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Jul-2020 09:45:28.266 INFO [localhost-startStop-1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'dataSource' of type [class com.alibaba.druid.pool.DruidDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Jul-2020 09:45:28.279 INFO [localhost-startStop-1] org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties Loading properties file from URL [file:/home/cloudwalk/apache-tomcat-8.5.46/webapps/ibis/WEB-INF/classes/spring/init-config.properties]

这里我们明显看到spring容器加载dataSource的时候耗费了8分多钟,感觉问题出在这块,然后本地直接使用spring容器加载bean,因为连接池这里使用的是druid的连接池:

所以我在源码的dataSource的init方法里面加上了断点。代码的大概意思是不断地创建连接,直到线程池里面的连接数和初始化的连接数一样大。

发现本地也会在创建连接池的时候卡顿一下,耗时在3s,见志

02-Jul-2020 18:53:46.650 ÐÅÏ¢ [localhost-startStop-1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' of type [class org.springframework.scheduling.annotation.SchedulingConfiguration$$EnhancerBySpringCGLIB$$b1ccae49] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
02-Jul-2020 18:53:49.140 ÐÅÏ¢ [localhost-startStop-1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'dataSource' of type [class com.alibaba.druid.pool.DruidDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
02-Jul-2020 18:53:49.145 ÐÅÏ¢ [localhost-startStop-1] org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties Loading properties file from URL [file:/E:/apache-tomcat-8.5.35/webapps/ibis/WEB-INF/classes/spring/init-config.properties]

猜测可能现场这里连接比较慢,让现场把initialSize 这个参数改小一点==发现tomcat启动速度明显提升。大家设定初始化连接池的时候记得不要设置的太大。

问题终于得到了解决==

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值