Version 5

    Since I've had to slim down jboss more than once for performance and some bit of hardening, I thought I would share the steps I use that will support most applications that are NOT using EJB or Jboss MQ. This configuration is mostly for base spring related applications or sars, etc...

     

     

    First off, the tuning will be based on the following:

    • Removing Mail, since most applications don't use jboss mail
    • Removing Jboss messaging
    • Removing scheduling and hibernate
    • Removing HSQL db
    • Removing bsh shell deploy options
    • Removing some of the remote transaction management
    • Removing EJB3 related configurations (note: non-ejb3 ejb settings are needed for services, so those are kept)
    • Removing Client deployment options (ejb related stuff)
    • Tuning hot-deployment to be off

     

     

    Current Directory: server/<node>/conf/

    Ok, let's start with the server/<node>/conf/ directory.

    File updates: server/<node>/conf/jboss-service.xml

     

    In the jboss-service.xml file, update the following:

         LocalJbossServerDomain section to have nothing but the following:

     

    <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
          name="jboss.management.local:j2eeType=J2EEDomain,name=Manager">
          <attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>
          <attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>
          <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>
          <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>
          <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>
          <attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>
          <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>
          <attribute name="JNDIService">jboss:service=Naming</attribute>
          <attribute name="JTAService">jboss:service=TransactionManager</attribute>
          <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>
       </mbean>
    

     

    The above will remove the client deployer and the beans deployer from the services in jboss. We need the ClientUserTransaction for any Platform transactions that are used in spring. Example spring configuration taken advantage of user transactions:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
        default-autowire="byName">

             <tx:jta-transaction-manager/>

    </beans>

     

    Next, update the logging section (the refresh rate to be longer):

    <mbean code="org.jboss.logging.Log4jService"
          name="jboss.system:type=Log4jService,service=Logging"
           xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml">
         ....
    
      <attribute name="RefreshPeriod">60000</attribute>
    </mbean>
    

     

    Remove the RMI Classloading section as shown below:

    <mbean code="org.jboss.util.property.jmx.SystemPropertyClassValue"
          name="jboss.rmi:type=RMIClassLoader">
          <attribute name="Property">java.rmi.server.RMIClassLoaderSpi</attribute>
          <attribute name="ClassName">org.jboss.system.JBossRMIClassLoader</attribute>
       </mbean>
    

    Remove the web service settings:

       <mbean code="org.jboss.web.WebService"
          name="jboss:service=WebService">
          <!-- The Bind address and Port -->
          <attribute name="BindAddress">${jboss.bind.address}</attribute>      
          <attribute name="Port">8083</attribute>
          <!--  The address to use for the host portion of the RMI codebase URL -->
          <attribute name="Host">${java.rmi.server.hostname}</attribute>
          <!-- Should non-EJB .class files be downloadable -->
          <attribute name="DownloadServerClasses">true</attribute>
          <!-- Should resources other than .class files be downloadable. Both
             DownloadServerClasses and DownloadResources must be true for resources
             to be downloadable. This is false by default because its generally a
             bad idea as server configuration files that container security
             information can be accessed.
           -->
          <attribute name="DownloadResources">false</attribute>
    
          <!-- Use the default thread pool for dynamic class loading -->
          <depends optional-attribute-name="ThreadPool"
             proxy-type="attribute">jboss.system:service=ThreadPool</depends>
       </mbean>
    

     

    Update the deploy settings to remove hot-deploy options:

     

       <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
          name="jboss.deployment:type=DeploymentScanner,flavor=URL">
           ......
    
    
    <attribute name="ScanEnabled">false</attribute>
       .....
       </mbean>
    
    
    

     

    Current Directory: server/<node>/lib/

    Next let's cleanup the lib directory a bit by removing the following classes:

     

    • scheduler-plugin-example.jar
    • scheduler-plugin.jar
    • quartz.jar
    • mail-plugin.jar
    • hsqldb-plugin.jar
    • hsqldb.jar
    • bsh-deployer.jar
    • autonumber-plugin.jar
    • jbossws-jboss42.jar
    • jbossws-framework.jar
    • jboss-messaging-client.jar
    • jboss-messaging.jar
    • jboss-cache-jdk50.jar

     

     

    WARNING: Keep these if you are consuming web services via cxf or anything else:

    • jboss-jaxws.jar
    • jboss-jaxrpc.jar
    • jboss-ejb3x.jar (annotation updates)
    • jboss-saaj.jar

     

    WARNING: Keep these if you are using hibernate:

    • ejb3-persistence.jar
    • hibernate3.jar
    • hibernate-annotations.jar
    • hibernate-entitymanager.jar
    • jboss-hibernate.jar

     

     

    Current Directory: server/<node>/deploy/

    Now we are on to tuning the deploy directory. Let's start by trimming some fat by removing the following files:

     

    • bsh-deployer.xml
    • cache-invalidation-service.xml
    • client-deployer-service.xml
    • ejb3-interceptors-aop.xml
    • hsqldb-ds.xml
    • iiop-service.xml
    • jboss-ha-xa-jdbc.rar
    • jboss-xa-jdbc.rar
    • jms-ds.xml
    • jms-ra.rar
    • mail-service.xml
    • quartz-ra.rar
    • schedule-manager-service.xml
    • scheduler-service.xml
    • hajndi-jms-ds.xml
    • deploy-hasingleton-service.xml

     

     

    Then the following directories:

     

    • jboss-bean.deployer
    • jboss-messaging.sar
    • ejb3.deployer
    • http-invoker.sar
    • uuid-key-generator.sar
    • juddi-service.sar/
    • jbossws.sar

     

    Since we removed some files we now need to update a couple configurations. Start with the ejb-deployer.xml.

    File updates: server/<node>/deploy/ejb-deployer.xml

    In the ejb-deployer file, remove the following sections:

     

    <!-- ==================================================================== -->
    
    <!-- J2EE Timer Service                                                   -->
    
    <!-- ==================================================================== -->
    
    
      <!-- An EJB Timer Service that is Tx aware -->
      <mbean code="org.jboss.ejb.txtimer.EJBTimerServiceImpl"
        name="jboss.ejb:service=EJBTimerService">
        <attribute name="RetryPolicy">jboss.ejb:service=EJBTimerService,retryPolicy=fixedDelay</attribute>
        <attribute name="PersistencePolicy">jboss.ejb:service=EJBTimerService,persistencePolicy=database</attribute>
        <attribute name="TimerIdGeneratorClassName">org.jboss.ejb.txtimer.BigIntegerTimerIdGenerator</attribute>
        <attribute name="TimedObjectInvokerClassName">org.jboss.ejb.txtimer.TimedObjectInvokerImpl</attribute>
        <depends optional-attribute-name="TransactionManagerFactory" proxy-type="org.jboss.tm.TransactionManagerFactory">
          jboss:service=TransactionManager
        </depends>
    
    
      </mbean>
    
    
      <!-- A retry policy that uses a fixed interval in milli seconds -->
      <mbean code="org.jboss.ejb.txtimer.FixedDelayRetryPolicy" name="jboss.ejb:service=EJBTimerService,retryPolicy=fixedDelay">
        <attribute name="Delay">100</attribute>
      </mbean>
    
    
      <!-- A persistence policy that does not persist the timers
      <mbean code="org.jboss.ejb.txtimer.NoopPersistencePolicy" name="jboss.ejb:service=EJBTimerService,persistencePolicy=noop"/>
      -->
    
    
      <!--
        A persistence policy that persists timers to a database.
    
    
        The 2 supported db persistence plugins are:
          org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin
          org.jboss.ejb.txtimer.OracleDatabasePersistencePlugin
    
    
        The table name defaults to "TIMERS". It can be overriden using the
        'TimersTable' attribute if the persistence plugin supports it.
        When overriding the timers table, an optional schema can be specified
        using the syntax [schema.]table
      -->
    
    
      <mbean code="org.jboss.ejb.txtimer.DatabasePersistencePolicy" name="jboss.ejb:service=EJBTimerService,persistencePolicy=database">
        <!-- DataSourceBinding ObjectName -->
        <depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
        <!-- The plugin that handles database persistence -->
        <attribute name="DatabasePersistencePlugin">org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin</attribute>
        <!-- The timers table name -->
        <attribute name="TimersTable">TIMERS</attribute>
      </mbean>
    
    
    

     

    The above is just a timer related to ejbs. This doesn't do a whole lot for us if we aren't using ejbs.

     

    Also remove the ties to the web services for ejbs:

    <depends optional-attribute-name="WebServiceName">jboss:service=WebService</depends>

     

    Next file is jmx-invoker-service.xml.

     

    File updates: server/<node>/deploy/jmx-invoker-service.xml

    In the jmx-invoker-service file, make sure the following section is commented out.

     

    <interceptor code="org.jboss.jmx.connector.invoker.AuthenticationInterceptor"
                                                            securityDomain="java:/jaas/jmx-console"/>
    

    This allows us to use twitter without any authentication.