DESCRIBE phase - Dependency builders for MC Beans
jaikiran May 11, 2009 1:52 PMWhile looking into the deployment timings issues, i noticed that any MC bean that gets deployed spends (relatively) considerable amount of time during the DESCRIBE phase. A bit of debugging reveals that the DescribeAction relies on a dependency builder which is configured at the kernel level:
org.jboss.kernel.plugins.dependency.DescribeAction: DependencyBuilder dependencyBuilder = config.getDependencyBuilder(); KernelMetaDataRepository repository = controller.getKernel().getMetaDataRepository(); MetaData md = repository.getMetaData(context); // add custom dependencies (e.g. AOP layer). List<DependencyBuilderListItem> dependencies = dependencyBuilder.getDependencies(info, md);
By *default* the dependency builder is set to AOPDependencyBuilder
KernelConstants:
static final String DEPENDENCY_BUILDER_DEFAULT="org.jboss.aop.microcontainer.integration.AOPDependencyBuilder:org.jboss.kernel.spi.dependency.helpers.AbstractDependencyBuilder";
This AOPDependencyBuilder uses an AspectManager to try and apply any AOP bindings to *all* MC beans that get deployed:
* Finds all managed aspects that apply * to the bean and includes their dependencies as dependencies of the bean * public class AOPDependencyBuilder extends AbstractDependencyBuilder {
Effectively this dependency builder does AOP stuff by applying bindings defined in litterally every *aop-beans.xml in the server. Aspects/bindings defined in AS/common/lib/jboss-messaging.jar are also picked up. Overall, every MC beans goes through this AOPDependencyBuilder and (expensive) AOP stuff is carried out on these MC beans. But from what i see, most of the MC beans being deployed don't rely about this AOPDependencyBuilder to generate the dependencies. Atleast EJB3 container deployment MC beans don't rely on this. I hacked into this component to ensure that this is not a default dependency builder and was able to boot most of the AS (expect i think the webserver deployment, iirc) without issues, which means that *not* having this as the default dependency builder probably is a better option.
Given the way, this dependency builder is currently picked up (it's picked up from the KernelConfig which corresponds to the Kernel), i found no way of configuring a different dependency builder (which just returns null on the lines of org.jboss.kernel.spi.dependency.helpers.AbstractDependencyBuilder) for the EJB3 MC bean deployments. Changing the default is going to affect other (few) deployments.
1) Can the AOPDependencyBuilder be removed as the default
2) Currently this is a kernel level property. Can this be made per bean/context level property (by default set to org.jboss.kernel.spi.dependency.helpers.AbstractDependencyBuilder) so that each MC bean context can override this if required? Whichever MC beans need this AOPDependencyBuilder currently in the AS can then be switched appropriately.
3) This is not directly related to this issue - But any reason why the configs defined in jar files under AS/common/lib (aop-messaging-client.xml and aop-messaging-server.xml) are being parsed? I did not debug much into this part.
Just to see how much improvement this change, might bring in to (EJB3) deployments, i hacked the AOPDependencyBuilder to skip the AOP stuff for org.jboss.ejb3.* MC deployments. My sample application which was taking 20 seconds to deploy. now takes 15 seconds - still on a higher side but there's a 25% improvement by this one single hack.