Deployers Sorting
alrubinger Dec 17, 2009 11:09 AMhttps://jira.jboss.org/jira/browse/JBDEPLOY-230
I've added a stress test:
/** * Stress test to add the specified number of deployers to MC, and * note the amount of time taken */ void stressAddingDeployers(final int numDeployers) throws Throwable { // Get the MainDeployer final Kernel kernel = server.getKernel(); MainDeployer mainDeployer = (MainDeployer) kernel.getController().getInstalledContext("MainDeployer").getTarget(); TestCase.assertNotNull(MainDeployer.class.getName() + " instance was not installed into MC", mainDeployer); // Add Deployers final long start = System.currentTimeMillis(); for (int i = 0; i < numDeployers; i++) { // Install a deployer final Deployer deployer = new AbstractDeployer() { @Override public void deploy(final DeploymentUnit unit) throws DeploymentException { //NOOP } }; final String deployerName = deployer.getClass().getSimpleName() + numDeployers + "-" + i; final BeanMetaDataBuilder bmdb = BeanMetaDataBuilder .createBuilder(deployerName, deployer.getClass().getName()); kernel.getController().install(bmdb.getBeanMetaData(), deployer); } final long total = System.currentTimeMillis() - start; log.info("Adding " + numDeployers + " deployer(s) took " + total + "ms"); }
Output is:
11:02:34,737 INFO [MainDeployerViaBootstrapUnitTest] Adding 1 deployer(s) took 6ms 11:02:35,010 INFO [MainDeployerViaBootstrapUnitTest] Adding 10 deployer(s) took 83ms 11:02:35,305 INFO [MainDeployerViaBootstrapUnitTest] Adding 20 deployer(s) took 136ms 11:02:35,918 INFO [MainDeployerViaBootstrapUnitTest] Adding 30 deployer(s) took 459ms 11:02:37,268 INFO [MainDeployerViaBootstrapUnitTest] Adding 40 deployer(s) took 1088ms 11:02:41,033 INFO [MainDeployerViaBootstrapUnitTest] Adding 50 deployer(s) took 3516ms 11:02:50,794 INFO [MainDeployerViaBootstrapUnitTest] Adding 60 deployer(s) took 9616ms 11:03:13,712 INFO [MainDeployerViaBootstrapUnitTest] Adding 70 deployer(s) took 22740ms 11:04:04,886 INFO [MainDeployerViaBootstrapUnitTest] Adding 80 deployer(s) took 50835ms 11:05:44,774 INFO [MainDeployerViaBootstrapUnitTest] Adding 90 deployer(s) took 99716ms 11:08:45,736 INFO [MainDeployerViaBootstrapUnitTest] Adding 100 deployer(s) took 180761ms
To run, check out the project and run under JDK6. I've also provided a standalone (Main) test harness to ease the process of attaching a debugger. The build will place all runtime libs under target/dependencies (useful for adding to the profiler ClassPath).
S,
ALR