Discussions

XML & Web services: Design consideration -Restricting the Number of Concurrent Users

  1. I have an RPC web service which can be invoked by a number of clients. I need to restrict the number of concurrent users for this webservice . An example of the situation could be that - At a maximum of 50 users can access a web service at a given time. What is the best way of implementing this. Any ideas ? I am considering to use either weblogic or Axis with Tomcat
  2. Hi, With the number of concurrent users you mean the number of concurrent requests? Are there other servlets/webservices running in this container that should be unaffected by this limit? If the answers are respectively yes and no the solution seems simple; configure the webcontainer. Tomcat can limit the number of concurrent connections handled by a single http connector (see http://tomcat.apache.org/tomcat-6.0-doc/config/http.html ). By default, a http connector handles a maximum of 40 concurrent requests (set this with maxThreads) and reserves 10 waiting slots (acceptCount) before the connection is refused. The defaults seem to match your requirements pretty close. Similar results can be achieved with Apache as a front-end. If you want more complicated things you could implement a Servlet Filter that limits the number of concurrent requests it chains (passes through), based on your rules. Good luck, Ivor