• 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

Maximum allowed Service Instance Limitations

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I'm new to web programming and it is unclear to me whether this is a servlet-container-specific question or a more general Servlet design question.

Anyway, I'm building a web application in which, per usual, RPC are made to a servlet which creates a new thread as a response. However, some of these "response" threads sometimes wait() for an interruption from other java objects in threads that are on the server's JVM (the architecture of the entire project is crazy, but it's not my fault). I seem to have found, however, that using Tomcat there is a limit to the number of such response threads I can have in existence on the server's JVM. The number (for my app at least) seems to be 6. I don't really know if there is a restriction on the number of total threads running on Tomcat's JVM or if there is a restriction on the number of servlet response threads that are allowed to exist per servlet. Could someone tell me about whatever restriction my web application keeps bashing against, and if there is a way to override it in Tomcat configuration xml files? I apologize if this is incredibly basic...I apologize even more if this is not a Tomcat-specific issue...but the help would be intensely appreciated.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't matter. J2EE is designed on a quick-response get in/get out model. You should NOT be attempting long-running processes within a servlet, JSP, or other mainline webapp code. That's per the J(2)EE specs.

If you need results but they will be delayed, you should hand them off to an out-of-line processor. The easiest way to do that is to create a processing engine in the init() method of a servlet. Have the webapp servlets/JSPs queue up requests to the engine and provide services where you can test to see when the results are ready.

Attempting to solve the problem via brute force by overriding the default Tomcat processing thread limits is a solution that simply aggravates the problem, not resolves it. In nigh onto 10 years using Tomcat in all sorts of apps/environments/OS's, I've NEVER had the need to do that.
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic