Friday, December 4, 2009

Redeployment pain



Did you know that the average turnaround time (for deploy/redeploy) of a typical web application is about 1 minute? This sums up to almost 1 month a year (of pure waste)!
That's a completely insane amount of waste.
And don't forget the effort/time that's necessary to pick up "where we left" when the application is running again after staring at the console for a small while.
So, how can put the redeployment torture to an end?



Deploy the application in exploded format

You can package view templates and other types of GUI resources and just hit "refresh" but it doesn't work for classes so it works partially.

OSGI modules

By dividing the application in smaller modules we can speed up the turnaround time. Less code has to be deployed but still we have to wait and there's a degradation cost.

Web framework class loaders

For example, Seam supports incremental redeployment of JavaBean components. That's pretty nice but it doesn't work for entity classes (plus several other limitations) so it works partially. I think Tapestry does something similar.

JVM Hotswap

Running an application in debug mode you can "reload" changed classes. Works OK as long as you only make changes in method bodies (no new methods, no new fields). On top of that it's too slow so it's not really a solution

JavaRebel

I attended a Devoxx presentation about this product and was impressed. :)

It installs as a JVM plugin (-javaagent) and works by monitoring the timestamp of class files. When it is updated (e.g. when a developer saves a class from the IDE) JavaRebel will reload the changes to class code and structure while preserving all existing class instances.

Check http://www.zeroturnaround.com/javarebel/

I've actually tried this and it works both for JavaBean components and entities. Cool! Of course ot also works for any Java SE application. Goodbye redeployment pain.

For example for JBoss all you have to do is add the following line to run.bat

set JAVA_OPTS=-noverify -javaagent:javarebel.jar %JAVA_OPTS%


And after copying the javarebel jar file to /bin you are ready to start your application and enjoy zero turnaround glory :)

No comments:

Post a Comment