I need to setup a hosting environment for around 100 customers per one GlassFish server (v 3.1). Each customer needs custom configured application that can be run independently from each other. (JDBC, JMS, possibility to restart single app) Running single virtual machine would be preferred, as launching 100 JVMs each using 750MB of RAM doesn’t sound like a good idea.
So far I have tested the following solutions, but unfortunately, neither of these has met my requirements:
Deploying application on separate Domains. This solution was insufficient because of JVM Ram usage and complexity of running multiple management consoles on multiple ports (we don’t need that much separation)
Deploying application on multiple instances (named targets on Glassfish) on the same domain. This solution was insufficient because it creates separate JVM process for each instance and consumes too much RAM (several hundred MB for each instance). Otherwise it was closest to what we need.
Deploying application on multiple virtual hosts on the same instance. This solution was unacceptable because in Glassfish each virtual server doesn't have a separate configuration.
Can anyone suggest what is the best practice / recommendation for using GlassFish to host multiple application instances? Are we “doomed” to reserve 1GB of ram per customer? Coming from IIS environment, we had separate Application Pools each using 3-5MB of RAM at startup.
UPDATE
About my dependency and sharing in my app: In the idea I want to realize on Glassfisf server, each application needs separate resources (JMS and JDBC). This is not a problem, I can customize it per application even per virtual hosts enabled on one instance (I can recognize the virtual server by getting server name from Http Request and prepare separate resources and configuration files in instance directory to apply configuration to this specific virtual server).
My 'independency requrements' are:
- I simply need to be able to deploy multiple applications on one Glassfish instance and be able to run them in separate Java processes but under the same Java virtual machine.
- I need to be able to start/stop each application independently from each other.
- I need to be able reload one application and the other while the othe applications should remain active (under IIS this option is called 'recycle application pool').
- In case of a bug in one application, it should not impact on other customer apps on the same server/instance. Other applications shoud remain working (of course when this bug doesn't spoil entire java vm).
Is this idea possible to be realized on one Glassfish instance with hundred applications deployed (enabled on instance/virtual host)? Maybe deploying applications under different names (like described here: home.java.net/node/676678) might be a good solution in my case? Does anybody have an experience in deploying one hundred times the same application with different configurations that way?
Thanks,
Olgierd