You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Algis Rudys <ar...@cs.rice.edu> on 2003/07/10 09:09:31 UTC

Soft termination: a demonstration

Greetings --

As I announces about a week ago, as a part of my research, I have
developed a mechanism for terminating individual Tomcat webapps (at the
context level) called soft termination.  For your further enjoyment,
I've taken the liberty of setting up a demo install of my soft
termination system.  The demo install is at: 

http://puppet.cs.rice.edu:8080/

In particular, the following URL runs an infinite loop that prints the
current time each second (note it does this with a "while(true)" and no
sleeps): 

http://puppet.cs.rice.edu:8080/examples/servlet/ExceptionExample

And this URL prints the current system status of the machine in question
(updated once per second):

http://www.cs.rice.edu/~arudys/loadavg.html

Every 10 seconds, termination of the examples webapp is triggered.  Note
that it is triggered by updating the modification date of the
ExceptionExample.class file (forcing a reload which terminates the old
webapp) and not from within Tomcat.

Once again, links for downloading the code and to the journal article
describing soft termination can be found off this site: 

http://www.cs.rice.edu/~arudys/software/#softterm

And feel free to badger me with any questions you see fit.

Enjoy.  Be nice. 

Algis Rudys

-- 
         Algis Rudys        Rice University
     arudys@rice.edu        Computer Science
"Heart has nothing to do with it anymore. It's all in the caffeine."
 -- Frank Pembleton, _Homicide_

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Soft termination: a demonstration

Posted by Remy Maucherat <re...@apache.org>.
Algis Rudys wrote:

> Greetings --
> 
> As I announces about a week ago, as a part of my research, I have
> developed a mechanism for terminating individual Tomcat webapps (at the
> context level) called soft termination.  For your further enjoyment,
> I've taken the liberty of setting up a demo install of my soft
> termination system.  The demo install is at: 
> 
> http://puppet.cs.rice.edu:8080/
> 
> In particular, the following URL runs an infinite loop that prints the
> current time each second (note it does this with a "while(true)" and no
> sleeps): 
> 
> http://puppet.cs.rice.edu:8080/examples/servlet/ExceptionExample
> 
> And this URL prints the current system status of the machine in question
> (updated once per second):
> 
> http://www.cs.rice.edu/~arudys/loadavg.html
> 
> Every 10 seconds, termination of the examples webapp is triggered.  Note
> that it is triggered by updating the modification date of the
> ExceptionExample.class file (forcing a reload which terminates the old
> webapp) and not from within Tomcat.
> 
> Once again, links for downloading the code and to the journal article
> describing soft termination can be found off this site: 
> 
> http://www.cs.rice.edu/~arudys/software/#softterm
> 
> And feel free to badger me with any questions you see fit.
> 
> Enjoy.  Be nice. 

Ok, that sounds cool :)
That kind of tech could add extra robustness to TC. Right now, I don't 
quite undestand how it works, though :-P I'll try to look at it next week.

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Soft termination: a demonstration

Posted by Algis Rudys <ar...@cs.rice.edu>.
On Fri, 2003-07-11 at 01:45, Costin Manolache wrote:
> If I understand correctly, you modify the bytecode to insert checks before
> it loops back ? Pretty cool. I haven't looked too much at the code - do you
> do it via a generic ClassLoader ? 

That is correct.  I modified
org.apache.catalina.loader.WebappClassLoader and
org.apache.jasper.servlet.JasperLoader to rewrite classes loaded by
these class loaders while the as a part of the class loading process.

> Are you interested to contribute this to tomcat, or it's just a demo ? 

I am interested in contributing this to Tomcat.  The code is not quite
suitable for production, however, and would take a little bit of work to
get there.  Also, as I noted in the docs, JikesBT (the bytecode
rewriting toolkit I used) is not freely redistributable, which might
mean the code needs to be ported to some other system.

> I'm wondering if the JVM itself wouldn't be a better place to implement
> this functionality ( i.e. a safe implementation of Thread.stop() )

There are a couple of reasons we did it this way:
(1) If soft termination is implemented in the JVM, then you would have
to use the particular implementation of JVM that has this feature, or
you don't get the feature.  The code that I have, on the other hand,
doesn't need to wait until a commercial JVM has this feature
implemented.
(2) Soft termination has some nice semantics that lend themselves to
being implemented with bytecode rewriting. In particular, when a webapp
is terminated, an exception is thrown which effectively cannot be caught
by the webapp but can be caught by the dispatcher in Tomcat (allowing
Tomcat to deal with the exception relatively cleanly). A JVM
implementation would require a little bit of work to get the same
semantics.
(3) Note that soft termination doesn't terminate threads, it terminates
classes, so Thread.stop() is not an accurate analogue; a better one
would be a hypothetical Class.stop() or ClassLoader.stop().

> Costin

Cheers,
Algis R.

-- 
         Algis Rudys        Rice University
     arudys@rice.edu        Computer Science
"Heart has nothing to do with it anymore. It's all in the caffeine."
 -- Frank Pembleton, _Homicide_

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Soft termination: a demonstration

Posted by Costin Manolache <cm...@yahoo.com>.
If I understand correctly, you modify the bytecode to insert checks before
it loops back ? Pretty cool. I haven't looked too much at the code - do you
do it via a generic ClassLoader ? 

Are you interested to contribute this to tomcat, or it's just a demo ? 
I'm wondering if the JVM itself wouldn't be a better place to implement
this functionality ( i.e. a safe implementation of Thread.stop() )

Costin

lgis Rudys wrote:

> Greetings --
> 
> As I announces about a week ago, as a part of my research, I have
> developed a mechanism for terminating individual Tomcat webapps (at the
> context level) called soft termination.  For your further enjoyment,
> I've taken the liberty of setting up a demo install of my soft
> termination system.  The demo install is at:
> 
> http://puppet.cs.rice.edu:8080/
> 
> In particular, the following URL runs an infinite loop that prints the
> current time each second (note it does this with a "while(true)" and no
> sleeps):
> 
> http://puppet.cs.rice.edu:8080/examples/servlet/ExceptionExample
> 
> And this URL prints the current system status of the machine in question
> (updated once per second):
> 
> http://www.cs.rice.edu/~arudys/loadavg.html
> 
> Every 10 seconds, termination of the examples webapp is triggered.  Note
> that it is triggered by updating the modification date of the
> ExceptionExample.class file (forcing a reload which terminates the old
> webapp) and not from within Tomcat.
> 
> Once again, links for downloading the code and to the journal article
> describing soft termination can be found off this site:
> 
> http://www.cs.rice.edu/~arudys/software/#softterm
> 
> And feel free to badger me with any questions you see fit.
> 
> Enjoy.  Be nice.
> 
> Algis Rudys
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org