Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

springboot启动缓慢,启动总耗时61s左右其中addMappedStatement耗时35s左右 #1154

Closed
alterhu2020 opened this issue May 21, 2019 · 13 comments

Comments

@alterhu2020
Copy link

alterhu2020 commented May 21, 2019

当前使用版本(必须填写清楚,否则不予处理)

版本号: 3.1.0

该问题是怎么引起的?(最新版上已修复的会直接close掉)

重现步骤

添加maven依赖后,启动springboot工程

报错信息

2019-05-21 10:01:03.796 [restartedMain] DEBUG org.mybatis.spring.SqlSessionFactoryBean.debug:49 - Parsed mapper file: 'file [D:\GitRepository\yitieyilu.com\ROOT\YanZhiServices\vrpanoapp\target\classes\mapper\generator\WxUserMapper.xml]'
2019-05-21 10:01:10.424 [restartedMain] DEBUG com.baomidou.mybatisplus.core.MybatisConfiguration.addMappedStatement:85 - addMappedStatement: com.yanzhi.vrpanoapp.mapper.generator.SysUserRegistrationCodeMapper.insert

2019-05-21 10:01:10.673 [restartedMain] DEBUG com.baomidou.mybatisplus.core.MybatisConfiguration.addMappedStatement:85 - addMappedStatement: com.yanzhi.vrpanoapp.mapper.generator.SysUserRegistrationCodeMapper.selectPage
2019-05-21 10:01:30.362 [restartedMain] WARN org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter.afterPropertiesSet:302 - Unable to create an RSA verifier from verifierKey (ignoreable if using MAC)
2019-05-21 10:01:31.268 [restartedMain] DEBUG springfox.documentation.spring.web.PropertySourcedRequestMappingHandlerMapping.initHandlerMethods:54 - initialising the handler methods

2019-05-21 10:01:36.515 [restartedMain] DEBUG com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration.afterPropertiesSet:263 - No org.mybatis.spring.mapper.MapperFactoryBean found.
2019-05-21 10:01:42.428 [restartedMain] DEBUG reactor.core.publisher.Hooks.debug:249 - Enabling stacktrace debugging via onOperatorDebug

你会发现在 2019-05-21 10:01:03.796耗时7s左右,2019-05-21 10:01:10.673时间的时候,addMappedStatement耗时20s左右,在2019-05-21 10:01:36.515 总耗时6s左右,这些是最耗时的一些执行锻,还不包含其他的mybatis-plus运行时间, 项目启动总耗时是61s左右,而mybatis总耗时35秒左右。。。。

这个加入mybatis-plus后,项目整体启动拖慢了将近一倍。。。
不知道有没有人有遇到这个问题。

@miemieYaho
Copy link
Member

你用 mp 和mybatis比?MappedStatement数量都不一样,你该换电脑了

@yrain
Copy link

yrain commented Jul 1, 2020

确实是很慢.请作者还是重视这个问题
ps:不是电脑配置差.

@Pengap
Copy link

Pengap commented Jul 7, 2020

同样有所感觉,启动慢,目前版本3.3.2

@R-anybbo
Copy link

是特别的慢, 我启动总共30s+, mp总共用了16s 用的版本也是 3.3.2

@xbox1994
Copy link

我也碰到了,非常明显的问题,作者就是个废物还死嘴硬

@easy-wly
Copy link

同问,该如何解决启动慢的问题,用的版本是3.4.3.4

@w-tomato
Copy link

w-tomato commented May 9, 2022

确实特别慢,还回复个换电脑,我换太湖之光都拯救不了你这玩意,嘴真硬

@mark4z
Copy link

mark4z commented Sep 16, 2022

确实慢,改天我瞅瞅能不能修一下

@yungsem
Copy link

yungsem commented Oct 9, 2022

非常慢,为什么close了,解决了吗

@qmdx
Copy link
Member

qmdx commented Oct 10, 2022

非常慢,为什么close了,解决了吗

mp 是启动的时候注入的 SQL 如果表非常多会存在慢的情况

@isaacwu666
Copy link

启动了一个数据中心 用了249.867秒。谢谢啊

@ningmengwork
Copy link

3.3.2 是有bug吧?怎么启动这么慢,一直在 addMappedStatement

@zongrenzhou
Copy link

zongrenzhou commented Sep 30, 2023

启动时mybatis-plus很慢,是因为卡在创建
com.baomidou.mybatisplus.core.toolkit.Sequence 这个类的构造方法里面
最终定位在这两个方法上面。
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
String name = ManagementFactory.getRuntimeMXBean().getName();
都是获取网络名称,原因是host名字配置不一样,导致没法用缓存。

scutil --set HostName $(scutil --get LocalHostName)
设置成一样就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests