Apache Tomcat 7带来了Eclipse的慢启动速度

时间:2014-01-20 11:00:33

标签: eclipse tomcat

我使用Tomcat 6 servlet容器来部署我的Web应用程序。现在Tomcat 7已经非常成熟,我们正在考虑迁移到它,但问题是我们将它嵌入到Eclipse中需要很长时间才能启动。我已经研究了一段时间并找到similar questions,但他们的解决方案并不适合我。

我刚刚做了一个小测试,用一个小应用程序(JSF和EL库)来看它的性能。 Tomcat 6带来了更好的结果:

Tomcat 6 Start -> 1954 ms
Tomcat 7 Start -> 3394 ms
Tomcat 7 Start (metadata-complete=true) -> 3282 ms

Tomcat 6 Debug -> 1981 ms
Tomcat 7 Debug -> 4060 ms
Tomcat 7 Debug (metadata-complete=true) -> 4053 ms

请注意,此测试是使用每个分支(6.0.37和7.0.50)中的 Eclipse kepler 最新Tomcat版本完成的。此外,我还考虑了每次测试的第二次尝试的结果,因为第一次测试可能与部署需求,内部配置更改等无关。

这也是我的部署配置文件的标题:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

我没有改变Tomcat的默认配置,它们的默认配置。考虑到Tomcat 7需要2-3秒才能开始使用这个小应用程序。在中等规模的部署中,开始时间可能会增加大约15-20秒,这对我们来说是不可接受的。

这里有初始化日志:

Tomcat 6.0.37

ene 20, 2014 12:04:05 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Cargada la biblioteca nativa APR de Apache Tomcat 1.1.29 con la versión APR 1.4.8.
ene 20, 2014 12:04:05 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Capacidades APR: IPv6 [true], enviar fichero [true], aceptar filtros [false], aleatorio [true].
ene 20, 2014 12:04:05 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:basic-jsf' did not find a matching property.
ene 20, 2014 12:04:06 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL inicializado correctamente con versión OpenSSL 1.0.1e 11 Feb 2013
ene 20, 2014 12:04:06 PM org.apache.coyote.http11.Http11AprProtocol init
INFO: Inicializando Coyote HTTP/1.1 en puerto http-8080
ene 20, 2014 12:04:06 PM org.apache.coyote.ajp.AjpAprProtocol init
INFO: Inicializando Coyote AJP/1.3 en ajp-8009
ene 20, 2014 12:04:06 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1420 ms
ene 20, 2014 12:04:06 PM org.apache.catalina.core.StandardService start
INFO: Arrancando servicio Catalina
ene 20, 2014 12:04:06 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
ene 20, 2014 12:04:06 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\amaeztu\test-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\basic-jsf\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
ene 20, 2014 12:04:06 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Inicializando Mojarra 2.1.27 ( 20140108-1632 https://svn.java.net/svn/mojarra~svn/tags/2.1.27@12764) para el contexto '/basic-jsf'
ene 20, 2014 12:04:08 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 4.0
ene 20, 2014 12:04:08 PM org.omnifaces.VersionLoggerEventListener processEvent
INFO: Using OmniFaces version 1.6.2
ene 20, 2014 12:04:08 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFO: Monitoring jndi:/localhost/basic-jsf/WEB-INF/faces-config.xml for modifications
ene 20, 2014 12:04:08 PM com.sun.faces.lifecycle.ELResolverInitPhaseListener populateFacesELResolverForJsp
INFO: JSF1027: [null] los ELResolvers para JSF no se han registrado con el contenedor JSP.
Initing Bean1
Initing Bean2
Bean1 - Hello!
Initing Bean1
Cleaning Bean1
ene 20, 2014 12:04:08 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Arrancando Coyote HTTP/1.1 en puerto http-8080
ene 20, 2014 12:04:08 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Arrancando Coyote AJP/1.3 en ajp-8009
ene 20, 2014 12:04:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1969 ms

Tomcat 7.0.50

ene 20, 2014 12:04:33 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Cargada la biblioteca nativa APR de Apache Tomcat 1.1.29 con la versión APR 1.4.8.
ene 20, 2014 12:04:33 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Capacidades APR: IPv6 [true], enviar fichero [true], aceptar filtros [false], aleatorio [true].
ene 20, 2014 12:04:33 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:basic-jsf' did not find a matching property.
ene 20, 2014 12:04:34 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL inicializado correctamente (OpenSSL 1.0.1e 11 Feb 2013)
ene 20, 2014 12:04:35 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
ene 20, 2014 12:04:35 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
ene 20, 2014 12:04:35 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1516 ms
ene 20, 2014 12:04:35 PM org.apache.catalina.core.StandardService startInternal
INFO: Arrancando servicio Catalina
ene 20, 2014 12:04:35 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.50
ene 20, 2014 12:04:35 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\amaeztu\test-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\basic-jsf\WEB-INF\lib\el-api-2.2.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
ene 20, 2014 12:04:35 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\amaeztu\test-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\basic-jsf\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
ene 20, 2014 12:04:37 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Inicializando Mojarra 2.1.27 ( 20140108-1632 https://svn.java.net/svn/mojarra~svn/tags/2.1.27@12764) para el contexto '/basic-jsf'
ene 20, 2014 12:04:37 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: hay presentes anotaciones PostConstruct/PreDestroy.  Los métodos de beans administrados marcados con estas anotaciones procesarán dichas anotaciones.
ene 20, 2014 12:04:38 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 4.0
ene 20, 2014 12:04:38 PM org.omnifaces.VersionLoggerEventListener processEvent
INFO: Using OmniFaces version 1.6.2
ene 20, 2014 12:04:38 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFO: Monitoring jndi:/localhost/basic-jsf/WEB-INF/faces-config.xml for modifications
ene 20, 2014 12:04:38 PM com.sun.faces.lifecycle.ELResolverInitPhaseListener populateFacesELResolverForJsp
INFO: JSF1027: [null] los ELResolvers para JSF no se han registrado con el contenedor JSP.
Initing Bean1
Initing Bean2
Bean1 - Hello!
ene 20, 2014 12:04:38 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
ene 20, 2014 12:04:38 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
ene 20, 2014 12:04:38 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3435 ms

Tomcat 7.0.50(metadata-complete =&#34; true&#34;)

ene 20, 2014 12:07:50 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Cargada la biblioteca nativa APR de Apache Tomcat 1.1.29 con la versión APR 1.4.8.
ene 20, 2014 12:07:50 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Capacidades APR: IPv6 [true], enviar fichero [true], aceptar filtros [false], aleatorio [true].
ene 20, 2014 12:07:50 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:basic-jsf' did not find a matching property.
ene 20, 2014 12:07:52 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL inicializado correctamente (OpenSSL 1.0.1e 11 Feb 2013)
ene 20, 2014 12:07:52 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
ene 20, 2014 12:07:52 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
ene 20, 2014 12:07:52 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1562 ms
ene 20, 2014 12:07:52 PM org.apache.catalina.core.StandardService startInternal
INFO: Arrancando servicio Catalina
ene 20, 2014 12:07:52 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.50
ene 20, 2014 12:07:52 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\amaeztu\test-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\basic-jsf\WEB-INF\lib\el-api-2.2.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
ene 20, 2014 12:07:52 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\amaeztu\test-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\basic-jsf\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
ene 20, 2014 12:07:54 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Inicializando Mojarra 2.1.27 ( 20140108-1632 https://svn.java.net/svn/mojarra~svn/tags/2.1.27@12764) para el contexto '/basic-jsf'
ene 20, 2014 12:07:54 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: hay presentes anotaciones PostConstruct/PreDestroy.  Los métodos de beans administrados marcados con estas anotaciones procesarán dichas anotaciones.
ene 20, 2014 12:07:55 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 4.0
ene 20, 2014 12:07:55 PM org.omnifaces.VersionLoggerEventListener processEvent
INFO: Using OmniFaces version 1.6.2
ene 20, 2014 12:07:55 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFO: Monitoring jndi:/localhost/basic-jsf/WEB-INF/faces-config.xml for modifications
ene 20, 2014 12:07:55 PM com.sun.faces.lifecycle.ELResolverInitPhaseListener populateFacesELResolverForJsp
INFO: JSF1027: [null] los ELResolvers para JSF no se han registrado con el contenedor JSP.
Initing Bean1
Initing Bean2
Bean1 - Hello!
Initing Bean1
Cleaning Bean1
ene 20, 2014 12:07:55 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
ene 20, 2014 12:07:55 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
ene 20, 2014 12:07:55 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3316 ms

我在日志中注意到的唯一区别是Tomcat 6只扫描一个jar文件而7个扫描两个。添加 metadata-complete =&#34; true&#34; 似乎没有任何区别。有没有人有类似的问题?

0 个答案:

没有答案