This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

struts2 thread safety and performance

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys ,
Since struts2 is thread safe and creates new instance per request , how it handle if thousands of requests come at same time i.e thousands of instances.does not it put extra load on the server ??
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saying " Struts is thread-safe" makes no sense - it's perfectly possible to write thread-unsafe applications in Struts, just like it is using every other web framework out there. Struts makes it marginally easier to write thread-safe code compared to servlets through the use of single-request actions, but that's far from the only factor in thread-safety.

Please work through one of the books I pointed you to in the other topic to get an understanding of what the issues in Java concurrency are before you work on systems having large-scale concurrency.
 
Jasvir Rupana
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Burnham ,so you mean to say we should not reply on struts 2 default behaviour which creates new instance per request , instead we should customize our implementation to prevent new instance per request ?
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't change that - it's how Struts works. What I'm saying is that by itself single-request instances do not make a web app thread-safe if you have shared mutable state (and I have yet to see a non-trivial web app that did not have that).
 
Jasvir Rupana
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry but my question is still same , if by default struts creates new instance per request , is it good to go with default struts 2 behaviour ?
 
Beauty is in the eye of the tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic