• 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

handling multiple requests for a servlet

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can somebody please explain me how to handle multiple requests for a servlet considering the following scenario,
1. Consider that the web server recieves more requests and the maximum number of threads(configured in xml) running in the server has crossed the limit.
2. consider that each thread will take more than 5 minutes to complete the process.

In the above scenario, whether all other clients requesting the server should wait? or is there way to avoid this apart from clustering and load balancing?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


2. consider that each thread will take more than 5 minutes to complete the process.


This would not be good design for any web app. Anything over a few seconds response time would have users complaining I think. What is it you do that takes so long? Could you do it asynchronously?


or is there way to avoid this apart from clustering and load balancing?


Long response time aside, if you are hitting the maximum load a servlet container can handle, you would need to look at spreading the load accross more nodes. This would normally mean clustering or load balancing.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi sat gane welcome to Javaranch,
are you sure your application will get that many simultaneous hits so as to cross the thread limit?
If yes then as Paul said, you need load balancing.

Also I think it will be a good idea to minimize the thread time.
 
satya ganesh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,
Thank you for your reply.. suppose if there is some functionality like uploading some file (that is of huge size). And many users are concurrently uploading file (job sites for instance, where more than hundreds of canditates are uploading their resume concurrently) and the uploads take more time.
In this scenario, can you please throw some light on how the server will do the process?
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The server will process the request in the same way as it would process any request. If there is not a free thread in the thread pool, the client will have to wait. And you would avoid this scenario by performance testing your application with an accepted load, and configuring thread pools/using load balancing as appropriate.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Consider using Amazon's S3 service to accept the large download traffic. Here is a recent article on a practical application to reduce server traffic. That way you avoid having to invest in any new server hardware.

Your system would then be able to access the files at leisure.

Bill
reply
    Bookmark Topic Watch Topic
  • New Topic