Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [S2] The performance issue about OGNL

Shuai Zheng

2007-02-27

Replies:

Dear All,

Thanks very much for useful help.

Just fight with this for 24 hours and get some improvement.

I want to apology first because I am so stupid. Last evening I do a
profiling again. The OGNL is not the main bottleneck, but it is still a
problem.

My previous page loading is around 3-5 seconds. Now it is around 1-2
seconds.

First of all, when I saw Vlad's email, I copy out the template and delete
the original from struts-core.jar. It looks well (but I forget to compare
the timing, later i will do it again)

Then I rewrite the page again and enable the DEBUG in log4j to trace it.

Something what I found:
struts.configuration.xml.reload: this parameter in the properties file will
give another 0.3 second to loading time in my case (it is so bad, that I
think it should be mentioned in the document that this feature should be
disabled in production, because you know, in struts.properties of showcase,
it is enabled.).

There is a list in my page, which includes around 800+ items, I want to show
them in a select list. Previously I get it from database by Hibernate and
directly pass it to the component, this will cause 1 second to finish
construct this select component.
    <s:select
       list="prodList"
       multiple="true"
       listKey="idkey"
       listValue="prodName"
       />
Now I loop it in the class and convert it into a Map<String, String>, then
pass the map to the select, it get around 1 second faster.

Regards,

Zheng Shuai

On 2/26/07, Vlad2006 <VladKravchenko@(protected):
>
>
> Hi Zheng,
>
> Have you profiled your application? Are you sure it is OGNL that makes
> your
> application slow?
>
> From my experience it is not so slow. At least I have not found it too be
> a
> bottleneck in my application. Not yet :-).
>
> What is really slow in WebWork/Struts2 is jsp tags like, textfield, radio,
> anchor, and other which are using FreeMarker templates.
>
> If it is your case, you could make it faster, you have to extract
> templates
> out of webwork.jar (in your case probably struts.jar) and put them in, for
> example, WEB-INF/templates directory.
> There is a page on WebWork Wiki about it:
> http://wiki.opensymphony.com/display/WW/Performance+Tuning
>
> I am not using Struts2 yet, but I believe most of the tips will work for
> Struts2.
>
> One more thing that could make application slower is when resource bundles
> are constantly reloaded. It is good for dev but not acceptable for
> production. Check in struts property like: webwork.i18n.reload=false
>
>
> Best regards
> Vlad
>
>
>
> Shuai Zheng wrote:
> >
> > Dear All,
> >
> > I am using struts 2.0.6, but honestly the performance is very bad (not
> > need
> > to think about scalability), to speed to load a simple page is much
> slower
> > than pure JSP (I haven't compared with struts 1). To refresh one page it
> > is
> > 3-5 seconds with only one user. The profiler tells me the OGNL is the
> > bottleneck.
> >
> > I notice that there are some complains on OGNL about the performance
> > already, may I know any other way to replace OGNL with anything else to
> > get
> > a faster speed? Currently the speed is not acceptable for production.
> >
> > Regards,
> >
> > Zheng Shuai
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/The-performance-issue-about-OGNL-tf3291137.html#a9157447
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
©2008 junlu.com - Jax Systems, LLC, U.S.A.