JBoss 5.x Tuning/Slimming

Introduction

 

The following slimming recommendations are for a standard JBoss AS 5.1.0 GA (Community) "All" configuration and can be used for Jboss EAP 5.1.0 (Enterprise). Slimming is very application specific, so this is by no means a universal document. If you have documented the process for slimming other services for JBoss 5.x please add to them here.

 

Slimming

Remove EJB3 services

In server/<node>/deploy/ remove:

  • ejb3-connectors-jboss-beans.xml
  • ejb3-container-jboss-beans.xml
  • ejb3-interceptors-aop.xml
  • ejb3-timerservice-jboss-beans.xml
  • profile-service-secured.jar --> Note : this folder is not in Jboss EAP 5.1.0

 

In server/<node>/deployers/ remove

  • jboss-ejb3-endpoint-deployer.jar
  • ejb3-deployers-jboss-beans.xml --> Note : this file is in Jboss EAP 5.1.0 but not Jboss AS 5.1.0

 

WARNING : Do not remove

                    deployers/ejb3.deployer/jboss-ejb3-deployer.jar

                    and deployers/ejb3.deployer/META-INF/ejb3-deployers-jboss-beans.xml,

                    they are used to support annotations for EJB client.

Remove EJB2 services

In server/<node>/deploy/ remove:

  • ejb2-container-jboss-beans.xml
  • ejb2-timer-service.xml (Note that EJB3 deployments may fail without this service.  See this forum post)

Remove JUDDI

In server/<node>/deploy/ remove:

  • juddi-service.sar

Remove Key Generator

In server/<node>/deploy/ remove:

  • uuid-key-generator.sar

 

Remove JMS (Java Message Service)

In server/<node>/conf/props/ remove:

  • messaging-roles.properties
  • messaging-users.properties

 

In server/<node>/deploy/ remove:

  • messaging
  • jms-ra.rar
  • quartz-ra.rar (this is just JMS resource to the Quartz scheduler)

 

In server/<node>/deployers/ remove:

  • messaging-definitions-jboss-beans.xml

 

In server/<node>/conf/standardjboss.xml remove (comment out):

  • everything about jms (maybe optionnal because profile web and default use

        the same standardjboss.xml file and profile web have no JMS support)

 

In server/<node>/conf/jbossts-properties.xml remove (comment out):

<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGING1"
     value="org.jboss.jms.server.recovery.MessagingXAResourceRecovery;java:/DefaultJMSProvider"/> 
</properties>

 

Remove JBoss Mail

In server/<node>/deploy/ remove:

  • mail-service.xml
  • mail-ra.rar

 

Remove JBoss Scheduling

In server/<node>/deploy/ remove:

  • schedule-manager-service.xml
  • scheduler-service.xml

 

Remove Hypersonic DB

In server/<node>/deploy/ remove:

  • hsqldb-ds.xml

 

Remove Bsh Deployer

In server/<node>/deployers/ remove:

  • bsh.deployer

 

Turn off hot deployment

In server/<node>/deploy/ remove:

  • hdscanner-jboss-beans.xml

 

Remove JBossWS

 

In server/<node>/conf remove:

  • jax-ws-catalog.xml

In server/<node>/conf/props/ remove:

  • jbossws-roles.properties
  • jbossws-users.properties

In server/<node>/deploy/ remove:

  • jbossws.sar
  • jbossws-console.war

In server/<node>/deployers/ remove

  • jbossws.deployer

 

Remove Seam

In server/<node>/deployers/ remove

  • seam.deployer
  • webbeans.deployer

In server/<node>/deploy/ remove:

  • admin-console.war - takes too much resources in JBoss 5.x, remove it even if you use Seam

 

Remove IIOP/Corba

 

In server/<node>/conf/ remove

  • "jacorb.properties

In server/<node>/deploy/ remove:

  • iiop-service.xml

In server/<node>/deployers/ejb3.deployer/META-INF remove

  • ejb3-iiop-deployers-jboss-beans.xml

In server/<node>/lib remove

  • jacorb.jar

 

In server/<node>/conf/jndi.properties, replace the line :

java.naming.factory.initial=org.jboss.iiop.naming.ORBInitialContextFactory

with this new line

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

Remove other services

In server/<node>/deployers/ remove

  • xnio.deployer - not used in JBoss 5.x default configuration for  JBoss remoting anyway

 

In server/<node>/deploy/  remove:

  • jboss-xa-jdbc.rar - if you do not use XA datasources
  • jmx-remoting.sar - remote (RMI) acces to JMX, you can still access JMX by jmx-console
  • jmx-console.war - if you do not use JMX console
  • profileservice-secured.jar - secured remote access to profileservice
  • sqlexception-service.xml - pretty useless in JBoss 5.x
  • xnio-provider.jar - not used in JBoss 5.x default configuration for JBoss remoting

 

In server/<node>/deployers/  remove:

  • hibernate-deployer-jboss-beans.xml - deployment of HAr archives only, you can still use Hibernate in EJBs after you remove this

 

Also, feel free to remove the corresponding .jars for the services slimmed above from jboss/common/lib.

 

Remove Unused Invokers

It depends, which invoker you would like to use: jrmp, pooled, unified, http. The best way is to chose one and disable the others.

TODO: how to switch invokers (such as switching JMX from JRMP to HTTP).

 

 

HTTP Invokers 

  • If you want to remove the HTTP invokers (which are used if you 'tunnel' your requests through HTTP) simply remove the according deployments/directories from the $JBOSS_HOME/server/<profile>/deploy/ directory. 
  • Please be aware that HTTP invokers are something different than the Tomcat HTTP Connector (the HTTP invokers need the HTTP connector but the HTTP connector does not need the HTTP invokers). 
  • HTTP Invoker for JNDI, EJB and JMX
    • Simply remove the http-invoker.sar (web, default, standard) or httpha-invoker.sar (all, production) directory from your configuration all together.
    • If using a clustered configuration, then remove httpha-invoker.sar
  • HTTP Invoker for JMS 
    • Remove the /deploy/jms/jbossmq-httpil.sar directory completely.

 

JMX Invoker

  • If you want to remove the JMX invoker, remove $JBOSS_HOME/server/<profile>/deploy/jmx-invoker-service.xml.
  • By removing the JMX invoker you will not be able to perform a remote shutdown or any sort of programmatic remote management.  You will not be able to use twiddle and shutdown scripts!
  • The JMX invoker depends on the JRMP invoker.  You can remove the JMX invoker and keep the JRMP invoker, but you can't remove the JRMP invoker without removing the JMX invoker also.
  • The legacy Web Management Console depends on the jmx-invoker service. You can remove the $JBOSS_HOME/server/<profile>/deploy/management directory in order to clean up deployment errors from this dependency.  This Web Console is deprecated by the Admin Console as of EAP 5 and is maintained for legacy purposes only.
  • Securing the JMX Invoker
    • Rather than remove the jmx invoker, you can also secure it by uncommenting the line in jmx-invoker-service.xml that looks like:  <!-- <interceptor code="org.jboss.jmx.connector.invoker.AuthenticationInterceptor" securityDomain="java:/jaas/jmx-console"/> -->
    • This will require authentication to use the JMX invoker service, but the password will still be unencrypted.  You can implement a simple hashing method as shown in the security guide.

 

Pooled Invoker

  • This provides a socket connection pool for remote EJB calls.
  • If you want to remove the Pooled invoker, in server/<node>/deploy/legacy-invokers-service.xml remove (comment out): PooledInvoker

 

JRMP Invoker

  • The org.jboss.invocation.jrmp.server.JRMPInvoker class is an MBean service that provides the RMI/JRMP implementation of the Invoker interface. The JRMPInvoker exports itself as an RMI server so that when it is used as the Invoker in a remote client, the JRMPInvoker stub is sent to the client instead and invocations use the RMI/JRMP protocol.
  • If you want to remove the JRMP invoker, in server/<node>/deploy/legacy-invokers-service.xml remove (comment out): JRMPInvoker
  • You also have to disable jmx-invoker-service.xml. See above.

 

IIOP Invoker

  • JBoss IIOP supports CORBA/IIOP access to enterprise beans deployed in a JBoss Application Server, as defined by the EJB specification.
  • If you want to remove the IIOP invoker, in server/<node>/conf/standardjboss.xml remove (comment out): invoker-proxy-binding iiop

 

Note: There may be other invokers bound to different ports. If you don't need them you may remove them. Otherwise secure them if they are reachable by folks you don't fully trust.

 

Remove Clustering

 

In server/<node> remove:

  • deploy-hasingleton/
  • farm/

 

In server/<node>/deploy remove:

  • cluster/

 

To eliminate an otherwise harmless error message in the logs about a missing farm directory, in server/<node>/conf/bootstrap/profile.xml edit the "BootstrapProfileFactory" bean and delete or comment out the following:

 

<!-- Optional list of URIs that will be kept in sync across the cluster.
     Requires deploy/cluster/farm-deployment-jboss-beans.xml to be
     deployed as well.
-->
<property name="farmURIs">
   <list elementClass="java.net.URI">
      <value>${jboss.server.home.url}farm</value>
   </list>
</property>

 

To switch JBoss Messaging to non-clustered operation, in server/<node>/deploy/messaging edit the <somename>-persistence-service.xml file and

  • turn off clustering:
<attribute name="Clustered">false</attribute>  
  • delete or comment out the dependency on the JGroups channel factory
<depends optional-attribute-name="ChannelFactoryName">
jboss.jgroups:service=ChannelFactory</depends>

 

 

The above describes a complete elimination of clustering features. Finer grained elimination of features can be accomplished by not completely deleting server/<node>/deploy/cluster but rather only deleting some of the deployments therein. For example, doing all of the above but leaving

  • server/<node>/deploy/cluster/jboss-cache-manager.sar and
  • server/<node>/deploy/cluster/jgroups-channelfactory.sar

will allow HttpSession replication to work.

Tuning

 

Reduce memory usage:

 

There's one very simple change that you could do to bring down the memory used by JBoss AS 5.1.0. By default, JBoss AS5 has some debug level MBeans (which are in most cases meant for JBoss server developer's use) enabled. These MBeans are too much in number and are known to increase memory usage. What you can do is, change the following from JBOSS_HOME/server/< servername>/conf/bootstrap/deployers.xml:

 

 

<bean name="Deployers">
 <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name=jboss.deployment:service=DeployersImpl, 
exposedInterface=org.jboss.deployers.plugins.deployers.DeployersImplMBean.class, registerDirectly=true)
</annotation>
 <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
 <!-- Accept any implementor of deployer -->
 <incallback method="addDeployer"/>
 <uncallback method="removeDeployer"/>
 <property name="mgtObjectCreator"><inject bean="ManagedObjectCreator"/></property>
</bean>

 

 

to:

 

 

<bean name="Deployers">
 <!-- Uncomment the following @org.jboss.aop.microcontainer.aspects.jmx.JMX to enable registering
 MC beans as MBeans. These MBeans provide debug level information about which deployers were selected for
 processing the deployment and what attachments were added to the deployment. More details 

 http://www.jboss.org/index.html?module=bb&op=viewtopic&t=155074&start=10#4233874
 -->
<!--
 <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.deployment:service=DeployersImpl", 
exposedInterface=org.jboss.deployers.plugins.deployers.DeployersImplMBean.class, registerDirectly=true)
</annotation>
-->
 <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
 <!-- Accept any implementor of deployer -->
 <incallback method="addDeployer"/>
 <uncallback method="removeDeployer"/>
 <property name="mgtObjectCreator"><inject bean="ManagedObjectCreator"/></property>
</bean>

 

Notice the commented out the "annotation" element in that section. More details can be found in this JIRA https://jira.jboss.org/browse/JBAS-6987. This fix has been done in JBoss AS 6.0 series.

 

Related forum discussions:

 

http://community.jboss.org/message/555231#555231

http://community.jboss.org/message/566236#566236