Adam Bien's Weblog
Java EE 6 Kills The WAR-Bloat - The KiloByte Deployment
The beauty of Java EE is the lack of libraries and JARs which have to be deployed with your project. Everything you needs resides already on the server. This makes your WARs / EJB-JARS / EARs extremely lean. They only consists of your compiled classes - the actual business logic. There is no need to deploy anything, because the frameworks (JPA implementation, EJB container, JSF implementation, REST implementation, JMS / JDBC-drivers) are already installed on the server. The last time I pushed some examples to: http://kenai.com/projects/javaee-patterns/. The size of the deployment units were:
- BeanLocatorTest.war - 16 kB
- FireAndForget.war - 8 kB
- DAOPattern.war - 29kB
- ResourceBinder.war - 8kB
Java EE 6 deployments gets even leaner, than Java EE 5 because REST implementation, Bean Validation, DI extensions (JSR-299, JSR-330) etc. are already part of the spec.
Small deployment units makes the deployment cycle really fast. With Glassfish v3 and incremental deployment of a EJB, Interceptor, JPA-Entity, JSF backing bean takes in general < 10 ms. The full deployment takes at most few seconds.
It seems like some developers are concerned about the size of the server. I prefer small deployments and actually don't care very much about the size of the server. Although Java EE 5/6 servers became surprisingly small. The EJB container in the newest Glassfish v3b71 build is still < 1 MB.
Small deployment units are good for short deployment times - furthermore you don't have to deploy the same stuff over and over again in your WARs.
Special Events: Java 8 with Java EE 7: "More Power with Less Code", 13th October, 2014 and Java EE 7: "Testing and Code Quality", 14th October, 2014 Tweet Follow @AdamBien