thanks for responding to my post remy. I started looking at the
connector & coyote last week, but I haven't gone through all of it yet.
Remy Maucherat wrote:
> There's the source code at this point ;-)
> j-t-c/coyote, j-t-c/http11 and of course j-t-c/util.
>
> coyote is an adapter for Tomcat (3.3.x and 4.x).
> http11 is an HTTP/1.1 processor (takes an input stream with the request
> bytes, and writes the response bytes to an output stream).
>
> The httpconnector has the two mixed together (so it's harder to maintain),
> with an unusual way of handling response buffering.
>
> The HTTP request parsing code is relatively similar, with the new one having
> fancier and more efficient buffering.
>
> The HTTP response in Coyote is based on the OutputBuffer from Tomcat 3.3,
> which makes the ouptut a lot more efficient, and allows to recycle the
> writers and output streams used.
>
> Generally, the implementation of the new HTTP processor is a lot more
> elegant and robust (plus it's quite fast, which doesn't hurt).
My benchmarks definitely show the gains in the improved buffering and
object recycling. I suspect most of the in-efficiencies are in the code
generated by the jsp compiler.
>
> I have no idea why the directive is slower.
> In any case, I don't see how it would make a difference for the connector,
> so the explanation is probably in the Jasper code.
>
> One test which would be useful to get a better idea would be to assemble the
> pages manually, and comparing with the previous results.
Perhaps when you have time, we can continue this discussion privately
and get into nitty gritty details. Later today and next week I am going
to run my next set of tests as I mentioned earlier. If jasper is the
cause, then my next set of tests which doesn't use jstl and only java
should be faster than both jslt w/include directive and jslt w/action
include. Or atleast that is my guess at this point.
>
> It's designed to be fast, but I don't know why the performance gains get
> bigger when including.
>
> Remy
Here is an example of the kind of code it generates when using include
directive with jstl.
_jspx_th_c_set_1.setVar("navtest");
_jspx_th_c_set_1.setScope("request");
try {
int _jspx_eval_c_set_1 = _jspx_th_c_set_1.doStartTag();
if (_jspx_eval_c_set_1 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
try {
if (_jspx_eval_c_set_1 !=
javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = pageContext.pushBody();
_jspx_th_c_set_1.setBodyContent((javax.servlet.jsp.tagext.BodyContent)
out);
_jspx_th_c_set_1.doInitBody();
}
do {
// end
// HTML // begin
[file="/common/init.jsp";from=(13,41);to=(14,2)]
out.write("\r\n ");
// end
// begin
[file="/common/init.jsp";from=(14,2);to=(14,12)]
/* ---- c:choose ---- */
org.apache.taglibs.standard.tag.common.core.ChooseTag
_jspx_th_c_choose_0 = new
org.apache.taglibs.standard.tag.common.core.ChooseTag();
_jspx_th_c_choose_0.setPageContext(pageContext);
_jspx_th_c_choose_0.setParent(_jspx_th_c_set_1);
try {
int _jspx_eval_c_choose_0 =
_jspx_th_c_choose_0.doStartTag();
if (_jspx_eval_c_choose_0 ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED)
throw new JspTagException("Since tag handler
class org.apache.taglibs.standard.tag.common.core.ChooseTag does not
implement BodyTag, it can't return BodyTag.EVAL_BODY_TAG");
if (_jspx_eval_c_choose_0 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
// end
// HTML // begin
[file="/common/init.jsp";from=(14,12);to=(15,4)]
out.write("\r\n ");
// end
// begin
[file="/common/init.jsp";from=(15,4);to=(15,47)]
/* ---- c:when ---- */
org.apache.taglibs.standard.tag.el.core.WhenTag _jspx_th_c_when_0 = new
org.apache.taglibs.standard.tag.el.core.WhenTag();
_jspx_th_c_when_0.setPageContext(pageContext);
_jspx_th_c_when_0.setParent(_jspx_th_c_choose_0);
_jspx_th_c_when_0.setTest("${param.A ==
'one'}");
try {
int _jspx_eval_c_when_0 =
_jspx_th_c_when_0.doStartTag();
if (_jspx_eval_c_when_0 ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED)
throw new JspTagException("Since tag
handler class org.apache.taglibs.standard.tag.el.core.WhenTag does not
implement BodyTag, it can't return BodyTag.EVAL_BODY_TAG");
if (_jspx_eval_c_when_0 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
// end
// HTML // begin
[file="/common/init.jsp";from=(15,47);to=(15,48)]
out.write("0");
// end
// begin
[file="/common/init.jsp";from=(15,48);to=(15,57)]
} while (_jspx_th_c_when_0.doAfterBody() ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
}
if (_jspx_th_c_when_0.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return;
} finally {
_jspx_th_c_when_0.release();
}
// end
// HTML // begin
[file="/common/init.jsp";from=(15,57);to=(16,4)]
out.write("\r\n ");
// end
// begin [file="/common/init.jsp";from=(16,4);to=(16,38)]
/* ---- c:when ---- */
org.apache.taglibs.standard.tag.el.core.WhenTag
_jspx_th_c_when_1 = new
org.apache.taglibs.standard.tag.el.core.WhenTag();
_jspx_th_c_when_1.setPageContext(pageContext);
_jspx_th_c_when_1.setParent(_jspx_th_c_choose_0);
_jspx_th_c_when_1.setTest("${param.A == ''}");
try {
int _jspx_eval_c_when_1 =
_jspx_th_c_when_1.doStartTag();
if (_jspx_eval_c_when_1 ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED)
throw new JspTagException("Since tag handler
class org.apache.taglibs.standard.tag.el.core.WhenTag does not implement
BodyTag, it can't return BodyTag.EVAL_BODY_TAG");
if (_jspx_eval_c_when_1 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
// end
// HTML // begin
[file="/common/init.jsp";from=(16,38);to=(16,41)]
out.write("100");
// end
// begin
[file="/common/init.jsp";from=(16,41);to=(16,50)]
} while (_jspx_th_c_when_1.doAfterBody() ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
}
if (_jspx_th_c_when_1.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return;
} finally {
_jspx_th_c_when_1.release();
}
// end
// HTML // begin
[file="/common/init.jsp";from=(16,50);to=(17,4)]
out.write("\r\n ");
// end
// begin [file="/common/init.jsp";from=(17,4);to=(17,38)]
/* ---- c:when ---- */
org.apache.taglibs.standard.tag.el.core.WhenTag
_jspx_th_c_when_2 = new
org.apache.taglibs.standard.tag.el.core.WhenTag();
_jspx_th_c_when_2.setPageContext(pageContext);
_jspx_th_c_when_2.setParent(_jspx_th_c_choose_0);
_jspx_th_c_when_2.setTest("${param.A != ''}");
try {
int _jspx_eval_c_when_2 =
_jspx_th_c_when_2.doStartTag();
if (_jspx_eval_c_when_2 ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED)
throw new JspTagException("Since tag handler
class org.apache.taglibs.standard.tag.el.core.WhenTag does not implement
BodyTag, it can't return BodyTag.EVAL_BODY_TAG");
if (_jspx_eval_c_when_2 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
// end
// HTML // begin
[file="/common/init.jsp";from=(17,38);to=(17,42)]
out.write("1000");
// end
// begin
[file="/common/init.jsp";from=(17,42);to=(17,51)]
} while (_jspx_th_c_when_2.doAfterBody() ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
}
if (_jspx_th_c_when_2.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return;
} finally {
_jspx_th_c_when_2.release();
}
// end
// HTML // begin
[file="/common/init.jsp";from=(17,51);to=(18,4)]
out.write("\r\n ");
// end
// begin [file="/common/init.jsp";from=(18,4);to=(18,17)]
/* ---- c:otherwise ---- */
org.apache.taglibs.standard.tag.common.core.OtherwiseTag
_jspx_th_c_otherwise_0 = new
org.apache.taglibs.standard.tag.common.core.OtherwiseTag();
_jspx_th_c_otherwise_0.setPageContext(pageContext);
_jspx_th_c_otherwise_0.setParent(_jspx_th_c_choose_0);
try {
int _jspx_eval_c_otherwise_0 =
_jspx_th_c_otherwise_0.doStartTag();
if (_jspx_eval_c_otherwise_0 ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED)
throw new JspTagException("Since tag handler
class org.apache.taglibs.standard.tag.common.core.OtherwiseTag does not
implement BodyTag, it can't return BodyTag.EVAL_BODY_TAG");
if (_jspx_eval_c_otherwise_0 !=
javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
// end
// HTML // begin
[file="/common/init.jsp";from=(18,17);to=(18,18)]
out.write("1");
// end
// begin
[file="/common/init.jsp";from=(18,18);to=(18,32)]
} while (_jspx_th_c_otherwise_0.doAfterBody()
== javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
}
if (_jspx_th_c_otherwise_0.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return;
} finally {
_jspx_th_c_otherwise_0.release();
}
// end
// HTML // begin
[file="/common/init.jsp";from=(18,32);to=(19,2)]
out.write("\r\n ");
// end
// begin [file="/common/init.jsp";from=(19,2);to=(19,13)]
} while (_jspx_th_c_choose_0.doAfterBody() ==
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
}
if (_jspx_th_c_choose_0.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return;
} finally {
_jspx_th_c_choose_0.release();
}
// end
// HTML // begin [file="/common/init.jsp";from=(19,13);to=(20,0)]
out.write("\r\n");
Since include directive is like C include. I originally though include
directive would always perform better than action include. For one
thread, include directive does perform better, but 2 threads action
include is twice as fast. One interesting observation with coyote
include directive for 1 thread is 95% of the responses were 30ms, but
the standard deviation or variance is almost 3x the mean. Other noteable
observations for 1 thread is include directive see dramatic fluctuations
in cpu and memory usage. This suggests JSP tags create and destroy lots
of objects associated with parsing and processing.
include directive - 1 thread 1000
-----------------
httpconnector ave - 33
cpu usage - 40-70
coyote ave - 179
cpu usage - 50-90%
action include - 1 thread 1000
-----------------
httpconnector ave - 81
cpu usage - 60-85%
coyote ave - 48
cpu usage - 40-50%
include directive - 2 threads 500
-----------------
httpconnector ave - 453
cpu usage - 85-100%
coyote ave - 212
cpu usage - 80-90%
action include - 2 threads 500
-----------------
httpconnector ave - 299
cpu usage - 80-100%
coyote ave - 89
cpu usage - 50-80%
peter lin
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>