<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 4, 2018 at 12:33 AM, Stuart Douglas <span dir="ltr"><<a href="mailto:stuart.w.douglas@gmail.com" target="_blank">stuart.w.douglas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">For us the additional overhead is class loading and TLD's. We need to eagerly parse the TLD's so we know about any listeners, and then the JSF listener and ServletInitializer causes a lot of class loading.</div></blockquote><div><br></div><div>The listener should never run though if the ServletInitializer doesn't discover any JSF class or artefact.</div><div><br></div><div>With the "lot of class loading", do you mean the classes that the ServletInitializer loads in order to determine JSF is used or not?</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>My change means that I can do the annotation/inheritance scan using Jandex, so there is no class loading, and if JSF is not present avoid loading any classes or parsing any TLD's entirely.<br></div></div></blockquote><div><br></div><div>I'd really like to use Jandex too in Mojarra, although I'm not entirely sure how to do this from within the library. Maybe a separate build though, not sure yet (but that's my problem to deal with I guess :P)</div><div><br></div><div>I do wonder about parsing TLDs. Which one do you exactly mean, and when are they being parsed in your test case?</div><div><br></div><div>Kind regards,</div><div>Arjan</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div><span class="gmail-HOEnZb"><font color="#888888"><div><br></div><div>Stuart</div></font></span></div></div><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 3, 2018 at 10:36 PM, arjan tijms <span dir="ltr"><<a href="mailto:arjan.tijms@gmail.com" target="_blank">arjan.tijms@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm already on this list indeed ;)</div><div><br></div><div>Indeed, the FacesInitizalizer only does these two things unconditionally:</div><div><br></div><div><div>boolean appHasSomeJsfContent = appMayHaveSomeJsfContent(class<wbr>es, servletContext);</div><div>boolean appHasFacesServlet = getExistingFacesServletRegistr<wbr>ation(servletContext) != null;</div></div><div><br></div><div>As can be seen from the code, it looks at the classes provided by the Servlet container, for a faces-config.xml in WEB-INF, and for the CDI bean annotated with @FacesConfig (which is a single CDI lookup).</div><div><br></div><div>Note though that WildFly is using a somewhat older Mojarra release, so the code is a bit different in WildFly, although not that much.</div><div><br></div><div>So if the application is not actually using JSF, that's all it does. And there should not be any additional overhead. If the application does use JSF indeed, there's overhead and that's indeed too much overhead. I've been trying on reducing this, for instance by using a pre-parsed internal faces-config file.</div><div><br></div><div>See specifically this commit: <a href="https://github.com/javaserverfaces/mojarra/commit/0129ffe2aadb4e87f46d094159cee0910f73003a" target="_blank">https://github.com/jav<wbr>aserverfaces/mojarra/commit/01<wbr>29ffe2aadb4e87f46d094159cee091<wbr>0f73003a</a></div><div><br></div><div>@Stuart, I wonder what the overhead is that you see when the application is not using JSF, and which test application you are actually using. Could it be that you somehow have a FacesServlet or faces-config.xml etc anyway?</div><div><br></div><div>Kind regards,</div><div>Arjan</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail-m_-1989572639158419015HOEnZb"><div class="gmail-m_-1989572639158419015h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 3, 2018 at 7:50 AM, Guillermo González de Agüero <span dir="ltr"><<a href="mailto:z06.guillermo@gmail.com" target="_blank">z06.guillermo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>This would be great to have!</div><div><br></div><div>As for JSF activation, note that faces-config.xml nor Faces Servlet are required anymore. There's also a new @FacesConfig CDI qualifier on JSF 2.3 which substitutes faces-config.</div><div><br></div><div>Looking at FacesConfigInitializer class[1] might provide some more insight. I've always been puzzled with the "Initializing Mojarra" log when deploying a JAX-RS only app. The mentioned class supposedly should prevent JSF from unnecessary initializing. Perhaps some work could be done there which helps also other runtimes?</div><div><br></div><div>Btw, I think he is already subscribed to the list, but I'm cc'ing Arjan Tijms since he's the expert on this stuff.</div><div><br></div><div><br></div><div>Regards,</div><div><br></div><div>Guillermo González de Agüero<br></div><div><br></div><div>[1] <a href="https://github.com/javaserverfaces/mojarra/blob/4ea1679838f5a6bf6899c282964ff241c020e2f9/impl/src/main/java/com/sun/faces/config/FacesInitializer.java" target="_blank">https://github.com/javaserverf<wbr>aces/mojarra/blob/4ea1679838f5<wbr>a6bf6899c282964ff241c020e2f9/i<wbr>mpl/src/main/java/com/sun/face<wbr>s/config/FacesInitializer.java</a><br></div><div><br><div class="gmail_quote"><div><div class="gmail-m_-1989572639158419015m_3865511248456240917h5"><div dir="ltr">El mar., 3 abr. 2018 a las 3:16, Stuart Douglas (<<a href="mailto:stuart.w.douglas@gmail.com" target="_blank">stuart.w.douglas@gmail.com</a>>) escribió:<br></div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_-1989572639158419015m_3865511248456240917h5"><div dir="ltr">Hi Everyone,<div><br></div><div>At the moment JSP and JSF are being activated for all web deployments, which is relatively expensive as this involves quite a bit of class loading and TLD parsing. </div><div><br></div><div>To give an idea about how much time this is actually taking I did a test with a large number of small servlet only deployments both with and without JSF, and JSF was accounting for 20% of total deployment time even though it was not actually used by any of the deployments.</div><div><br></div><div>It also had a significant effect on memory usage, as the parsed TLD's are retained, and are quite large.</div><div><br></div><div>The root of this issue is that the spec does not define clear activation criteria for these technologies. I am proposing that we formalise some activation criteria, so that we can avoid activating them if they are not required.</div><div><br></div><div>JSP:</div><div><br></div><div>For JSP I think we can use the following criteria (if either one is satisfied JSP is activated):</div><div><br></div><div>- The presence of a JSP file mapping in web.xml</div><div>- The presence of JSP files inside the deployment</div><div>- The presence of JSF</div><div><br></div><div>One thing that does concern me is that searching for JSP files in this way may be expensive in large deployments with lots of web resources. An alternate approach may be to try and make JSP lazy, so class loading and TLD passing does not happen until a request for a JSP file arrives.</div><div><br></div><div><br></div><div>JSF:</div><div><br></div><div>This is much less clear. I think we can use the presence of one of the following:</div><div><br></div><div>- faces-config.xml</div><div>- The faces servlet in web.xml</div><div>- Something else?</div><div><br></div><div>I am not really sure what effect this will have on backwards compatibility though. If this is a compatibility problem we could add an attribute to the JSF subsystem to restore the old mode.</div><div><br></div><div><br></div><div>Does this sound reasonable? </div><div><br></div><div>Stuart</div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div><span>
______________________________<wbr>_________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org" target="_blank">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailma<wbr>n/listinfo/wildfly-dev</a></span></blockquote></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>