tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Burton <bur...@rojo.com>
Subject The amazingly slow performance of JSP (profiler results)
Date Sat, 28 May 2005 05:02:12 GMT
I've been tuning our application trying to get the maximum performance 
out if the system as possible.

I've been throwing the system at jprofiler and allowing it to tell me 
where to optimized.

In short Tomcat is slower than our DB, filesystem,. network and all 
other systems by about 4x.

I've been able to shave some page load time off by some but not enough.

The problem I'm starting to see is that we just have a large number of 
c:set and c:if constructs (and so forth) within loops.  These loops then 
get executed 5 times and next thing you know it you have 50k taglib calls.

The problem comes when you look at the source:

Let's say you start with:

> <c:set var="foo" value="bar"/>

This nice little elegant piece of code gets expanded to:

>   private boolean _jspx_meth_c_set_0(PageContext _jspx_page_context)
>           throws Throwable {
>     PageContext pageContext = _jspx_page_context;
>     JspWriter out = _jspx_page_context.getOut();
>     //  c:set
>     org.apache.taglibs.standard.tag.rt.core.SetTag _jspx_th_c_set_0 = 
> (org.apache.taglibs.standard.tag.rt.core.SetTag) 
> _jspx_tagPool_c_set_var_value_nobody.get(org.apache.taglibs.standard.tag.rt.core.SetTag.class);
>     _jspx_th_c_set_0.setPageContext(_jspx_page_context);
>     _jspx_th_c_set_0.setParent(null);
>     _jspx_th_c_set_0.setVar("foo");
>     _jspx_th_c_set_0.setValue(new String("bar"));
>     int _jspx_eval_c_set_0 = _jspx_th_c_set_0.doStartTag();
>     if (_jspx_th_c_set_0.doEndTag() == 
> javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
>       return true;
>     _jspx_tagPool_c_set_var_value_nobody.reuse(_jspx_th_c_set_0);
>     return false;
>   }

Which explains why JSP alone is so amazingly slow!


I did a comparison of the page performance here and it was 15x slower than just using Java.
 So the same "set" operation in Java was 15x faster.

... so in short ... does anyone have any way to speed this up?

The other thing I noticed is that EL is evaluated at runtime (which has to be parsed) and
sometimes uses reflections.  Can anyone shed any more light on this and hopefully provide
some performance optimization suggestions?

Kevin

-- 


Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com. 
See irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html

   Kevin A. Burton, Location - San Francisco, CA
      AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message