嵌入式Tomcat 7与Tomcat 6相比较慢 [英] Embedded Tomcat 7 slow compare to Tomcat 6

查看:135
本文介绍了嵌入式Tomcat 7与Tomcat 6相比较慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始将Tomcat 7嵌入到我的集成测试中,而不是Tomcat 6,因为我需要7个功能中的一些,它是我们的目标容器。与Tomcat 6嵌入式相比,性能非常慢。启动服务器大约需要20秒。这是我正在使用的代码:

I recently started embedding Tomcat 7 for my integration tests, rather than Tomcat 6 as I need some of the 7 features and it's our target container. Performance is very slow compared to Tomcat 6 embedded. It's taking in the order of 20 seconds to start the server. This is the code I am using:

Tomcat tomcat = new Tomcat();
tomcat.setPort(port);
tomcat.setSilent(true);

tomcat.setBaseDir(".");
tomcat.getHost().setAppBase(webappDir);

tomcat.addWebapp(context, "");    
tomcat.start();

有没有其他人经历过这个或获得改善绩效的建议?我在Windows 7,Linux Mint和Ubuntu上运行测试。

Has anyone else experienced this or got suggestions for improving performance? I am running tests on Windows 7, Linux Mint and Ubuntu.

推荐答案

由于基于注释的Servlet 3.0配置所需的类路径扫描,可能很慢。如果您不需要这些功能,请尝试将 metadata-complete =true添加到 web.xml

Perhaps it's slow due to classpath scanning which is required for annotation-based configuration of Servlet 3.0. If you don't need these features, try to add metadata-complete="true" to your web.xml.

这篇关于嵌入式Tomcat 7与Tomcat 6相比较慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆