You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Xavi Beumala <xa...@marfeel.com> on 2015/05/16 23:27:22 UTC

Performance bottleneck due to not-required @attribute in custom tags

Hi all,

I've isolated a very simple use case that is causing a big performance
bottleneck. I'm running tomcat 8.0.15 and I can reproduce this on 8.0.20
too.

With this simple .jsp:
<c:forEach begin="0" end="10">
    <err:myTag />
</c:forEach>


Where err:myTag is:
<%@attribute name="myParam" required="false" type="java.lang.String" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:if test="${not empty myParam}">
    <h1>${name}</h1>
</c:if>


Using JProfiler I've identified that the system spends lot of time on
java.lang.Throwable.fillInStackTrace.

If I'm right It turns out that myParam is not a required attribute.
ScopedAttributeELResolver is not able to read any value from the context
and starts executing the logic on ImportHandler which tries to load from
the the classLoader java.lang.myParam,
javax.servlet.myParam, javax.servlet.http.myParam
and javax.servlet.jsp.myParam which end up throwing
a ClassNotFoundException incurring a big performance drop.


Our application makes intensive use of JSP and custom tags and this has
been killing our performance (simple pages takes >4s the render).

Is this a known issue? am I missing something on my findings?
A simple solution consists in always initializing the @Attributes
What do you think? What would be the best solution? I think that if I'm
right this issue is affecting tons of implementations.


Many thanks for your time
Xavi