Spring 弹簧启动冻结约4秒
我正在使用SpringBoot运行RESTfulWebApp。它应该每秒处理1000个请求,但是我发现每处理100个请求,应用程序大约需要4秒钟才能返回答案。我使用的是Spring boot版本1.4.4.RELEASE。将探查器连接到JVM后,我注意到一个tomcat线程正在更新其缓存org.apache.catalina.webresources.cache,增加了缓存ttl,但在不同版本的Spring boot中我没有看到这个问题Spring 弹簧启动冻结约4秒,spring,performance,tomcat,spring-boot,Spring,Performance,Tomcat,Spring Boot,我正在使用SpringBoot运行RESTfulWebApp。它应该每秒处理1000个请求,但是我发现每处理100个请求,应用程序大约需要4秒钟才能返回答案。我使用的是Spring boot版本1.4.4.RELEASE。将探查器连接到JVM后,我注意到一个tomcat线程正在更新其缓存org.apache.catalina.webresources.cache,增加了缓存ttl,但在不同版本的Spring boot中我没有看到这个问题 @Bean public EmbeddedServletC
@Bean
public EmbeddedServletContainerFactory servletContainer() {
return new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
final int cacheSize = 40 * 1024; // 40 mb
final int ttl = 10 * 60 * 1000; // 10 min
StandardRoot standardRoot = new StandardRoot(context);
standardRoot.setCacheMaxSize(cacheSize);
standardRoot.setCacheTtl(ttl);
// try this if the jar locks
context.setResources(standardRoot);
StandardContext standardContext = (StandardContext) context;
standardContext.setAntiResourceLocking(true);
}
};
}
将Spring boot升级到1.5.8后,问题得到解决 是否有一些潜在资源已经饱和?IO/DB/其他什么?GC怎么样?没有。内存、磁盘、cpu等看起来还可以。