aspose file tools*
The moose likes Struts and the fly likes Struts 2.0 performance doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2.0 performance doubt" Watch "Struts 2.0 performance doubt" New topic
Author

Struts 2.0 performance doubt

vijay jamadade
Ranch Hand

Joined: May 12, 2008
Posts: 241
Hi Ranchers,

We developed an application using struts 2.0. We have observed that as compared to struts 1.2, Struts 2.0 applications are really slow and has a performance issue.
Please tell me is it true that struts 2.0 has some performance related issues and is unstable. I want to know the experience of you people who have been used this technology so that for upcoming projects we can use it without risk.


Regards, Vijay Jamadade.
( Nothing is Impossible.)
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 688

Hi,

I don't think that Struts 2.0 is slower than Struts 1.3.

This application speed based on so many other factor.


Some other technology used with your project which is not good combination with struts.

Like you used some extra variable in your class file.Some duplicate repeated code, method , some loops which makes your application slow.

That is depend your coding standards and how to optimize your source code.

Make application optimize like remove some unnecessary query fired at every time.

For Example : if your fill your select box in your jsp list which comes from database and that list is static get that list at application context time and make interceptor for that and call that list every time so no need to fire query and remove trip to every time from database.

So, Planning and standards makes your application better fast performance.

My point of view Struts 2.0 is very good than Struts 1.3 .

You can easily get plug-in, easy to understand, zero configuration, rapid development and many more.

So move to some good feature provide by Struts 2.0 and make your application better.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
KRISHNA KK
Greenhorn

Joined: Dec 08, 2008
Posts: 2
Vijay,

I developed a struts2 web application with websphere it gives a better performance, faster, good functionality as compaire to struts1.2

it's better to used struts2.0
- Removed unce. code from your application.
- Used only recommonded interceptors as need.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

See the S2 performance tuning page.

Later versions of S2 are faster because of performance increases, including some in Freemarker and OGNL. Pages with a lot of S2 form tags are usually the culprit in speed-related issues, perhaps somewhat moreso if the OGNL expressions are deeply nested.
vijay jamadade
Ranch Hand

Joined: May 12, 2008
Posts: 241
I want to ask one more thing that the request for struts 2.0 each time goes through the interceptors and filters.If we are not using the functionality then also it loops through all that things.

In struts.xml we always extend the package declarration with



Is it mean that the request for this namespace is going to have default settings though we dont need that but still as it extends it is doing unnecessary things through extending the struts-default.xml file. If it is so can we avoid it improve the performance
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You'll see a very slight performance increase by removing un-necessary interceptors, but very, very slight--IMO not enough to both with.

Some of the interceptors I generally remove, particularly in production, are the "chain" and "profiling" interceptors. I always remove "chain" because I never chain actions. The "profiling" interceptor can be nice during development, but I've found I almost never use it.

If you're not using the model-driven interceptors they can be safely removed. If you never upload files obviously that can come out as well.

Ultimately, however, the biggest performance hits are on the view side relating to the tag templates (helped by extracting them as detailed on the tuning page) and using the most recent versions as possible of FreeMarker and OGNL.
vijay jamadade
Ranch Hand

Joined: May 12, 2008
Posts: 241
but how these things can be done, because when i remove the


extends="struts-default" attribute to avoid struts 2.0 default settings it gives me error at the start of tomcat

can you show me some code snippet in struts xml file how you have done the settings for your application
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Have you read any of the Struts 2 documentation? It covers how to set up your own packages, interceptor stacks, and so on in detail.

Configuration Elements

For an in-depth look at how the struts-default package is configured see this.
vijay jamadade
Ranch Hand

Joined: May 12, 2008
Posts: 241
ok thanks friends.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Struts 2.0 performance doubt