A WebArchive (WAR) deployment in Java EE 6 is productive (you have to zip only once), simple (there is only one project in the IDE) and powerful enough for most use cases. However, with an Enterprise Archive (EAR) you can group multiple WARs together and deploy them at once as a logic unit--an application.
There is no hierarchical WARs, so you will have to invent some naming conventions to express application membership.
Usually you would like to have the highest possible isolation between applications. The easiest possible approach is to use an entire server to host a single application. A concept of domains (in Glassfish case) or logical servers would suffice as well. With a domain named after the application and containing only a single application you get additional benefits as well:
- Each server runs in an isolated JVM. Classloader interferences between the applications are impossible.
- You can easily upgrade a single application without affecting the others.
- An application can demand more heap, than on a shared server.
- CPUs / cores are better utilized. Multiple JVMs scale better than a single one.
- A server per application is easier to manage: there is clear relation of monitoring data, logs and bandwidth to an application
- Throttling is easier to implement.
- A single application can be deployed in multiple versions at once.
- If one application dies, the others will still run.
- A security of one application not necessarily has to affect the others.
There is of course also a drawback: an application server instance comes with ~100MB overhead. With the deployment of ten applications comes about 1 GB of wasted RAM (~50 Euros :-))
See you at Java EE Workshops at MUC Airport!
NEW online workshop: WebStandards Igniter (online)