0

In our organization we have like 20 grails apps (from 1.3.6 to 2.2.4) each deployed in an independent jboss server, but sometimes it feels like overkill because our user count is not really big (10-100 users for each app) so I was thinking in deploying 3 to 5 (maybe more?) apps in one server, given that, would it be good to share common jars?

I know this is possible as shown in How to deploy multiple applications in Tomcat, share jars and have different datasources?, but I want to know if this is a good practice for reducing the amount of servers needed without affecting performance.

If it is so, what else should I take into account to do it correctly?

Community
  • 1
  • 1
nardhar
  • 15
  • 1
  • 3

1 Answers1

0

You have multiple issues here. You don't need to deploy each application in an independent app server instance. Multiple applications can be deployed under one app server instance with different context names. Your application jars should go under WEB-INF/lib of the application. Then each application gets its own classpath with those jars. Each application can have its own versions of the jars which will not conflict with any other application's jars. This is the recommended deployment practice.

Only really shared jars like database drivers should go under application server's lib directory - mainly because it is outside the application's control. Your app server admin and DBA should be able to upgrade the driver whenever they need to do it independent of any specific app.

It is not a good idea to share the application jars - unless you are very sure that all the application life cycles match. What I mean by that is - you should never get into a situation where one application needs a different version of the jar compared to others. All the applications should change together. Only then you can share the application jars.

Having said that - my recommendation is to avoid sharing jars because sooner or later you will end up in that problem because one of the apps will move ahead of others.

RaviH
  • 3,544
  • 2
  • 15
  • 14
  • Thanks so much, I will try deploying without sharing jars, some years ago i did it with two apps, but got some errors about permgen space, maybe some configuration about jboss we missed back then. – nardhar Jun 08 '14 at 17:08
  • Today's web apps use many jars. Webapps using technologies like Grails use hundreds of jars! Therefore you have to provide enough permgen space for the JVM running these webapps. I will say begin with 125 MB per webapp and increase it further if you get permgen errors. – RaviH Jun 09 '14 at 02:23