IAmYourFaja
IAmYourFaja

Reputation: 56944

Multiple components deployed to same application server

Although I'm primarily interested in Java/GlassFish with this question, I would certainly think it applies to any platform/app server.

Is it possible to deploy multiple instances of the same JAR, WAR or EAR to the same GlassFish server, for the purposes of scaling? Meaning, if I have MyApp.ear, and it looks like I need to scale it up to handle a spike in load, can I re-deploy 2+ instances of MyApp.ear inside the same GlassFish server?

Is it practical to do this?

Upvotes: 2

Views: 1789

Answers (3)

Markus Eisele
Markus Eisele

Reputation: 722

this highly depends on your application. In general it's not an issue to have multiple instances of any module, if: - They don't use the same war context and - Don't use same JNDI names for e.g. EJBs.

The question is, why would you do this. Typically you have two options for scaling Java EE applications and servers. Horizontal and vertical. Horizontal refers to having multiple app-server instances on many (smaller) machines. Vertical means multiple app-server instances on the same (bigger) machine. If you look into Java EE scaling and clustering the answer is: You are not going to "scale" (multi-deploy) your app but you are going to scale your app-server instances. There is a good introduction article about clustering with GlassFish here: http://glassfish.java.net/public/clustering31.html Including a detailed look at topology and architecture.

The only reason I have seen people trying to deploy the same app twice or more to one app-server is that they are looking into having different versions running at the same time. There is a GlassFish feature called "Application Versioning". Have a look at the screen-cast here: http://www.youtube.com/watch?v=lgbr_Hywawc But even this feature wouldn't allow you to run them in parallel, but you could have different version deployed to your instances.

Thanks, M

Upvotes: 4

blackcompe
blackcompe

Reputation: 3190

I don't know much about enterprise architecture, but I think it's possible to run two instances in the same JVM. It doesn't scale well though. You might want to consider a distributed architecture.

Upvotes: 0

Ben
Ben

Reputation: 13645

It is definately possible on JBoss atleast so I suppose it also on GlassFish. I wonder however, how would this help with scaling? If you lack performance on a single server, you might want to just look into configuring GlassFish. You can probably tweak the JVM settings to handle the spike loads.

I think to scale a java application you should run it on different servers. You could do this for your entire application or a part of it. (for example if you have a n tier architecture you could have your tiers running on different servers, this will require some or alot of refactoring)

Upvotes: 2

Related Questions