You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by KN Yasa <KN...@Efavorites.com> on 2000/11/21 22:22:03 UTC

performance issue.. urgent..

Hi Folks,

Here is one of the programs we have written in XSP. The problem we have here
is lacking the performance.
Anybody can suggest how to improve the performance..

environment:  weblogic 5.1
                     ejb 1.1
                     oracle 8i
                     cocoon 1.7.4
                  

<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet type="text/xsl" href="addafav.xsl"?>
<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">

<xsp:structure>
	<xsp:include>com.bf.util.*</xsp:include>
</xsp:structure>
                                                                 
 <page>
        <xsp:logic>
        try
        {
            String client_id = request.getParameter("client_id");

            String action = "AddFavoriteWB";
            String client_member_id =
request.getParameter("client_member_id");
            String machine_id = request.getParameter("machine_id");
            String product_number = request.getParameter("product_number");
            String product_std_num =
request.getParameter("product_std_num");
            String product_name = request.getParameter("product_name");
            String product_url = request.getParameter("product_url");
            String client_category_num =
request.getParameter("client_category_num");
            String product_attrib1 =
request.getParameter("product_attrib1");
            String member_screen_name =
request.getParameter("member_screen_name");
            String member_email = request.getParameter("member_email");
            String member_first_name =
request.getParameter("member_first_name");
            String member_last_name =
request.getParameter("member_last_name");           
            String status = "A";
            String list_flag = "F"; 
            String private_flag = "N"; 

            <xsp:content>
 
<servlet_url><xsp:expr>SiteConstants.efavServlet</xsp:expr></servlet_url>
                <action><xsp:expr>action</xsp:expr></action>
                <client_id><xsp:expr>client_id</xsp:expr></client_id>
 
<client_member_id><xsp:expr>client_member_id</xsp:expr></client_member_id>
                <machine_id><xsp:expr>machine_id</xsp:expr></machine_id>
 
<product_number><xsp:expr>product_number</xsp:expr></product_number>
 
<product_std_num><xsp:expr>product_std_num</xsp:expr></product_std_num>
 
<product_name><xsp:expr>product_name</xsp:expr></product_name>
                <product_url><xsp:expr>product_url</xsp:expr></product_url>
 
<client_category_num><xsp:expr>client_category_num</xsp:expr></client_catego
ry_num>
                <status><xsp:expr>status</xsp:expr></status>
                <list_flag><xsp:expr>list_flag</xsp:expr></list_flag>
 
<product_attrib1><xsp:expr>product_attrib1</xsp:expr></product_attrib1>
 
<member_screen_name><xsp:expr>member_screen_name</xsp:expr></member_screen_n
ame>
 
<member_email><xsp:expr>member_email</xsp:expr></member_email>
 
<member_first_name><xsp:expr>member_first_name</xsp:expr></member_first_name
>
 
<member_last_name><xsp:expr>member_last_name</xsp:expr></member_last_name>
 
<private_flag><xsp:expr>private_flag</xsp:expr></private_flag>
            </xsp:content>
        }
        catch(Exception e)
        {
            System.out.println("addafav.xml Exception: "+e.getMessage());
            String message = DBConstants.GENERIC_ERROR;
            <xsp:pi target="xml-stylesheet"> href="message.xsl"
type="text/xsl"</xsp:pi>
 
<xsp:content><message><xsp:expr>message</xsp:expr></message></xsp:content>
        }
        </xsp:logic>
       
	</page>
</xsp:page>



thanks
kn Yasa

Re: performance issue.. urgent..

Posted by Berin Loritsch <bl...@infoplanning.com>.
----- Original Message ----- 
From: "KN Yasa" <KN...@Efavorites.com>
To: <co...@xml.apache.org>
Cc: <co...@xml.apache.org>
Sent: Tuesday, November 21, 2000 4:22 PM
Subject: performance issue.. urgent..


> Hi Folks,
> 
> Here is one of the programs we have written in XSP. The problem we have here
> is lacking the performance.
> Anybody can suggest how to improve the performance..

This may not be what you are looking for, but these are
my observations about the Cocoon framework:

Anything that can be done by the parser is the fastest.
Anything that can be done by stylesheet (XSLT) is second
fastest (as long as you don't get too fancy)
Anything that can be done by processor is third fastest.
XSP is the slowest.

Why?

a) Parsers are optimized, they can take some shortcuts
   and do lazy DOM evaluation.  In SAX, things happen
   more quickly anyway.  Cocoon 1 is DOM, Cocoon 2 is
   SAX.

b) The XSLT layer is quick.  Xalan 2 compiles the
   stylesheet so it is even quicker--but I have found
   XT to be quicker.

c) Processors are resident in memory and already compiled.
   They add little overhead.  I have observed that includes
   using XInclude are slightly slower than using the
   document() function in XSLT (we are talking by ~50 ms
   consistently).

d) XSP must be compiled the first time.  That means that
   your relatively simple XSP page is converted into
   a java file, and then compiled.  This should only
   happen once--until you change the XSP page.  The first
   access will take between 6 and 30 seconds depending
   on the speed of your processor.  After the page is
   compiled it still is slower than simply reading a page
   with a parser.

Observations about relative speed of include methods:
-----------------------------------------------------
In Cocoon we have three methods of including an XML
document inside another: XInclude, 'XSLT document()',
and XSP 'util:include'.

Because the XSLT method is part of the XSLT framework
and better optimized, we have ~50ms quicker performance
than XInclude.

Because XInclude is a processor, the DOM needs to be
fully read before processing can take place--giving
us marginally slower performance.

XSP utility function 'util:include' is part of the
XSP framework--in general performance takes twice as
long as other methods.  This is because the two DOMS
have to be read separately and then merged.

Observations about C2 and relative speed:
-----------------------------------------
In Cocoon2 we use SAX based processing, which is better
for high transaction environments common to the web.  As
a result the difference between XInclude and XSLT is
nominal at best.  I have noticed that the demo for Database
incorporation using the SQL processor and ESQL XSP page
has a noticeable difference: SQL processor is slower by
~100ms consistently.  I believe this is due to code
differences more than anything else.

The bottom line is that when you include XSP, you should
only implement it when you have to use objects that don't
fit any of the other methods given to us.  In short check
the performance of your methods that you access--they can
be the culprits.  Also, don't use XSP if you don't have
to.  C2 fixes many shortcomings and performance issues of
C1, but it doesn't beat optimizing your code.