jQuery in Action, 2nd edition*
The moose likes Struts and the fly likes In the war b/w Struts 2 vs Struts1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "In the war b/w Struts 2 vs Struts1 " Watch "In the war b/w Struts 2 vs Struts1 " New topic
Author

In the war b/w Struts 2 vs Struts1

rajesh vasireddy
Greenhorn

Joined: Jun 06, 2009
Posts: 18
All people are saying Struts has performance issues as the FiterDispatcher (Contoller) creates a new action class object for every new request from a web client.
But in struts official website at Struts Offical Website

They said "Struts 2 Action objects are instantiated for each request, so there are no thread-safety issues. (In practice, servlet containers generate many throw-away objects per request, and one more object does not impose a performance penalty or impact garbage collection.) "

The red colored lines say it is not a problem but most of the people say it has problem.

So please real time struts developers in the world who have worked both on Struts 1.x and 2.x please say exact truth to world whether really struts has performance problems due to this aspect.

Thanks in Advance.
Orton K Randy
Ranch Hand

Joined: Aug 12, 2011
Posts: 41

Been using Struts 1.2 before we switched to Struts 2 in my project. From my personal experience, I had NEVER wanted to go back to Struts 1.x. True that Action class is instantiated per request(which you can easily test), and hence thread safe, but they're spot on with the red text in your quote. I don't buy this story of instantiating an Action class for every request degrading performance. At least, we didn't encounter any such performance setbacks.


Coderanch, best ever forum on the net. Hands down.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18715
    
    8

Of course there is no such thing as "exact truth" about whether some programming practice is a "problem" or not. That's like asking for the "exact truth" about whether 125 metres is a "long distance".

In my opinion the sentence you quoted in red letters is correct. If you have an application where the response time requirements are so stringent that you can't afford a millisecond to create an object, then you really shouldn't be using a framework like Struts anyway. But chances are you don't have such an application. Chances are that you don't even have published response time requirements. Chances are that these people talking about "performance issues" haven't even measured any performance measures.
rajesh vasireddy
Greenhorn

Joined: Jun 06, 2009
Posts: 18
if we increase heap size at server side will there be any change of performance. I am thinking this as if my webapplication got 1000 requests at a time then if i am using struts 2.x then there may be memory problems. So wil der be a change if i inc my heap size.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18715
    
    8

It's possible, yes. Depending on what you mean by "performance". Have you measured something and decided it's too small, or too large? Just picking on random things and trying to "fix" them by changing something isn't necessarily going to help your problem, if you even have one.
 
Consider Paul's rocket mass heater.
 
subject: In the war b/w Struts 2 vs Struts1