You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mohan Radhakrishnan <ra...@gmail.com> on 2009/02/18 12:55:59 UTC

Struts performance metrics

Hi,
      There were some concerns raised about the performance of OGNL. We are
evaluating Struts 2 for an internet site. How bad is the performance of OGNL
? Are there any methods to gather metrics by profiling that the forum
recommends ?


Thanks,
Mohan
-- 
View this message in context: http://www.nabble.com/Struts-performance-metrics-tp22077072p22077072.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts performance metrics

Posted by Dave Newton <ne...@yahoo.com>.
Mohan Radhakrishnan wrote:
> I will use larger datasets and property access also.

Wait, you weren't comparing property access speed?

Dave

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


Re: Struts performance metrics

Posted by Steven Yang <ke...@gmail.com>.
>
>
> We plan to profe right from the beginning but I am not sure how JSTL can
> replace Struts tags to increase performance. I understand that in order to
> display data we can use JSTL. Struts tags are required to use the framework
> fully. Isn't it ?
> -

I guess for some cases you do have to use Struts tags for example I dont
know how to do i18n using JSTL tags. I can use s:text for that.
But I suppose using Struts tags some where wouldnt hurt too much if you
really run into performance issues with Struts tags

Help needed to use the scope interceptor for a wizard

Posted by Celinio Fernandes <ce...@yahoo.com>.
Hi,
I am trying to implement a wizard form in Struts 2, using the SCOPE INTERCEPTOR.

That wizard is used to register a new user.
I have 3 pages :
In the first page, the user chooses a login and a password.
In the second page, the user enters his phone number, age, first name, name, fax.
In the third page, the user enters his adress details : country, street name, street number, post code.

There is one final action that is launched when the user clicks on SUBMIT in the third page.
This action should get all the information entered in the 3 pages and insert it into the database.

So far is what i have got :

First page : login.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>

<link href="<s:url value="/css/styles.css"/>" rel="stylesheet" type="text/css"/>
<s:head theme="xhtml"   /> 
<s:debug/>
<center>

 <s:form action="nouvLogin" method="POST" theme="xhtml"   >
    <tr>
        <td colspan="2"> Choisissez un login et un password</td>
    </tr>
    
     <tr>
       <td colspan="2">
             <s:actionerror />
            <!-- <s:fielderror /> --> 
       </td>
    </tr>

    <s:textfield name="login" key="nouvLogin.login" />
    <s:password name="password" key="nouvLogin.pwd"/>
    <s:submit value="Valider" align="center"/>
</s:form>
<br/>

</center>

Second page : nouvUtilisateur.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>

<link href="<s:url value="/css/styles.css"/>" rel="stylesheet" type="text/css"/>
<s:head theme="xhtml"   /> 
<s:debug/>
<center>

<s:form action="confirmDetails" method="POST" theme="xhtml"   >
   <table>
     <tr>
       <td colspan="2">
             <s:actionerror />
            <!-- <s:fielderror /> --> 
       </td>
    </tr>
    <tr>
        <s:textfield name="nom"  value="nom" />
        <s:textfield name="prenom"  value="prenom" />
        <s:textfield name="telephone"  value="telephone" />
        <s:textfield name="titre"  value="titre" />
        <s:textfield name="fax"  value="fax" />
        <s:submit value="Valider" align="center"/>
    </tr>
    </table>

</s:form>
<br/>

</center>

third page : nouvAdresse.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>

<link href="<s:url value="/css/styles.css"/>" rel="stylesheet" type="text/css"/>
<s:head theme="xhtml"   /> 
<s:debug/>
<center>

<s:form action="confirmAdresse" method="POST" theme="xhtml"   >
   <table>
     <tr>
       <td colspan="2">
             <s:actionerror />
            <!-- <s:fielderror /> --> 
       </td>
    </tr>
    <tr>
        <s:textfield name="codepostal"  value="codepostal" />
        <s:textfield name="departement"  value="departement" />
        <s:textfield name="numero"  value="numero" />
        <s:textfield name="pays"  value="pays" />
        <s:textfield name="rue"  value="rue" />
        <s:textfield name="ville"  value="ville" />
        <s:submit value="Valider" align="center"/>
    </tr>
    </table>
    
</s:form>
<br/>

</center>

Here is what i got in struts.xml :

<action name="nouvLogin" >  
        <interceptor-ref name="defaultStack"/>  
        <interceptor-ref name="scope">  
            <param name="session">login, password</param>  
            <param name="type">start</param>  
            <!-- Do i need the key parameter ? What should i put in there ? -->
            <param name="key">goods:</param> 
        </interceptor-ref>  
        <result name="success" type="tiles">VenteEnLigne.utilisateur</result> 
    </action>

    <action name="confirmDetails"> 
        <interceptor-ref name="defaultStack"/> 
        <interceptor-ref name="scope"> 
            <param name="session">nom, prenom, telephone, titre, fax</param> 
            <!-- Do i need the key parameter ? What should i put in there ? -->
            <param name="key">goods:</param>
        </interceptor-ref> 
        <result name="success" type="tiles">VenteEnLigne.adresse</result> 
    </action>

    <action name="confirmAdresse" class="UtilisateurAction"  method="creerNouvelUtilisateur"> 
        <interceptor-ref name="defaultStack"/> 
        <interceptor-ref name="scope"> 
            <param name="session">codepostal, departement, numero, pays, rue, ville</param> 
            <param name="type">end</param> 
            <!-- Do i need the key parameter ? What should i put in there ? All previous key parameters ? -->
            <param name="key">goods:</param>
        </interceptor-ref> 
        <result name="success" type="tiles">VenteEnLigne.inscriptionFin</result> 
    </action> 
    

As i commented out inside struts.xml, i am a bit lost with what i should put inside the interceptor-ref tag.
There is little documentation and samples about its use.

Also, what exactly are the advantages of the SCOPE interceptor ?

Thanks for helping.



      

Re: Struts performance metrics

Posted by Mohan Radhakrishnan <ra...@gmail.com>.
I will use larger datasets and property access also.

We plan to profe right from the beginning but I am not sure how JSTL can
replace Struts tags to increase performance. I understand that in order to
display data we can use JSTL. Struts tags are required to use the framework
fully. Isn't it ?
-- 
View this message in context: http://www.nabble.com/Struts-performance-metrics-tp22077072p22132801.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts performance metrics

Posted by Mohan Radhakrishnan <ra...@gmail.com>.
 Yes. It does. Thanks.

Now I find a big difference in performance. So unless I use freemarker I
should be able to mix JSTL and OGNL and get some benefit.

Iteration over a very large collection and access Javabean properties.
JSTL - 2557 ms
OGNL - 4499 ms

Mohan
-- 
View this message in context: http://www.nabble.com/Struts-performance-metrics-tp22077072p22258767.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts performance metrics

Posted by Chris Pratt <th...@gmail.com>.
The StrutsRequestWrapper should allow you to access the value stack from
JSTL EL, so you could use <c:forEach> to iterate over a value from the value
stack.
  (*Chris*)

On Fri, Feb 27, 2009 at 7:12 AM, Mohan Radhakrishnan <
radhakrishnan.mohan@gmail.com> wrote:

>
> Ok. Are you able to access the Value Stack directly using JSTL without
> using
> s:iterator ?
>
> Thanks,
> Mohan
>
> --
> View this message in context:
> http://www.nabble.com/Struts-performance-metrics-tp22077072p22247775.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Struts performance metrics

Posted by Mohan Radhakrishnan <ra...@gmail.com>.
Ok. Are you able to access the Value Stack directly using JSTL without using
s:iterator ?

Thanks,
Mohan

-- 
View this message in context: http://www.nabble.com/Struts-performance-metrics-tp22077072p22247775.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts performance metrics

Posted by Steven Yang <ke...@gmail.com>.
Hijust to share some of my experience and see what you decide to do

I have worked on a project which the end result is packed into a jar
(actions and stuff)and will be throw into and coexist with other project.
To run the project, I simply put the jar and related jsp and struts setting
xml's into another project and everything will run.
I have deployed my project into 2-3 different projects(all using plain
servlets) in my company and . And all worked fine, meaning no major
compatibility issues. Except for one, I have the performance issues
described on most places you have seen. And I basically did the same thing
as what they all did, I changed Struts tags to JSTL tags, and everything
just worked fine.

All I can say is that from my observation its probably the different jars
files included that my cause some conflicts. I have not have the time fully
test it out.
so just something to share with you.

Re: Struts performance metrics

Posted by Dave Newton <ne...@yahoo.com>.
Mohan Radhakrishnan wrote:
>       I took a simple JSP using Struts tags and one using equivalent JSTL
> tags and deployed the WARS one by one in tomcat and used JProbe to attach to
> the session. I filtered the call graph to show OGNL only and then JSTL only.

That doesn't really help me much.

I ask because OGNL property access has been demonstrably slower than 
JSTL, and rather significantly so.

Dave


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


Re: Struts performance metrics

Posted by Mohan Radhakrishnan <ra...@gmail.com>.
Hi,

      I took a simple JSP using Struts tags and one using equivalent JSTL
tags and deployed the WARS one by one in tomcat and used JProbe to attach to
the session. I filtered the call graph to show OGNL only and then JSTL only.

     Actually our intention was to reduce the performance implications of
using OGNL if there are any. I came across messages in the forum about OGNL
issues. Ours is an internet-enabled web site.


Thanks,
Mohan
-- 
View this message in context: http://www.nabble.com/Struts-performance-metrics-tp22077072p22120189.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts performance metrics

Posted by Dave Newton <ne...@yahoo.com>.
Mohan Radhakrishnan wrote:
>         I profiled using JProbe and for a simple 'hello world' jsp I found
> that JSTL is taking a little more time than OGNl.
> 
> OGNL :
> 
> org.apache.jsp.example.HelloWorld_jsp._jspService(HttpServletRequest;
> HttpServletResponse)
> 
> Cumulative time spent = 1103
> 
> -------------------------------------------------------------------------------------------
> 
> JSTL
> 
> org.apache.jsp.index_jsp._jspService(HttpServletRequest;
> HttpServletResponse)
> 
> Cumulative time spent = 1429

Could you describe your testing methodology, and what, precisely, you're 
doing to get those results?

Dave


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


Re: Struts performance metrics

Posted by Mohan Radhakrishnan <ra...@gmail.com>.
Hi,


        I profiled using JProbe and for a simple 'hello world' jsp I found
that JSTL is taking a little more time than OGNl.

OGNL :

org.apache.jsp.example.HelloWorld_jsp._jspService(HttpServletRequest;
HttpServletResponse)

Cumulative time spent = 1103

-------------------------------------------------------------------------------------------

JSTL

org.apache.jsp.index_jsp._jspService(HttpServletRequest;
HttpServletResponse)

Cumulative time spent = 1429


Thanks,
Mohan


-- 
View this message in context: http://www.nabble.com/Struts-performance-metrics-tp22077072p22118187.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts performance metrics

Posted by Mohan Radhakrishnan <ra...@gmail.com>.
Hi,


        I profiled using JProbe and for a simple 'hello world' jsp I found
that JSTL is taking a little more time than OGNl.

OGNL :

org.apache.jsp.example.HelloWorld_jsp._jspService(HttpServletRequest;
HttpServletResponse)

Cumulative time spent = 1103

-------------------------------------------------------------------------------------------

JSTL

org.apache.jsp.index_jsp._jspService(HttpServletRequest;
HttpServletResponse)

Cumulative time spent = 1429


Thanks,
Mohan


-- 
View this message in context: http://www.nabble.com/Struts-performance-metrics-tp22077072p22118180.html
Sent from the Struts - User mailing list archive at Nabble.com.


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