The scanning can be improved.
Here's my results (with debug logging turned on)

2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
in 74ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/apache/taglibs/taglibs-standard-impl/1.2.1/taglibs-standard-impl-1.2.1.jar
in 92ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/Code/git/jetty-slow-startup/target/classes/ in 29ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.5/jackson-annotations-2.4.5.jar
in 66ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar in
188ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
in 13ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.5/jackson-databind-2.4.5.jar
in 384ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.5/jackson-core-2.4.5.jar
in 92ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/security/spring-security-taglibs/3.2.7.RELEASE/spring-security-taglibs-3.2.7.RELEASE.jar
in 20ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/security/spring-security-acl/3.2.7.RELEASE/spring-security-acl-3.2.7.RELEASE.jar
in 68ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-jdbc/4.1.6.RELEASE/spring-jdbc-4.1.6.RELEASE.jar
in 205ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-tx/4.1.6.RELEASE/spring-tx-4.1.6.RELEASE.jar
in 147ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/security/spring-security-core/3.2.7.RELEASE/spring-security-core-3.2.7.RELEASE.jar
in 223ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-aop/4.1.6.RELEASE/spring-aop-4.1.6.RELEASE.jar
in 131ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-beans/4.1.6.RELEASE/spring-beans-4.1.6.RELEASE.jar
in 272ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-expression/4.1.6.RELEASE/spring-expression-4.1.6.RELEASE.jar
in 99ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/security/spring-security-web/3.2.7.RELEASE/spring-security-web-3.2.7.RELEASE.jar
in 149ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
in 4ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/security/spring-security-config/3.2.7.RELEASE/spring-security-config-3.2.7.RELEASE.jar
in 140ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-webmvc/4.1.6.RELEASE/spring-webmvc-4.1.6.RELEASE.jar
in 211ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-web/4.1.6.RELEASE/spring-web-4.1.6.RELEASE.jar
in 180ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-context/4.1.6.RELEASE/spring-context-4.1.6.RELEASE.jar
in 243ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/springframework/spring-core/4.1.6.RELEASE/spring-core-4.1.6.RELEASE.jar
in 188ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned
file:/Users/joakim/.m2/repository/org/webjars/extjs/5.1.0/extjs-5.1.0.jar
in 1981ms
2015-04-16 15:05:11.418:DBUG:oeja.AnnotationConfiguration:main: Scanned 2
container path jars, 21 WEB-INF/lib jars, 1 WEB-INF/classes dirs in 2321ms
for context 
o.e.j.m.p.JettyWebAppContext@57fbc06f{/backend,[file:/Users/joakim/Code/git/jetty-slow-startup/src/main/webapp/,
jar:file:/Users/joakim/.m2/repository/org/webjars/extjs/5.1.0/extjs-5.1.0.jar!/META-INF/resources],STARTING}{file:/Users/joakim/Code/git/jetty-slow-startup/src/main/webapp/}

This is on OSX, using Java 8u31.
The extjs-5.1.0.jar only took a scant 2 seconds to scan.
The scan ignored most (if not all) of that jar's contents anyway (no
*.class files).
Overall, the scan took 2321ms

The startup, on the other hand, took longer.   About 4 minutes.
The problem is likely somewhere else.  Not sure yet.
I haven't turned on the logging for the spring bytecode scanning yet to
know if that's where the time is going.
This environment has a mix of logging infrastructure (commons logging,
java.util.logging, jetty logging, log4j, slf4j, and logkit), setting it up
takes a bit of time (using slf4j to capture it all and route down to a
single logging impl).


--
Joakim Erdfelt <[email protected]>
webtide.com <http://www.webtide.com/> - intalio.com/jetty
Expert advice, services and support from from the Jetty & CometD experts
eclipse.org/jetty - cometd.org

On Thu, Apr 16, 2015 at 2:27 PM, Jesse McConnell <[email protected]>
wrote:

> I just wanted to chime in and say that this behavior is not something
> that Jetty is arbitrarily doing, it is mandated by the servlet
> specification.
> --
> jesse mcconnell
> [email protected]
>
>
> On Thu, Apr 16, 2015 at 3:33 PM, Petar Tahchiev <[email protected]>
> wrote:
> > Guys I have created a github repository that demonstrates the problem:
> >
> > https://github.com/paranoiabla/jetty-slow-startup
> >
> > Just run mvn clean install or mvn jetty:run and you see it hangs.
> >
> > I'd really appreciate some help here.
> >
> > 2015-04-16 22:48 GMT+03:00 Petar Tahchiev <[email protected]>:
> >>
> >> Hello all,
> >>
> >> I just found out what's happening - I have spring-web jar in my
> classpath,
> >> which has a non empty @HandlesTypes annotation so the annotation
> scanning is
> >> happening. My parent pom also includes ext-js webjar:
> >>
> >>         <!-- Javascript -->
> >>         <dependency>
> >>             <groupId>org.webjars</groupId>
> >>             <artifactId>extjs</artifactId>
> >>             <version>${extjs.webjars.version}</version>
> >>         </dependency>
> >>
> >>
> >> which (believe it or not) is almost 85MB. If I exclude this dependency
> >> from the pom.xml then jetty starts again for 8 seconds. If I leave it
> in the
> >> pom.xml then jetty starts for more than 15 minutes.
> >>
> >> Please let me know how can I exclude the extjs webjar from annotation
> >> scanning.
> >>
> >> Thanks
> >>
> >> 2015-04-16 15:16 GMT+03:00 Jan Bartel <[email protected]>:
> >>>
> >>> If any of your libs contain a servletcontainerinitializer that has a
> non
> >>> empty HandlesTypes annotation on it then scanning will be done any way.
> >>> Enable debug for org.eclipse.jetty.annotations and you'll see which
> one it
> >>> is.
> >>>
> >>> Jan
> >>>
> >>> On 16/04/2015 8:39 am, "Petar Tahchiev" <[email protected]> wrote:
> >>>>
> >>>> Hi there,
> >>>>
> >>>> I tried adding metadata-complete="true" and also
> >>>>
> >>>>     <Call name="setAttribute">
> >>>>
> >>>> <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
> >>>>         <Arg></Arg>
> >>>>     </Call>
> >>>>
> >>>> to my jetty-env.xml but had no effect - the same amount of time :(
> >>>>
> >>>> 2015-04-16 1:35 GMT+03:00 Simone Bordet <[email protected]>:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> On Wed, Apr 15, 2015 at 9:57 PM, Petar Tahchiev <
> [email protected]>
> >>>>> wrote:
> >>>>> > Hi,
> >>>>> >
> >>>>> > I tried 9.2.10.v20150310 and it takes more than 10 minutes!!!! With
> >>>>> > Java7
> >>>>> > and version 9.1.3.v20140225 it takes 8 seconds! I also think it's
> >>>>> > annotation
> >>>>> > scanning. Here's the threaddump:
> >>>>>
> >>>>> So it is annotation scanning.
> >>>>> Do you need it ?
> >>>>>
> >>>>> What's the value for "metadata-complete" attribute in your web.xml ?
> >>>>>
> >>>>> Read also:
> >>>>>
> https://www.eclipse.org/jetty/documentation/current/using-annotations.html
> >>>>>
> >>>>> --
> >>>>> Simone Bordet
> >>>>> ----
> >>>>> http://cometd.org
> >>>>> http://webtide.com
> >>>>> http://intalio.com
> >>>>> Developer advice, training, services and support
> >>>>> from the Jetty & CometD experts.
> >>>>> Intalio, the modern way to build business applications.
> >>>>> _______________________________________________
> >>>>> jetty-dev mailing list
> >>>>> [email protected]
> >>>>> To change your delivery options, retrieve your password, or
> unsubscribe
> >>>>> from this list, visit
> >>>>> https://dev.eclipse.org/mailman/listinfo/jetty-dev
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Regards, Petar!
> >>>> Karlovo, Bulgaria.
> >>>> ---
> >>>> Public PGP Key at:
> >>>>
> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
> >>>> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
> >>>>
> >>>> _______________________________________________
> >>>> jetty-dev mailing list
> >>>> [email protected]
> >>>> To change your delivery options, retrieve your password, or
> unsubscribe
> >>>> from this list, visit
> >>>> https://dev.eclipse.org/mailman/listinfo/jetty-dev
> >>>
> >>>
> >>> _______________________________________________
> >>> jetty-dev mailing list
> >>> [email protected]
> >>> To change your delivery options, retrieve your password, or unsubscribe
> >>> from this list, visit
> >>> https://dev.eclipse.org/mailman/listinfo/jetty-dev
> >>
> >>
> >>
> >>
> >> --
> >> Regards, Petar!
> >> Karlovo, Bulgaria.
> >> ---
> >> Public PGP Key at:
> >>
> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
> >> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
> >
> >
> >
> >
> > --
> > Regards, Petar!
> > Karlovo, Bulgaria.
> > ---
> > Public PGP Key at:
> >
> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
> > Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
> >
> > _______________________________________________
> > jetty-dev mailing list
> > [email protected]
> > To change your delivery options, retrieve your password, or unsubscribe
> from
> > this list, visit
> > https://dev.eclipse.org/mailman/listinfo/jetty-dev
> _______________________________________________
> jetty-dev mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-dev
>
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to