Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Controlling servlet instances

 
B Mampilli
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
If I have a servlet by the name of HelloServlet.java, normally only one instance of this servlet would handle all the client requests. If the number of requests made to this servlet is very high, then where do I specify that there should be 5 instances of this servlet on the server side handling the client request?
Do I specify this in the web.xml or in the server.xml or somewhere else?
Boney
 
Howard Kushner
author
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically you don't. How high is very high? If very high means like thousands or tens of thousands of requests per second then scale the runtime architecture. Did I misunderstand something in your original question? You don't generally want more than a single instance of a servlet in any given web container. That's what threads are for.
 
B Mampilli
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, something like a 10000 requests per second...
Something like a servlet for database access or something..
in that case i feel that having multiple servlet instances would help...
You said that we should scale the runtime architecture. How do we do that??
some friends told me that there is some specific tag that needs to be specified in the web.xml or server.xml.... is there anything like this??
or is the instance creation completely server implementation dependent?? and the programmer has no control over that..
Please clarify..
Boney
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You said that we should scale the runtime architecture. How do we do that??
cluster
some friends told me that there is some specific tag that needs to be specified in the web.xml or server.xml.... is there anything like this??
the only one I can think of is <distributable/> tag. Ask your friends and let us know .
 
B Mampilli
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cluster??? meaning??

friends dont know...
 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If you find that the number of requests are more then go for Server clustering which will take care the load balancing. The basic idea is two or three managed servers will be administrated by one Administration Server which will redirect the servlet request depends on the loads to the various server. Just check your application server manual for this Server clustering details.
On the other hand if you use 5 servlet instances how will handle the transaction and other details.
Regards,
M.S.Raman.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic