1

Our team had a violent discussion whether we should put multiple WAR apps into the same JavaEE server (such as Tomcat, JBoss, Websphere).

For same JavaEE server, coz

  • Share the same resources (CPU, memory, TCP Port) of the same server
  • Able to share session such as enabling Single Sign On easier
  • Same JVM, able to access JVM internal resources
  • maintainability as managing only one server

For multiple JavaEE servers, coz

  • Lower risk. When one server is down if not related to OS or hardware level failure, both WAR apps turn down too.
  • Clear deployment. One app is deployed to one server. The whole thing can be packaged together as one (such as single TAR). It is easier and independent to backup and restore again without affecting another.
  • Able to dedicate certain resources. If one WAR app is more important than the other, then its JavaEE server should be allocated with more heap size while another is allocated less.
  • JavaEE server's overhead is not too large as hardware cost is low. No need to share the same resources.
  • If two WAR apps are in the same main domains, still able to share session such as enabling Single Sign On by Cookie.
  • Different WAR app should run on separated JVM to prevent from illegal accessing
  • maintainability as managing only one server

I know there was a similar post at Deploying multiple web apps in same server but that was not detailed enough.

Are there more arguments to support or oppose the practice? Which practice is industrial standard? Please kindly share your opinions.

Community
  • 1
  • 1
Stanley Stein
  • 397
  • 1
  • 3
  • 17

1 Answers1

1

Its not worth a violent discussion :)

The answer, as usual, is it depends on the requirements your applications have on resources, availability etc. There is no one size fits all answer or best practice. If you can articulate your requirements in your question then we can give specific pros/cons to each of them.

However, to your point about sharing TCP ports, many servers have the concept of domains which create individual contexts for resources like ports, JDBC connection pools etc. You can deploy WARs to different domains and they will get unique ports, context root, and other resources but all still share the same application server instance.

NBW
  • 1,467
  • 2
  • 18
  • 27
  • It was strongly asked to run two separated JavaEE servers on the same hardware because if one is down or rebooted, the other is still alive. Does it make sense? Is it industrial practice? – Stanley Stein Dec 05 '14 at 06:38
  • 2
    It's typically more then just the JavaEE application servers that come in to the availability equation (which is the crux of your question). If your application needs other resources like DB, JMS, E-Mail, etc then you need to factor those in as well. As for JavaEE, one common solution is to use a cluster for high availability. With a cluster you can still have one or more application domains and if one server fails the others can fail over things like active user sessions and DB transactions. If you simply have 2 separate servers you won't be able to fail over things like active user sessions. – NBW Dec 05 '14 at 14:01
  • The level of availability you need to guarantee is a business decision not a technical one so I would drive the discussion starting with that and let that lead you to the technical implementation that meets those needs. – NBW Dec 05 '14 at 14:03