Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiinstance Application architecture and deployment in GlassFish app server

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:

  1. 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)

  2. 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.

  3. 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:

  1. 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.
  2. I need to be able to start/stop each application independently from each other.
  3. 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').
  4. 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

like image 667
odoko Avatar asked Nov 13 '22 10:11

odoko


1 Answers

if you use the GF 3 stack you will notice that this product was refactored to take benefits from the OSGi architecture.. So now you can deploy bundles or even .wab files (web application bundles) in GF3.This architecture will enable you to :

  • manage versions of the different modules
  • to stop/restart applications independently
  • to provide common bundles for your applications avoiding a waste of perm gen space...

But in your question I can't understand how to model different processes with a single Java Virtual Machine.... One Virtual Machine means 1 process (at the OS level) and you can't do anything against that..

The OSGi platform brings you many advantages regarding SLA requirements for your applications and for software modularity... HTH Jerome

like image 95
romje Avatar answered Mar 15 '23 20:03

romje