Nice! We can also extend the activation/deactivation scheme to support one of the following (can be customized via web.xml):
1) Pre-start the node when the web app starts and stop it when the web app stops (what we have today) 2) Lazy-start the node when the 1st HTTP request comes in and stop it when the web app stops 3) Start/stop the node for any given HTTP request (need to figure out how to deal with concurrent requests) 4) Start the node triggered by a HTTP request and stop it when it goes idle for a period Thanks, Raymond ________________________________________________________________ Raymond Feng rf...@apache.org Apache Tuscany PMC member and committer: tuscany.apache.org Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com Personal Web Site: www.enjoyjava.com ________________________________________________________________ On Mar 3, 2011, at 7:59 AM, Jean-Sebastien Delfino wrote: > Hi all, > > Recently I've been experimenting with ways to speed up the bootstrap > of the Java runtime to support mass virtual hosting. > > I thought I'd share my findings here. > > Here's a summary of the use case: > - you're hosting hundreds or thousands of apps, published under > corresponding virtual hosts > - you can't pre-declare, pre-load and pre-start them all > - you need to activate an app when you get a request for it > - and clean up its resources after the request has been processed. > > and the mechanisms I experimented with: > - bootstrap the part of the runtime that's independent of any app, once > - load the app composite on the first request for it > - cache the app composite model > - activate/deactivate its components + start/stop them for each request > - do that for each HTTP request handled by our ServletHost > > The good news is that supporting that only involves a few little > tweaks to our usual runtime node startup sequence. > > I'm planning to share that experiment with the community for review there: > http://svn.apache.org/repos/asf/tuscany/sandbox/sebastien/java/vhost/ > > and hoping to help generate ideas to better address this type of use case. > > I'm really busy at work this week but will try to commit this code > when I find some time over the weekend. > -- > Jean-Sebastien