You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Alain SMEDTS <al...@hotmail.com> on 2001/08/14 09:31:19 UTC

Running multiple servlet instances

Hi,

some time ago there was a discussion about implementing a cache of instances
for single thread model servlets in Tomcat (just like JServ did). Does
anyone know the latest status, i.e. is someone working on it?

Alain

Re: Running multiple servlet instances

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 14 Aug 2001, Jonathan Cobb wrote:

> Craig R. McClanahan wrote:
> 
> >I don't know of anyone working on it at the moment, although (at least for
> >Tomcat 4) it would be a fairly straightforward exercise.
> >
> I think I have seen support for this in the code (see 
> org.apache.catalina.core.StandardWrapper), but I've also heard that the 
> STM servlet support is not as robust as it could be.  Anyone with more 
> direct (codewise) experience on this care to comment?

There is infrastructure on which to build STM support if you want
it.  But, in effect, the current code keeps a pool size of 1.

Anyone who wants to submit the appropriate patches to configure and manage
a cache of instances is welcome to.

> 
> >Personally, I don't think STM should be encouraged -- it misleads people
> >into thinking they don't have to deal with multiple thread issues, and
> >still runs into scalability problems when you hit the maximum configured
> >number of instances for each given servlet.  But I'd commit a patch to
> >enable this if someone really wanted it.
> >
> While I agree that people should think about threading issues from the 
> get-go, and ideally always use multithreaded servlets, there are always 
> cases where (somehow) large amounts of non-threadsafe servlet code gets 
> written.  When the dev team finally figures out how they've gone wrong, 
> they usually don't want to rewrite the whole app, they just want it to work.
> 
> Of course if you are building a high-traffic webapp you will want to 
> make sure everything is multithreaded, but for many low-traffic apps, 
> single-threaded models (while arguably uglier from a design standpoint) 
> perform just fine.
> 

I've seen lots of people (even on single user web apps) get bit by
simultaneous access to their session attributes.  It's not really an app
architecture issue; it's something that the developer should be aware of
but doesn't tend to think about, because STM seems to promise that those
issues have been dealt with.

>   - jonathan.
> 

Craig


Re: Running multiple servlet instances

Posted by Jonathan Cobb <jo...@covalent.net>.
Craig R. McClanahan wrote:

>I don't know of anyone working on it at the moment, although (at least for
>Tomcat 4) it would be a fairly straightforward exercise.
>
I think I have seen support for this in the code (see 
org.apache.catalina.core.StandardWrapper), but I've also heard that the 
STM servlet support is not as robust as it could be.  Anyone with more 
direct (codewise) experience on this care to comment?

>Personally, I don't think STM should be encouraged -- it misleads people
>into thinking they don't have to deal with multiple thread issues, and
>still runs into scalability problems when you hit the maximum configured
>number of instances for each given servlet.  But I'd commit a patch to
>enable this if someone really wanted it.
>
While I agree that people should think about threading issues from the 
get-go, and ideally always use multithreaded servlets, there are always 
cases where (somehow) large amounts of non-threadsafe servlet code gets 
written.  When the dev team finally figures out how they've gone wrong, 
they usually don't want to rewrite the whole app, they just want it to work.

Of course if you are building a high-traffic webapp you will want to 
make sure everything is multithreaded, but for many low-traffic apps, 
single-threaded models (while arguably uglier from a design standpoint) 
perform just fine.

  - jonathan.




Re: Running multiple servlet instances

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Tue, 14 Aug 2001, Alain SMEDTS wrote:

> Hi,
> 
> some time ago there was a discussion about implementing a cache of instances
> for single thread model servlets in Tomcat (just like JServ did). Does
> anyone know the latest status, i.e. is someone working on it?
> 

I don't know of anyone working on it at the moment, although (at least for
Tomcat 4) it would be a fairly straightforward exercise.

Personally, I don't think STM should be encouraged -- it misleads people
into thinking they don't have to deal with multiple thread issues, and
still runs into scalability problems when you hit the maximum configured
number of instances for each given servlet.  But I'd commit a patch to
enable this if someone really wanted it.

> Alain
> 

Craig