-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------
Nimret Sandhu wrote:
> it seems that jserv creates a new thread to
> run a servlet in even when the servlet has already been loaded and kills it
> when the servlet is finished. is this 'correct' behaviour? arent servlets
> supposed to be loaded once and then 'cached' by the servlet engine?
Servlets are not (or need not be) single-threaded. Under load, it's reasonable
that a number of threads will simultaneous execute a servlet's service() method.
Therefore, JServ is doing the right thing by allocating a distinct thread to
each request.
> interestingly, jrun exhibits the correct (??) behaviour and starts a thread
> *once* when a servlet is loaded and does not kill it after the servlet's
> service() method is done.
My guess is that JRun is pooling threads, ie. returning them to an "recycle"
pool once a request is finished, and re-using them when servicing later
requests. There's been talk about implementing a similar optimization in JServ,
I believe. Try sending two simultaneous requests to a (long-running) servlet ...
you should see an extra thread created.
--
Mike W
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]