• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How does sturts2 get performance without thread?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sturts2 create action object for each request. it will give thread safe to each request. But how does it give performance?
Thread will create multiple stack for execution. it really good for performance. so it handle multiple request.
But why sturts2 don't have thread.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts is an implementation of the Front Controller Pattern. It is not intended to resolve problems with performance. Managing threads is the job of the application server, so multiple Struts actions (or multiple copies of the same action) can be executed at the same time in an efficient manner.
Saying that threads are "really good for performance" is not true. Creating threads and the resources associated with them is non-trivial and can actually cause bottlenecks. If you are interested in performance, check out our Performance FAQ and our Performance Forum.
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Threading Modal

In struts 1.2 action resources must be thread safe or synchronized, so actions are singleton and thread safe.

There should only be one instance of a class to handle all requests for that action. The singleton strategy places restrictions on what we can be done with struts 1.2. Actions and require extra care to develop.

In Struts 2.0, Actions objects are instantiated each request, so there are no thread-safety issues. In practice, servlet containers generate many throw away objects per request, and one more objet doesn’t impose a performance penalty or impact garbage collection.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic