You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Will England <wi...@mylanders.com> on 2001/04/24 17:42:26 UTC

Multiple Unique Instances WITHOUT multiple JVM?

Greetings!

Here's what we want to do:

We want to host our new servlet product as an ASP.  Each customer of ours
would get a unique configuration for the product.  However, all of the
servlets would run from one code base.

We'd have the classes here:

/webhome/classes/com/ourcompany/server/product

and each customer would have their own WEB-INF:

/webhome/customer1/WEB-INF/

Each customers servlets would be mapped like this:

/servlet/customer1/user
/servlet/customer1/inventory
/servlet/customer1/checkout

And the second customer:

/servlet/customer2/user
/servlet/customer2/inventory
/servlet/customer2/checkout

user, inventory and checkout would all point to the same set of classes up
in /webhome/classes.

I know this is simple to do, if you are willing to spin up a new JVM for
each customer / virtual host.  However, with one box and 30 customers,
that'd be right memory intensive.

Questions:

1) Will this even work?  Has anyone done this before?

2) How can we get different config files for each customer without
explicitly referring to them as init-params in the web.xml file?  (we need
to be able to get the config from non-servlet aware classes).

Thanks in advance for any tips; ask me if you need any clairification.

Will

-- 
  "If Al Gore invented the Internet, then I invented spellcheck!"
      Dan Quayle, quoted at the National Press Club, 8/3/1999 
                          will@mylanders.com 
  Recovery  : http://will.mylanders.com/         PCS:  316-371-FOAD 


Re: Multiple Unique Instances WITHOUT multiple JVM?

Posted by David Wall <dw...@myEastside.com>.
> > We want to host our new servlet product as an ASP.  Each customer of
ours
> > would get a unique configuration for the product.  However, all of the
> > servlets would run from one code base.

We tried to do the same thing, as that's rather the point of webapps.  But
we ran into various problems, mostly related to classloader conflicts (3.2.1
and 3.2.2beta).  We unfortunately could not resolve them (JNDI, JMS, JCE
libraries simply refused to work well, despite the fact that all of them
were stored in JAR files in the webapp's WEB-INF/lib directory).  It seems
that somehow those types of services just don't share well in a single JVM,
or tomcat's classloaders were not working well enough to keep everything
segmented.

As it turned out for us, this is a problem from a load perspective, but it
does have some nice parts too.  For example, if your 'customer2' becomes a
heavy user, you can more easily move the configuration from one server to
another.  Also, it may become required that 'customer1' be put on a its own
server for business/political reasons.

Anyway, let me know if you can actually make it work when you use things
like JNDI, JMS, JCE or the like.  It seemed like simple JSP-based webapps
that didn't do much would work, but when they made use of these pluggable
provider-based APIs, things got confused.

David


Re: Multiple Unique Instances WITHOUT multiple JVM?

Posted by Will England <wi...@mylanders.com>.
On Tue, 24 Apr 2001, Sam Newman wrote:

> I think there is a simpler solution. Firstly, have one web app. Secondly,
> have a database (could even be an encyrpted text file) containing user
> information.

That, unfortunately, wont work.  Each customer has many users.  Each
customer also has many proprietary data files that only the users of that
customer can see.  Each customer requires a virtual host
(customer1.ourhost.com).  The codebase is already written based on having
only one customer per machine.  Now the spec has changed, and they want
multple customers per machine.  

Each customer needs custom configuration data read into a class, and the
class may or may not be running under a servlet.

The idea is to put out multiple WEB-INF directories with customer-specific
config data, images, binary files, etc.  Then, have the config set up like
such:


apache config:

<VirtualHost>
ApJServMount /servlet ajpv12://host.server.com:8007/servlet/customer1
</VirtualHost>

<VirtualHost>
ApJServMount /servlet ajpv12://host.server.com:8007/servlet/customer2
</VirtualHost>

and so on, mounting each virtual host to a different entry in the
server.xml on one JVM.

server.xml

<Context  
   path="/servlet/customer1" 
   docBase="/webhome/customer1" 
   debug="0" 
   reloadable="true">               
</Context>

<Context
   path="/servlet/customer2"
   docBase="/webhome/customer2" 
   debug="0" 
   reloadable="true">
</Context>

Each <Context> would have its own unique WEB-INF directory that could
contain the web.xml file and other text files with configuration data.

Is this going to work at all?

Can one JVM manage multiple WEB-INF directories?  

All library classes will be in the main class repository; only config and
binary data will be stored in the WEB-INF directory for each customer.

Thanks again for pointers, tips, etc...

Will



> ----- Original Message -----
> From: "Will England" <wi...@mylanders.com>
> To: <to...@jakarta.apache.org>
> Sent: Tuesday, April 24, 2001 4:42 PM
> Subject: Multiple Unique Instances WITHOUT multiple JVM?
> 
> 
> > Greetings!
> >
> > Here's what we want to do:
> >
> > We want to host our new servlet product as an ASP.  Each customer of ours
> > would get a unique configuration for the product.  However, all of the
> > servlets would run from one code base.
> >
> > We'd have the classes here:
> >
> > /webhome/classes/com/ourcompany/server/product
> >
> > and each customer would have their own WEB-INF:
> >
> > /webhome/customer1/WEB-INF/
> >
> > Each customers servlets would be mapped like this:
> >
> > /servlet/customer1/user
> > /servlet/customer1/inventory
> > /servlet/customer1/checkout
> >
> > And the second customer:
> >
> > /servlet/customer2/user
> > /servlet/customer2/inventory
> > /servlet/customer2/checkout
> >
> > user, inventory and checkout would all point to the same set of classes up
> > in /webhome/classes.
> >
> > I know this is simple to do, if you are willing to spin up a new JVM for
> > each customer / virtual host.  However, with one box and 30 customers,
> > that'd be right memory intensive.
> >
> > Questions:
> >
> > 1) Will this even work?  Has anyone done this before?
> >
> > 2) How can we get different config files for each customer without
> > explicitly referring to them as init-params in the web.xml file?  (we need
> > to be able to get the config from non-servlet aware classes).
> >
> > Thanks in advance for any tips; ask me if you need any clairification.
> >
> > Will
> >
> > --
> >   "If Al Gore invented the Internet, then I invented spellcheck!"
> >       Dan Quayle, quoted at the National Press Club, 8/3/1999
> >                           will@mylanders.com
> >   Recovery  : http://will.mylanders.com/         PCS:  316-371-FOAD
> >
> 



Re: Multiple Unique Instances WITHOUT multiple JVM?

Posted by Sam Newman <sa...@www.stamplets.com>.
I think there is a simpler solution. Firstly, have one web app. Secondly,
have a database (could even be an encyrpted text file) containing user
information.
When a user logs in. You check him against the database to confirm password
etc. You asertain from this which company he works for and you load those
properties. Each servlet's behaviour would depend on the company the user
works for. e.g.servlet A displays page bob.jsp for company bob, but fred.jsp
for company fred. The company properties would be stored in the session
info.
This relies on some decent authentication and session handling stuff, but
makes your life allot simpler. If you want more specific info on tailoring
the content for specific customers, let me know - its a subject close to my
heart (currently anyway!)

sam
----- Original Message -----
From: "Will England" <wi...@mylanders.com>
To: <to...@jakarta.apache.org>
Sent: Tuesday, April 24, 2001 4:42 PM
Subject: Multiple Unique Instances WITHOUT multiple JVM?


> Greetings!
>
> Here's what we want to do:
>
> We want to host our new servlet product as an ASP.  Each customer of ours
> would get a unique configuration for the product.  However, all of the
> servlets would run from one code base.
>
> We'd have the classes here:
>
> /webhome/classes/com/ourcompany/server/product
>
> and each customer would have their own WEB-INF:
>
> /webhome/customer1/WEB-INF/
>
> Each customers servlets would be mapped like this:
>
> /servlet/customer1/user
> /servlet/customer1/inventory
> /servlet/customer1/checkout
>
> And the second customer:
>
> /servlet/customer2/user
> /servlet/customer2/inventory
> /servlet/customer2/checkout
>
> user, inventory and checkout would all point to the same set of classes up
> in /webhome/classes.
>
> I know this is simple to do, if you are willing to spin up a new JVM for
> each customer / virtual host.  However, with one box and 30 customers,
> that'd be right memory intensive.
>
> Questions:
>
> 1) Will this even work?  Has anyone done this before?
>
> 2) How can we get different config files for each customer without
> explicitly referring to them as init-params in the web.xml file?  (we need
> to be able to get the config from non-servlet aware classes).
>
> Thanks in advance for any tips; ask me if you need any clairification.
>
> Will
>
> --
>   "If Al Gore invented the Internet, then I invented spellcheck!"
>       Dan Quayle, quoted at the National Press Club, 8/3/1999
>                           will@mylanders.com
>   Recovery  : http://will.mylanders.com/         PCS:  316-371-FOAD
>


Re: Does mod_jk require 3.2? (was :Re: Multiple Unique Instances WITHOUT multiple JVM?)

Posted by Jeff Kilbride <je...@kilbride.com>.
Nope. With the new <Host> parameter in server.xml, virtual hosting in the
same JVM becomes pretty trivial.

The virtual host examples in the mod_jk HowTo require Tomcat 3.2.1+, I
believe. The <Host> param is new in this version.

Thanks,
--jeff

----- Original Message -----
From: "Will England" <wi...@mylanders.com>
To: <to...@jakarta.apache.org>
Sent: Tuesday, April 24, 2001 7:20 PM
Subject: Does mod_jk require 3.2? (was :Re: Multiple Unique Instances
WITHOUT multiple JVM?)


> On Tue, 24 Apr 2001, Jeff Kilbride wrote:
>
> > Hi Will,
> >
> > Take a look at the mod_jk HowTo at:
> >
> > http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/index.html
> >
> > There's an example virtual host configuration using a single JVM at the
end
> > of the file.
>
>
> No way - I can just mount /webhome/customer1/servlet like that?  No
> aliasing from /servlet/ to http://server:port/servlet?
>
> Whoah.
>
> So, does mod_jk require using tomcat 3.2?
>
> Will
>
>


Does mod_jk require 3.2? (was :Re: Multiple Unique Instances WITHOUT multiple JVM?)

Posted by Will England <wi...@mylanders.com>.
On Tue, 24 Apr 2001, Jeff Kilbride wrote:

> Hi Will,
> 
> Take a look at the mod_jk HowTo at:
> 
> http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/index.html
> 
> There's an example virtual host configuration using a single JVM at the end
> of the file.


No way - I can just mount /webhome/customer1/servlet like that?  No
aliasing from /servlet/ to http://server:port/servlet?

Whoah.

So, does mod_jk require using tomcat 3.2?

Will



Re: Multiple Unique Instances WITHOUT multiple JVM?

Posted by Jeff Kilbride <je...@kilbride.com>.
Hi Will,

Take a look at the mod_jk HowTo at:

http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/index.html

There's an example virtual host configuration using a single JVM at the end
of the file.

Thanks,
--jeff

----- Original Message -----
From: "Will England" <wi...@mylanders.com>
To: <to...@jakarta.apache.org>
Sent: Tuesday, April 24, 2001 8:42 AM
Subject: Multiple Unique Instances WITHOUT multiple JVM?


> Greetings!
>
> Here's what we want to do:
>
> We want to host our new servlet product as an ASP.  Each customer of ours
> would get a unique configuration for the product.  However, all of the
> servlets would run from one code base.
>
> We'd have the classes here:
>
> /webhome/classes/com/ourcompany/server/product
>
> and each customer would have their own WEB-INF:
>
> /webhome/customer1/WEB-INF/
>
> Each customers servlets would be mapped like this:
>
> /servlet/customer1/user
> /servlet/customer1/inventory
> /servlet/customer1/checkout
>
> And the second customer:
>
> /servlet/customer2/user
> /servlet/customer2/inventory
> /servlet/customer2/checkout
>
> user, inventory and checkout would all point to the same set of classes up
> in /webhome/classes.
>
> I know this is simple to do, if you are willing to spin up a new JVM for
> each customer / virtual host.  However, with one box and 30 customers,
> that'd be right memory intensive.
>
> Questions:
>
> 1) Will this even work?  Has anyone done this before?
>
> 2) How can we get different config files for each customer without
> explicitly referring to them as init-params in the web.xml file?  (we need
> to be able to get the config from non-servlet aware classes).
>
> Thanks in advance for any tips; ask me if you need any clairification.
>
> Will
>
> --
>   "If Al Gore invented the Internet, then I invented spellcheck!"
>       Dan Quayle, quoted at the National Press Club, 8/3/1999
>                           will@mylanders.com
>   Recovery  : http://will.mylanders.com/         PCS:  316-371-FOAD
>