Solr
  1. Solr
  2. SOLR-3309

Slow WAR startups due to annotation scaning (affects Jetty 8)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: None
    • Labels:
      None

      Description

      Need to modify web.xml to increase the speed of container startup time. The header also appears to need to be modified...

      http://mostlywheat.wordpress.com/2012/03/10/speeding-up-slow-jetty-8-startups/
      http://www.javabeat.net/articles/print.php?article_id=100

      Adding 'metadata-complete="true"' to our web.xml's web-app restored our startup time to 8 seconds.

      1. SOLR-3309.patch
        1.0 kB
        James Dyer
      2. SOLR-3309.patch
        1 kB
        Hoss Man

        Activity

        Bill Bell created issue -
        Hide
        Hoss Man added a comment -

        adding this to the web.xml means requiring a servlet container that supports servlets 2.5 (unless the container just ignores attributes it doesn't understand)

        but that seems fine for trunk - 2.5 came out in 2005, and we already compile and test against 3.0

        (updated summary & description to note this isn't jetty specific)

        Show
        Hoss Man added a comment - adding this to the web.xml means requiring a servlet container that supports servlets 2.5 (unless the container just ignores attributes it doesn't understand) but that seems fine for trunk - 2.5 came out in 2005, and we already compile and test against 3.0 (updated summary & description to note this isn't jetty specific)
        Hoss Man made changes -
        Field Original Value New Value
        Summary Slow Jetty 8 startups Slow WAR startups due to annotation scaning (affects Jetty 8)
        Fix Version/s 4.0 [ 12314992 ]
        Description Need to modify web.xml to increase the speed of Jetty 8 startups. The header also appears to need to be modified for solr.war.

        http://mostlywheat.wordpress.com/2012/03/10/speeding-up-slow-jetty-8-startups/

        Adding 'metadata-complete="true"' to our web.xml's web-app restored our startup time to 8 seconds.
        Need to modify web.xml to increase the speed of container startup time. The header also appears to need to be modified...

        http://mostlywheat.wordpress.com/2012/03/10/speeding-up-slow-jetty-8-startups/
        http://www.javabeat.net/articles/print.php?article_id=100

        Adding 'metadata-complete="true"' to our web.xml's web-app restored our startup time to 8 seconds.
        Hide
        Yonik Seeley added a comment -

        Can someone provide a specific patch for this one? Seems like we want this for 4.0

        Show
        Yonik Seeley added a comment - Can someone provide a specific patch for this one? Seems like we want this for 4.0
        Hide
        Hoss Man added a comment -

        web.xml patch.

        doing some testing now

        Show
        Hoss Man added a comment - web.xml patch. doing some testing now
        Hoss Man made changes -
        Attachment SOLR-3309.patch [ 12524895 ]
        Hoss Man made changes -
        Assignee Hoss Man [ hossman ]
        Hoss Man committed 1331529 (2 files)
        Reviews: none

        SOLR-3309: web.xml now specifies metadata-complete=true (which requires Servlet 2.5) to prevent servlet containers from scanning class annotations on startup

        Hide
        Hoss Man added a comment -

        Committed revision 1331529.

        verified no problems with our jetty8 example or when running in tomcat7

        Show
        Hoss Man added a comment - Committed revision 1331529. verified no problems with our jetty8 example or when running in tomcat7
        Hoss Man made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        James Dyer added a comment - - edited

        Jboss 5.1.0 won't start with the new <web-app /> declaration. This works, however:

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

        (changing "j2ee" to "javaee"). I do not know, however, if this is a problem with Jboss or if what we have in Trunk currently is incorrect ?

        Show
        James Dyer added a comment - - edited Jboss 5.1.0 won't start with the new <web-app /> declaration. This works, however: <web-app xmlns= "http: //java.sun.com/xml/ns/javaee" xmlns:xsi= "http: //www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http: //java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version= "2.5" metadata-complete= " true " > (changing "j2ee" to "javaee"). I do not know, however, if this is a problem with Jboss or if what we have in Trunk currently is incorrect ?
        Hide
        Hoss Man added a comment -

        James: Unless I'm missing something, the specifics of whether it's "j2ee" or "javaee" shouldn't matter to XML parser (or the servlet container). All that should matter is that each of the schemaLocation keys listed correspond to an xml namespace being used. (ie: you changed http://java.sun.com/xml/ns/j2ee -> http://java.sun.com/xml/ns/javaee in two places, but as long as those two places are the same it shouldn't matter what we use ... i think it could be "http://giberish-foo/uwesays" and it should still work).

        So it seems like maybe your jboss configuration has something wonky going on?

        I'm inclined to think we should be consistent with the examples in the 2.5 spec...

        http://download.oracle.com/otn-pub/jcp/servlet-2.5-mrel2-eval-oth-JSpec/servlet-2_5-mrel2-spec.pdf

        ...(see pages 153 & 154) which use j2ee – but oddly enough the example snippets embedded in the 2.5 XSD (using xsd:documentation tags) use "javaee"...

        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

        ...so apparently the spec and the xsd shipped with the spec are inconsistent? which i guess means feel free to change it to follow the examples in the XSD?

        Show
        Hoss Man added a comment - James: Unless I'm missing something, the specifics of whether it's "j2ee" or "javaee" shouldn't matter to XML parser (or the servlet container). All that should matter is that each of the schemaLocation keys listed correspond to an xml namespace being used. (ie: you changed http://java.sun.com/xml/ns/j2ee -> http://java.sun.com/xml/ns/javaee in two places, but as long as those two places are the same it shouldn't matter what we use ... i think it could be "http://giberish-foo/uwesays" and it should still work). So it seems like maybe your jboss configuration has something wonky going on? I'm inclined to think we should be consistent with the examples in the 2.5 spec... http://download.oracle.com/otn-pub/jcp/servlet-2.5-mrel2-eval-oth-JSpec/servlet-2_5-mrel2-spec.pdf ...(see pages 153 & 154) which use j2ee – but oddly enough the example snippets embedded in the 2.5 XSD (using xsd:documentation tags) use "javaee"... http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd ...so apparently the spec and the xsd shipped with the spec are inconsistent? which i guess means feel free to change it to follow the examples in the XSD?
        Hide
        James Dyer added a comment -

        ...so apparently the spec and the xsd shipped with the spec are inconsistent? which i guess means feel free to change it to follow the examples in the XSD?

        If I validate the change with Jetty8 & Tomcat7 (so as not to break the 2 you validated before) would you be comfortable with it being changed to "javaee"?

        Show
        James Dyer added a comment - ...so apparently the spec and the xsd shipped with the spec are inconsistent? which i guess means feel free to change it to follow the examples in the XSD? If I validate the change with Jetty8 & Tomcat7 (so as not to break the 2 you validated before) would you be comfortable with it being changed to "javaee"?
        Hide
        Hoss Man added a comment -

        i just used what was in the examples from the spec, and as far as i know it shouldn't matter what we use ... if you're comfortable changing it, then feel free to change it.

        Show
        Hoss Man added a comment - i just used what was in the examples from the spec, and as far as i know it shouldn't matter what we use ... if you're comfortable changing it, then feel free to change it.
        Hide
        James Dyer added a comment -

        re-opening to change the <web-app /> tag as discussed.

        Show
        James Dyer added a comment - re-opening to change the <web-app /> tag as discussed.
        James Dyer made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Assignee Hoss Man [ hossman ] James Dyer [ jdyer ]
        Hide
        James Dyer added a comment -

        The original commit for this issue followed a misprint in the 2.5 servlet spec on the examples, pages 153-4 (http://download.oracle.com/otn-pub/jcp/servlet-2.5-mrel2-eval-oth-JSpec/servlet-2_5-mrel2-spec.pdf). While this works on Tomcat7 & Jetty8, it does not work with Jboss5 (which apparently is doing strict verification). This patch follows the information on page 109ff of the same specification and also the xsd file at http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd (note: There is no xsd file available at http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd). I have tested this with JBoss5, Tomcat7 & the Jetty8-based solr example.

        I will commit shortly unless anyone disagrees.

        Show
        James Dyer added a comment - The original commit for this issue followed a misprint in the 2.5 servlet spec on the examples, pages 153-4 ( http://download.oracle.com/otn-pub/jcp/servlet-2.5-mrel2-eval-oth-JSpec/servlet-2_5-mrel2-spec.pdf ). While this works on Tomcat7 & Jetty8, it does not work with Jboss5 (which apparently is doing strict verification). This patch follows the information on page 109ff of the same specification and also the xsd file at http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd (note: There is no xsd file available at http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd ). I have tested this with JBoss5, Tomcat7 & the Jetty8-based solr example. I will commit shortly unless anyone disagrees.
        James Dyer made changes -
        Attachment SOLR-3309.patch [ 12528657 ]
        James Dyer committed 1341897 (1 file)
        Reviews: none

        SOLR-3309: Change <web-app /> to use "javaee" namespace instead of "j2ee"

        Hide
        James Dyer added a comment -

        Committed the "javaee" change, Trunk r1341897.

        Show
        James Dyer added a comment - Committed the "javaee" change, Trunk r1341897.
        James Dyer made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            James Dyer
            Reporter:
            Bill Bell
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development