You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nikolic Branislav <ni...@niki.at> on 2001/08/01 01:03:38 UTC

AW: How to ensure Tomcat to load multiple instances of a servlet, to handle simultaneously multiple request ?

UNSUBSCRIBE!!!

-----Ursprüngliche Nachricht-----
Von: Greg Trasuk [mailto:stratuscom@on.aibn.com]
Gesendet: Dienstag, 31. Juli 2001 23:08
An: tomcat-user@jakarta.apache.org
Betreff: RE: How to ensure Tomcat to load multiple instances of a
servlet, to handle simultaneously multiple request ?


	How are you handling the database connections?  JDBC drivers are required
to be re-entrant, but not necessarily concurrent.  What this means is that
if you have multiple threads trying to use the same Connection object, then
a query from thread B will wait until the query from Thread A completes.
You need to either open a new connection for each request (which can be very
slow) or use a connection pool.

	To test whether this is problem, comment out the database accesses in your
servlet and simply place a Thread.sleep(10000) in the service method, then
see if you still get this serialized behaviour.

Cheers,

Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca

-----Original Message-----
From: grégoire nogier [mailto:nogier@free.fr]
Sent: Tuesday, July 31, 2001 5:41 AM
To: tomcat-user@jakarta.apache.org
Subject: How to ensure Tomcat to load multiple instances of a servlet,
to handle simultaneously multiple request ?


How to ensure Tomcat to load multiple instances of a servlet, to handle
simultaneously multiple request ?

I'v developed a servlet application in tomcat/apache, on NT.
I tried a very simple load test :
   - 1) from a first pc, I send a request which neeed a very long database
access (3 minutes),
   - 2) from another pc, I send a very simple request (which should be
traited immediately)
   => the result is that the second request wait 3 minutes before receiving
its response. The requests are served the one after the other.

I'm not sure to understand how tomcat works, but I imagined that it should
be possible to load multiple servlet process, to handle 20 request
simultaneously.
It seems not.

- should I duplicate the servlet in the file web.xml ?
- should I duplicate the servlet context ?
- should I define more workers ? (how to ?)
- should I use some other connector, or RequestInterceptor ?

Here is a short description of the configuration used :
- tomcat-v3.2.2, apache-v1.3
- the Servlet implements SinglethreadModel,
- the file : mod_jk.conf mount the servlet-path with the ajp13 worker,
- the file : server.xml defines a PoolTcpConnector Ajp13ConnectionHandler
(parameters are: max_threads=50, max_spare_threads=25,
min_spare_threads=10),
- the file : workers.properties defines two workers
(worker.list=ajp13,loadbalancer)
- the file : web.xml defines two servlet (only one seems to be used...)

I need some help !

Gregoire Nogier