Skip to main content

Multiinstance Appliciation architecture and deployment in GlassFish app server.

7 replies [Last post]
olg
Offline
Joined: 2012-02-07
Points: 0

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.

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tmueller
Offline
Joined: 2005-10-31
Points: 0

Have you considered using application scoped resources with option 3 and
using
disable and enable as a way to stop and start the application?

Application scoped resources:
http://docs.oracle.com/cd/E18930_01/html/821-2417/giydj.html#scrolltoc

Tom

olg
Offline
Joined: 2012-02-07
Points: 0

Tom,

This solution also doesn't help a lot in my case. Enabling resources (jdbc and jms) per instance or per application is only a little part of configuration I need for each customer. For example, deploying my application on multiple instances on one server domain is in fact only one application run on separate jvm's and on other virtual hosts (called 'virtual servers' in GlassFish). I need my solution to be more 'independent-servers' alike.

My solution should be able to process all customers at the same time. All 'customer specific and independent from one another' applications (circa 100) should be deployed and running.

Any other ideas? Is it possible to achieve what I'am trying to achieve on one GlassFish server? I'm stuck here..

Thanks,
Olgierd

tmueller
Offline
Joined: 2005-10-31
Points: 0

On 2/9/2012 2:30 AM, forums@java.net wrote:
> Tom,
>
> This solution also doesn't help a lot in my case. Enabling resources
> (jdbc
> and jms) per instance or per application is only a little part of
> configuration I need for each customer. For example, deploying my
> application
> on multiple instances on one server domain is in fact only one
> application
> run on separate jvm's and on other virtual hosts (called 'virtual
> servers' in
> GlassFish).
I had thought in a previous message that you didn't want to use multiple
instances,
so it isn't clear what you are saying here.
> I need my solution to be more 'independent-servers' alike.
>
> My solution should be able to process all customers at the same time. All
> 'customer specific and independent from one another' applications
> (circa 100)
> should be deployed and running.
> Any other ideas? Is it possible to achieve what I'am trying to achieve
> on one
> GlassFish server?
It isn't clear from this forum thread what your requirements actually
are. There
are many different definitions of "independent", and many possibilities for
different levels of sharing between applications. Typically, with more
sharing you
get more efficient use of resources, but less independence. The
engineering choice
is about what level of sharing vs. independence is appropriate for your
use case.

You mention above that resources are "only a little part of
configuration", but your
original message didn't mention anything else. Do you have a complete
list of
what needs to be per-customer? It isn't possible to say whether
GlassFish can meet
your needs if you don't specify what those needs are.

Tom

> I'm stuck here..
> Thanks,
> Olgierd
>
>
>
> --
>
> [Message sent by forum member 'olg']
>
> View Post: http://forums.java.net/node/883333
>
>

olg
Offline
Joined: 2012-02-07
Points: 0

Tom,
About dependency and sharing requirements in my case:
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 application 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?

Thanks,
Olgierd

hzhang_jn
Offline
Joined: 2005-07-22
Points: 0

This sounds like the multi-tenancy use case that the Java EE 7 spec
defines where different instances of the application will be provisioned
to different tenants with their own customizations.

For now for your use case, the simple solution is probably just to
deploy the application multiple times with different name..

- Hong

On 2/10/2012 5:31 AM, forums@java.net wrote:
> Tom,
> About dependency and sharing requirements in my case:
> 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
> application 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?
> Thanks,
> Olgierd
>
>
> --
>
> [Message sent by forum member 'olg']
>
> View Post: http://forums.java.net/node/883333
>
>

tmueller
Offline
Joined: 2005-10-31
Points: 0

On 2/10/2012 4:31 AM, forums@java.net wrote:
> 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.
one GlassFish instance == a single Java virtual machine == a single Java
process == a single operating system process

That's how the JVM works. This is true for all Java application servers
(not just GlassFish).
The JVM does support running multiple threads within a single process.

> I need to be able to start/stop each application independently from each
> other.
See the:
asadmin enable
asadmin disable
commands. These start and stop 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').
See the:
asadmin undeploy
asadmin deploy
commands. These unload and load an application while other applications
remain active.
> In case of a bug in one application, it should not impact on other
> customer
> apps on the same server/instance.
When multiple applications are running in a single instance, and one of the
applications throws an exception due to a bug, other instances are not
impacted.
Here are some cases where the behavior of one application can impact other
applications:
1. Application behavior triggers an appserver bug causing the app server
to crash.
2. Application behavior triggers an operating system bug causing the app
server to crash
3. Application behavior triggers an operating system bug causing the
operating system to crash.
4. Application goes into an infinite loop, thereby starving other
applications from CPU cycles.
5. Application consumes too much memory, thereby starving other
applications from memory.

With case #3 and #4 and maybe with #5, even if you are running
applications in separate instances on the same
operating system, you still have one application impacting another.
> 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)?
Whether you can support 100 applications in a single instance depends on
how much
memory you have, how big the applications are, how much traffic the
have, etc. But

> Maybe deploying
> application under different names (like described here:
> home.java.net/node/676678) might be a good solution in my case?
Whether this is applicable depends on the nature of your application.
You didn't mention
whether it is an enterprise app (EAR) or just a web application (WAR).
You can definitely
deploy the same application multiple times with different configurations
using different
names, i.e.,

asadmin deploy --name hello1 --contextroot hello1 apps/helloworld.war
asadmin deploy --name hello2 --contextroot hello2 apps/helloworld.war

If using different virtual servers, the context roots do not have to be
different.

Tom

olg
Offline
Joined: 2012-02-07
Points: 0

Tom,

Thanks for Your detailed case study.

At first I thought that maybe there is another solution to this issue, a solution that I haven't considered so far.

Now I know all specifics of possible solutions. I will have to decide and choose one of them.

Olo