Is hot redeployment recommended in production for JBoss EAP?

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)

Issue

  • Is it wise to do any hot deployment in production with JBoss?
  • Why hot deployment in production is not recommended in JBoss EAP?

Resolution


Disclaimer: Links contained herein to external website(s) are provided for convenience only. Red Hat has not reviewed the links and is not responsible for the content or its availability. The inclusion of any link to an external website does not imply endorsement by Red Hat of the website or their entities, products or services. You agree that Red Hat is not responsible or liable for any loss or expenses that may result due to your use of (or reliance on) the external site or content.


Deployment (deploying an application after the application server has started) does not cause any problems.

But hot deployment (undeploying and then redeploying the same application while the application server is running) can have the following issues:

  • Hot redeployment can often result in very specific scenarios that haven't been tested before and can be error prone so it's best not to introduce that in production.
  • Depending upon the changes deployed, session data can become conflicted across a cluster, stale, and lead to replication issues.
  • Hot redeployment is prone to leaks since a single dangling reference can cause old classloaders to be un-GC-able, easily leading to heap/perm issues. Especially, PermGen leak with redeployments. Because some applications, application libraries or frameworks don't release references to container class loaders even after the application is undeployed and it leads java.lang.OutOfMemoryError: PermGen space and Metaspace error. A typical example is inappropriate use of ThreadLocal as described in Content from plumbr.eu is not included.How to shoot yourself in foot with ThreadLocals. This kind of PermGen leak cannot be prevented by Java EE application server, thus the only workaround other than fixing a class loader leak in the application is not to use hot redeployment in a production environment.
  • Incomplete deployment might happen with deployment scanning. If an application is copied into the deployment folder in a non-atomic way, the deployment scanner can pick up an incomplete file and the deploy will fail. Note that this particular issue has been resolved in JBoss EAP 6 with the use of deployment marker files.

So the use of hot deployment should be well considered if it should be used in production. If the above risk is accepted and/or covered by application tests it might be able to be used.

But the preferred method would be to shutdown JBoss EAP, put the new deployment in place, and restart.

If it is needed to avoid downtime during this process, manage rolling upgrades as described in What is the recommended approach for doing rolling upgrades in a JBoss cluster

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.