Increased heap usage with forceVfsJar set

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP) 5

Issue

  • We start JBoss with -Djboss.vfs.forceVfsJar=true and see larger immediate heap usage compared to when this is not set.
  • We see a large amount of heap usage from org.jboss.virtual.plugins.context.jar.NestedJarHandler.

Resolution

  • Increase heap to account for the difference
  • Reduce the number of deployed jars to reduce the VFS overhead and the increase seen with this flag:
    • Slim EAP 5
    • For applications that use the same library version, move any duplicate jars amongst deployments to $JBOSS_HOME/server/$CONFIG/lib/

Root Cause

  • ZipEntryHandler without the flag while JarEntryHandler is used instead with the flag. The size difference is primarily in java.net.URLs allocated by these handlers. ZipEntryHandlers lazily initialize these URLs when they are accessed and used while JarEntryHandlers automatically set their URLS as a part of their constructor. Thus the flag produces larger heap usage seen immediately at start up.

Diagnostic Steps

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.