You are on page 1of 69

Professional Open Source™

JBoss Tuning
Run, Forrest, Run!

© JBoss, Inc. 2003-2005. June 16, 2005 1


Topics
Professional Open Source™

 Tuning the front-end


– Incoming HTTP requests
– JSP compilation

 Tuning the back-end


– Database connection pooling

 Tuning the memory allocation


– Garbage Collectors

© JBoss, Inc. 2003-2005 2


Professional Open Source™

 administrator view of the system:


– Manage the front end connections (listening ports, firewall, DMZ, httpd)
– Manage back end connectivity (databases, messaging, legacy information
systems)
– Manage security
• Authentication and authorization context flows through the system
• Front and back end connections encrypt sensitive data where necessary
– Monitor and tune the application server

EIS
EIS
EIS

Tune, monitor
and secure
Configure Configure
Administrator

© JBoss, Inc. 2003-2005 3


Topics
Professional Open Source™

- The performance of a Jboss application is highly dependent on the


environment
It is running within. This environment includes both hardware and software
Components. Each of these components has an effect on the performance of
Jboss applications.
Hardware – CPU,RAM,Storage,NIC
. Operating System
Java Virtual Machine
Jboss Server

JBoss
Application

© JBoss, Inc. 2003-2005 4


Professional Open Source™

Choice of JVM

© JBoss, Inc. 2003-2005 5


Choice of JVM
Professional Open Source™

There are multiple choice of JVM’s, among them Sun HotSpot JVM
and BEA Jrockit JVM are most popular

Use JRockit on x86 hardware

Note1 : Use a 64 bit machine and 64 bit VM so that you can use large
heap sizes

Note2 : Avoid extra large heaps but avoid extra small heaps.

Note3 : You really should use a multi-processor machine with more


than 2 processors and use various parrallel and concurrent garbage
collection options for maximum performance and high garbage
collector throughput. However, you really need to understand how
garbage collection works to tune this well. You can try much less hard
by upgrading to JDK 5 which is mostly self-tuning

© JBoss, Inc. 2003-2005 6


Choice of JVM
Professional Open Source™

Every JVM includes options that can affect performance – the most
prevalent of which are:
- heap size - garbage collection - Threading

The JVM Heap

The head size is the amount of memory that the JVM has to work with.
Jboss server code and Jboss application code create instances of Java
classes that are held in this memory. By default, Jboss executes with an
intial heap size of 64MB(for WebLogic 32MB)

To modify the heap size


Modify %Jboss_Home%/bin/run.bat file
Set JAVA_OPTS = %JAVA_OPTS% -xms128m
-xmx512m

© JBoss, Inc. 2003-2005 7


Professional Open Source™

Tomcat Tuning

© JBoss, Inc. 2003-2005 8


Web Tier Optimizations
Professional Open Source™

 We will look at:  Embedded Tomcat:


– Middleware stack front-end – Version 5.0.x with JBoss 3.2.4+
• Incoming HTTP requests – Version 5.5.x with JBoss 4.0.2+
• Servicing dynamic web content

Web Interface for Transaction


the User
(Tomcat al work in
HTTP Servlets/JSP)
Servlet the EJB
EJB tier
User
Servlet EJB Databas
e
2. Establish user
identity across the
server
Security Framework Identity
Databas
JBoss Application Server e

© JBoss, Inc. 2003-2005 9


Tomcat Tuning
Professional Open Source™

edit your server/<server name>/jbossweb-tomcat50.sar/server.xml

<Connector port="8080"
address="${jboss.bind.address}" maxThreads="150"
minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443"
acceptCount="100" connectionTimeout="20000"
disableUploadTimeout="true"/>

© JBoss, Inc. 2003-2005 10


Tomcat Tuning
Professional Open Source™

Port - The TCP port number on which this connector will


create
a server socket and await incoming connections.
Address – For servers with more than one IP address, this
attribute
specifies which address will be used for listening
on the
specified port.
Redirect port – Container can redirect the request to the
port number
specified for any security-constraint.
Accept count – The maximum queue length for incoming
connection
requests when all possible request processing
threads
are in use.
Connection Timeout – The number of milliseconds this
connector
will wait, after accepting a connection.
© JBoss, Inc. 2003-2005 11
Tomcat Tuning
Professional Open Source™

1)You should have minSpareThreads equal just a little more than your
normal load

2)You should have maxSpareThreads equal just a little more than your
peak load

3)min spare threads means "on start up, always keep at least this many
threads waiting idle"

4)max spare threads means "if we ever go above minSpareThreads then


always keep maxSpareThreads waiting idle" .

5)Remove any unnecessary valves and logging. If you're not using JBoss's
security, remove the security valve (see below).

6)Precompile JSPs! And Turn off "development" mode in your


sever/default/jbossweb-tomcat50.sar/conf/web.xml

© JBoss, Inc. 2003-2005 12


Configuring Tomcat
Professional Open Source™

Deleting Work Directories :


Tomcat normally doesn't delete work directories when the
Web applications are undeployed. This can cause JSP
Compilation problems in some cases during redeployment.
We can use the DeleteWorkDirs attribute of the Tomcat5
Service Mbean to get Tomcat to delete the work directories
during undeployment.

<mbean code="org.jboss.web.tomcat.tc5.Tomcat5"
name="jboss.web:service=WebServer">
attribute name=”DeleteWorkDirs”> true</attribute>
...
</mbean>

Ref :deploy/jbossweb-tomcat5x.sar/META-INF/jboss-service.xml

© JBoss, Inc. 2003-2005 13


Configuring Tomcat
Professional Open Source™

Classloading Behavior

Tomcat normally uses the parent classloader to load classes


before resorting to the WAR classloader. This is the standard
Java2 classloading behavior. However, the Servlet 2.3
specification requires WAR classloader to first try loading the
classes by looking into the \WEB-INF\classes and \WEB-
INF\lib directories.

<mbean code="org.jboss.web.tomcat.tc5.Tomcat5"
name="jboss.web:service=WebServer">
attribute name=”Java2ClassLoadingCompliance”>
true</attribute>
...
</mbean>
Ref :deploy/jbossweb-tomcat5x.sar/META-INF/jboss-service.xml

© JBoss, Inc. 2003-2005 14


JSP Optimization
Professional Open Source™

 JSP page compiler is in development mode by default


– To increase performance you can:
• Reduce the amount of logging
• Remove ”is-modified” check on JSP pages on every
request
• Precompile your JSP pages

deploy/jbossweb-
tomcat5x.sar/conf/web.xml
<!-- The JSP page compiler and execution servlet, which is the mechanism
used by Tomcat to support
<!-- JSP pages. Traditionally, this servlet is mapped to URL pattern "*.jsp".
This servlet supports the
<!-- following initialization parameters (default values are in square
brackets):  
<!--
<!-- checkInterval If development is false and reloading is true,
background compiles are enabled.
<!-- checkInterval is the time in seconds between checks to see if a JSP
page needs to be recompiled. [300]  
<!--  
<!-- development Is Jasper used in development mode (will check  for JSP
modification on every access)?
<!--
<!-- reloading Should Jasper check for modified JSPs? [true]   15
© JBoss, Inc. 2003-2005
JSP Optimization
Professional Open Source™

deploy/jbossweb-
tomcat5x.sar/conf/web.xml
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-
class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>development</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet> 

 Other options that may affect performance:


– genStrAsCharArray, internally Tomcat uses character array objects instead of
String objects – may be faster in some cases
– trimSpaces, removes white space from responses

© JBoss, Inc. 2003-2005 16


Tomcat Connectors
Professional Open Source™

 Incoming connections:
– From HTTP server (Apache/IIS via mod_jk)
• AJP protocol
– Direct client connections
• HTTP/HTTPS
HTTP

HTTP

mod_

AJP
jk

© JBoss, Inc. 2003-2005 17


The HTTP/1.1 connector
Professional Open Source™

 Best performance (maximum throughtput and lower latency)

 Very simple to put in production


– Well tested
– One default configuration fits nearly all (same defaults as HTTPd in Tomcat 5.0.x)

 Less scalable than some native HTTP stacks


– Java threads are rather expensive
– Poor OS support for large number of threads

 Could improve significantly in the near future


– More scalable OS schedulers
– 64 bit allowing large amounts of virtual memory to allocate threads

 Java powered websites seem to be slowly migrating to a full Java solution

© JBoss, Inc. 2003-2005 18


The AJP/1.3 connector
Professional Open Source™

– Best scalability (+)


• Better resources usage from native HTTP handling
• Clustering capabilities

– More robust network stack (+)


– Harder to put in production (-)
– Some native servers are less tested (-)
– Tomcat 4.1 should use the JK 2 connector
• Same AJP/1.3 support (so independent from the native connector used)
• Faster

– Best tested configurations


• Apache 1.3.x / mod_jk 1.2.x / Linux 2.4
• Apache 2.x / mod_jk 1.2.x / Linux 2.4
• Apache 2.x / mod_jk 2.0.x / Linux 2.4
• IIS 5.0 / mod_jk 1.2.x / Windows 2000

© JBoss, Inc. 2003-2005 19


Tomcat Connectors
Professional Open Source™

deploy/jbossweb-tomcat5x.sar/server.xml
<Service name="jboss.web“
className="org.jboss.web.tomcat.tc5.StandardService">

<!-- A HTTP/1.1 Connector on port 8080 -->


<Connector port="8080"
address="${jboss.bind.address}"
maxThreads="150" maxHttpHeaderSize="8192"
minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443"
acceptCount="100"
connectionTimeout="20000"
disableUploadTimeout="true"/>

<!-- A AJP 1.3 Connector on port 8009 -->


<Connector port="8009"
address="${jboss.bind.address}"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3"/>

<!-- SSL/TLS Connector configuration using the admin


devl guide keystore -->
<Connector port="8443"
address="${jboss.bind.address}"
maxThreads="100" minSpareThreads="5"
maxSpareThreads="15"
© JBoss, Inc. 2003-2005 20
HTTP/1.1 tweaking
Professional Open Source™

 Binding can be configured using the address attribute

 Better scalability
– Keep a minimal pool of threads: minProcessors (4.1) and
minSpareThreads (5.0)
– Allow more concurrent connections: maxProcessors (4.1) and maxThreads
(5.0)
– Many other factors, obviously: the worst is to allow too many HTTP
connections that couldn't complete in a satisfactory time
– ConnectionTimeout, disableUploadTimeout and maxKeepAliveRequests
allow configuring HTTP/1.1 keepalive
– Attribute ”acceptCount”
• Maximum queue size when all threads are busy processing

© JBoss, Inc. 2003-2005 21


Performance settings: AJP Connector
Professional Open Source™

 Thread pool configuration


– maxTheads: Maximum amount of concurrent connections which can be
handled by Tomcat. Default value is 75, appropriate for a small server.
• Medium server: around 200
• Large server: around 400
 Connection configuration attributes
– backlog: Queue length for TCP connections of the server socket.
– soTimeout: Duration of the HTTP keepalive in milliseconds.
– tcpNoDelay: Output written to the socket will be sent back immediately.
Setting this to false will save bandwidth but will greatly increase the
server’s latency when using connection keep-alive.
– TomcatAuthentication: Allows doing authentication in the native
webserver, which can offload some CPU intensive processing.

© JBoss, Inc. 2003-2005 22


Performance settings: Static Resource Cache
Professional Open Source™

 Improves significantly the performance for static file serving


 The parameters are set on the Context element
– cacheMaxSize: Global size of the cache in KB. By default, it is set to 10 MB. The
maximum size of a cached resource is the maximum size divided by 20 (so 512 KB
by default).
– cacheTTL: After the specified amount of milliseconds (5000 by default), the cache
entry will be revalidated. Increase this value if the load is spread over a large
amount of resources.
– cachingAllowed: Set to false to disable caching.
 Performance monitoring using JMX
– MBean name:
<engineName>:type=Cache,host=<hostName>,path=<webappPath>
– Performance attributes:
• accessCount: Number of cache lookups
• hitCount: Number of cache hits; if significantly lower than accessCount, then
the caching isn’t efficient
• cacheSize: Current cache size; if close from the limit and hitCount is not
stisfactory, the cache size should be increased

© JBoss, Inc. 2003-2005 23


Performance settings: String Cache
Professional Open Source™

 Used when:
– Reading cookies
– Accessing the request parameters
– Accessing the request headers (cache related headers, etc)
 Configured using system properties
– tomcat.util.buf.StringCache.byte.enabled and
tomcat.util.buf.StringCache.char.enabled : Set to true to enable byte[] or char[] to
String conversion caching.
– tomcat.util.buf.StringCache.trainThreshold: The cache will be built after a training
period during which statistics about converted Strings will be kept. The value of this
property is the amount of String conversions before building the cache.
– tomcat.util.buf.StringCache.cacheSize: Maximum number of String objects which
will be cached, according to their usage statistics.
 Runtime monitoring through JMX
– Mbean name: Catalina:type=StringCache
– Can be enabled or disabled at runtime by changing the enabled attributes
– reset operation to discard the current cache and start collecting statistics to build a
new one; this can be used after deployment of new applications on the server

© JBoss, Inc. 2003-2005 24


Professional Open Source™

RMI for Remote Invocations


By default JBoss creates a new thread for every RMI request that comes
in. This is not generally efficient on a large system. Secondly, it can be
dangerous to allow unrestrained connections in the case of performance
or traffic spikes or run-away connection creating clients. To remedy this
you should consider switching to the pooled invoker.

•edit server/test/con/standardjboss.xml
•change all of the proxy bindings to the pooled invoker by changing
every XML fragment reading:

<invoker-
mbean>jboss:service=invoker,type=jrmp</invoker-
mbean>
to
<invoker-
mbean>jboss:service=invoker,type=pooled</invoker-
mbean>
© JBoss, Inc. 2003-2005 25
Professional Open Source™

Log4J

© JBoss, Inc. 2003-2005 26


Log4J
Professional Open Source™

Logging is one of the key aspects of enterprise application


development,
Used extensively for diagnostic and bug tracking purposes.
Jboss uses Log4J as its sole logging application programming interface

The Logging Mbean

Jboss provides an Mbean that can be used for configuring logging options.
This Mbean is normally defined in the root configuration file
\conf\jboss-service.xml.

© JBoss, Inc. 2003-2005 27


Log4J
Professional Open Source™

Mbean Definition
<mbean code=“org.jboss.logging.Log4jService”
name=“jboss.system:type=Log4jService.service=Logging”>
<attribute
name=“ConfigurationURL”>resource:log4j.xml</attribute>
<attribute name=“Log4jQuietMode”>true</attribute>
</mbean>
This will load the logging configuration from the file \conf\log4j.xml

The three main components of Log4j are :


Loggers : decide what is logged
Appenders : decide where it’s logged
Layouts : decide what format it’s logged
© JBoss, Inc. 2003-2005 28
Log4J
Professional Open Source™

Logging has a profound effect on performance.


To turn off console logging:
edit server/slim/conf/log4j.config

change the following XML fragment:


<root>
<appender-ref ref=CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
make it read
<root>
<appender-ref ref="FILE"/>
</root>
© JBoss, Inc. 2003-2005 29
Log4J
Professional Open Source™

you can then remove this fragment also :

<appender name="CONSOLE"
class="org.apache.log4j.ConsoleAppender">
<errorHandler
class="org.jboss.logging.util.OnlyOnceErrorHandle
r"/> <param name="Target"
value="System.out"/>
<param name="Threshold" value="INFO"/>
<layout class="org.apache.log4j.PatternLayout">

<!-- The default pattern: Date Priority [Category]


Message\n -->
<param name="ConversionPattern"
value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
</appender>
© JBoss, Inc. 2003-2005 30
Log4J
Professional Open Source™

To change the log level:

1.Edit server/slim/conf/log4j.xml
2. Remove comment these XML fragments
.
<category name="org.apache">
<priority value="INFO"/>
</category> <!-- Limit org.jgroups category to INFO
-->
<category name="org.jgroups">
<priority value="INFO"/>
</category>
The priority value can be one of:
•ERROR - error messages
•WARN - borderline error messages
•INFO - general status messages
•DEBUG - verbose debug level messages
•TRACE - very verbose
© JBoss, Inc. 2003-2005 31
Log4J
Professional Open Source™

change the root category by changing this XML


fragment

<root> <appender-ref ref="CONSOLE"/>


<appender-ref ref="FILE"/> </root>

to look like this

<root> <priority value="ERROR" />


<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>

© JBoss, Inc. 2003-2005 32


Log4J
Professional Open Source™

And finally, probably the most important thing in log4j, make sure
you limit the logging level on your own class hierarchy. This
assumes that you are using log4j as it was intended and not writing
everything to System.out. This will significantly reduce the overhead
of log4j and allow you to fully enjoy the benefits of calls like "if(
log.isDebugEnabled() )...". If you don't do this then all the logging in
your code will get formatted and passed to the appender, and the
threshold on the appender will weed out the log messages. This can
generate a significant amount of garbage. Assuming your java
package starts with "a.b", add something like this to log4j.xml:

<!-- Limit a.b category to INFO -->


<category name="a.b">
<priority value="INFO"/>
</category>

© JBoss, Inc. 2003-2005 33


Professional Open Source™

Deployment Scanner

© JBoss, Inc. 2003-2005 34


Deployment Scanner
Professional Open Source™

The deployment scanner scanning every 5 seconds eats up


cycles especially on systems with a slow filesystem (*cough*
NTFS *cough*).

*See the below slimming stuff on how to turn the number of


seconds such that it happens less frequently or not at all

© JBoss, Inc. 2003-2005 35


Deployment Scanner
Professional Open Source™

Stateless Session Beans

If you find that you need more than the default (10) instances consider
setting the minimum pool size:

edit server/slim/conf/standardjboss.xml, scroll down to:


<container-configuration>
<container-name>Standard Stateless SessionBean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>stateless-rmi-invoker</invoker-proxy-
binding-name>
<container-interceptors>

© JBoss, Inc. 2003-2005 36


Deployment Scanner
Professional Open Source™

and find:

<container-pool-conf>
<MaximumSize>100</MaximumSize>
</container-pool-conf>
</container-configuration>

change it to read:

<container-pool-conf>
<MinimumSize>100</MinimumSize>
<MaximumSize>100</MaximumSize>
<strictMaximumSize>100</strictMaximumSize
>
</container-pool-conf>
</container-configuration>

© JBoss, Inc. 2003-2005 37


Professional Open Source™

Database and SQL Tuning

© JBoss, Inc. 2003-2005 38


Database and SQL Tuning
Professional Open Source™

For a vast majority of Jboss applications, database access is a critical piece


of functionality and potentially a good source for performance tuning.

For example, there can be issues with the number of database accesses that
an application is making, which might encourage an application developer
to cache in memory values that don’t change frequently instead of retrieving
each time. Or there could be an issue with how long a particular query is
taking to return, which might be improved by adding indexes or using
temporary tables on the database.

There are several other factors concerning the general performance of the
database itself as well as Jboss communication with the database
© JBoss, Inc. 2003-2005 39
Database and SQL Tuning
Professional Open Source™

1. Connection Pools
2. Caching Prepared Statements
3. JDBC Driver Type
4. Database Schema Design
5. Using Correct Indexes
6. Using Strored Procedures

© JBoss, Inc. 2003-2005 40


Professional Open Source™

Connector Tuning

© JBoss, Inc. 2003-2005 41


Connector Tuning
Professional Open Source™

Compared to actually executing an SQL statement, establishing a


Connection to the database is very slow operation.

Connection pools allow Jboss to be incharge of establishing


connections
To the RDBMS and distributing those connection to Jboss Server
Applications as they are needed.

Additionally, connection pools can be set up to automatically grow


And shrink depending on application needs.

© JBoss, Inc. 2003-2005 42


Connector Tuning
Professional Open Source™

Increasing the initial number of connections in the pool will make


Jboss server slower to start, but applications will not have to wait
When requesting a database connection.

Ideally, the best performance will be achieved when the number of


connections in the pool is equal to the number of connections
needed by Jboss applications

© JBoss, Inc. 2003-2005 43


Connection Tuning
Professional Open Source™

 Sample datasource:
<datasources>
<local-tx-datasource>
<jndi-name>GenericDS</jndi-name>
<connection-url>[jdbc: url for use with Driver class]</connection-
url>
<driver-class>[fully qualified class name of java.sql.Driver
implementation]</driver-class>
<user-name>x</user-name>
<password>y</password>
<!-- you can include connection properties that will get passed in the
DriverManager.getConnection(props) call. Look at your Driver
docs to see what these might be -->
<config-property name="SomeProperty"
type="java.lang.String">x</config-property>
<connection-property name="char.encoding">UTF-8</connection-
property>
<transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-
isolation>
<!--pooling parameters-->
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<prepared-statement-cache-size>100</prepared-statement-cache-
size>
© JBoss, Inc. 2003-2005 44
Connector Tuning
Professional Open Source™

1. Connection-url : The JDBC driver connection URL


ex : jdbc:hsqldb:hsql:localhost:1701
2. Driver-class : The full qualified name of the JDBC driver class
ex: org.hsqldb.jdbcdriver
3. Connection-property : This element allows you to pass in arbitray
connection properties to java.sql.Driver.connect(url,prop)
4. Username: Default name for new connection
s
5. Password: Default password for a new connection
6. Transaction-isolation: This element specifies the
java.sql.connections transaction isolation levels :
TRANSACTION_READ_UNCOMMITTED,COMMITTED,
TRANSACTION_SERIALIZABLE etc.,

© JBoss, Inc. 2003-2005 45


Connector Tuning
Professional Open Source™

7. Min-pool-size : Specifies minimum number of connections a


pool should hold

8. Max-pool-size: Maximum number of connections a pool should hold

9. Blocked-timout-millsec : It specififies maximum time in millsecs a


block while waiting for a connection before throwing anexception.

10. Idle-timeout-minutes: It specifies the maximum time in minutes a


connection may be idle before being closed.

11.Prepared-statement-cache-size : Specifies the number of prepared


statements per connection in the cache.
© JBoss, Inc. 2003-2005 46
Connection Tuning
Professional Open Source™

 Configuration Options
– Set the appropriate database connection pool size
• Depending on how many concurrent requests you’re handling
– E.g. how many concurrent requests are coming through web tier?
– How many of those requests need database access?
• Try the prepared statement cache for performance
• Try switching track-statements to false for performance

© JBoss, Inc. 2003-2005 47


Professional Open Source™

Slimming

© JBoss, Inc. 2003-2005 48


Slimming
Professional Open Source™

When not using the mail-service (J2EE standard


JavaMail? client)

•remove server/slim/deploy/mail-service.xml
•remove server/slim/lib/mail* (mail-plugin.jar,
mail.jar - JavaMail? stuff)
•remove server/slim/lib/activation.jar (Java
Activation Framework is used by JavaMail?)

© JBoss, Inc. 2003-2005 49


Slimming
Professional Open Source™

When not using the cache invalidation service


(used for CMP Option A beans with Cache
Invalidation usually in a clustered configuration)

•remove server/slim/deloy/cache-invalidation-
service.xml

When not using the J2EE client deployer service


(this is a not very useful J2EE spec required
service for the EAR application-client.xml
descriptor)

•remove server/slim/deploy/client-deployer-
service.xml

© JBoss, Inc. 2003-2005 50


Slimming
Professional Open Source™

When not using the integrated HAR deployer and Hibernate


session management services

•remove server/slim/deploy/hibernate-deployer-service.xml (HAR


support)
•remove server/slim/lib/jboss-hibernate.jar (HAR
support)
•remove server/slim/lib/hibernate2.jar (Hibernate
itself)
•remove server/slim/lib/cglib-full-2.0.1.jar (used by
Hibernate to create proxies of POJOs)
•remove server/slim/lib/odmg-3.0.jar (some goofy
object-relational mapping thing used by hibernate from
some goofy committee

© JBoss, Inc. 2003-2005 51


Slimming
Professional Open Source™

When not using Hypersonic (which you should not in


production)
.
•remove server/slim/deploy/hsqldb-ds.xml
•remove server/slim/lib/hsqldb-plugin.jar
•remove server/slim/lib/hsqldb.jar

When not using JBossMQ (our JMS server)

•remove the entire server/slim/deploy/jms directory


•remove server/slim/lib/jbossmq.jar

© JBoss, Inc. 2003-2005 52


Slimming
Professional Open Source™

When not using the HTTPInvoker (which lets you tunnel RMI over
HTTP)

•remove the entire server/slim/deploy/http-invoker.sar directory

When not using XA datasources (Distributed and/or recoverable


transactions)

•remove server/slim/deploy/jboss-xa-jdbc.rar

If you do not need the JMX-Console then remove it

•remove server/slim/deploy/jmx-console.war

© JBoss, Inc. 2003-2005 53


Slimming
Professional Open Source™

If you do not need to make JMX calls over RMI (warning


the shutdown.sh DOES do this)
•remove server/slim/deploy/jmx-invoker-adaptor-server.sar
•remove server/slim/deploy/jmx-adaptor-plugin.jar

If you do not need the web-console


•remove server/slim/deploy/management/web-console.war

If you do not need JSR-177 extensions for JMX


•remove server/slim/deploy/management/console-mgr.sar

If you need neither the web-console or jsr-177 extensions


•remove server/slim/deploy/management directory entirely

© JBoss, Inc. 2003-2005 54


Slimming
Professional Open Source™

If you are not using console/email monitor alerts


•remove server/slim/deploy/monitoring-service.xml
•remove server/slim/lib/jboss-monitoring.jar

If you are not using rich property editors (JMX) or loading


properties into system properties via the Properties Service
•remove server/slim/deploy/properties-service.xml
•remove server/slim/lib/properties-plugin.jar

The scheduler-service.xml is an example unless you have put


your own in it
•remove server/slim/deploy/scheduler-service.xml

© JBoss, Inc. 2003-2005 55


Slimming
Professional Open Source™

If you are not using the JBoss Scheduler Manager (allows you
to schedule invocations against MBeans)
•remove server/slim/deploy/schedule-manager-service.xml
•remove server/slim/lib/scheduler-plugin* (scheduler-
plugin.jar, scheduler-plugin-example.jar)

If you do not need vendor-specific sql exception handing (just


leave it, really)
•remove server/slim/deploy/sqlexception-service.xml

If you are using neither client-side transaction management


nor cached connections (where instead of pooling we cache
connections such as in the case of JAAS->DB User -- using this
means you are a bad person and need to be smacked)
•remove server/slim/deploy/user-service.xml

© JBoss, Inc. 2003-2005 56


Slimming
Professional Open Source™
If you do not use JBoss UUID key generation (often used with
CMP primary keys, but we have database specific support as
well)
•remove server/slim/deploy/uuid-key-generator.sar
•remove server/slim/lib/autonumber-plugin.jar

user-service.xml is an example -- unless you put something in it


(your own mbeans) you can always remove it.
•remove server/slim/deploy/user-service.xml

If your users directly connect to Tomcat via HTTP and do not


pass through Apache/mod_jk:
•open server/slim/deploy/jbossweb-tomcat50.sar/server.xml in
the vi editor
•remove/comment the following XML fragment:
<!-- A AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
address="${jboss.bind.address}"
enableLookups="false" redirectPort="8443"
debug="0" protocol="AJP/1.3"/>
© JBoss, Inc. 2003-2005 57
Slimming
Professional Open Source™

If your users do not directly connect to Tomcat via HTTP and


always pass through Apache/mod_jk

•open server/slim/deploy/jbossweb-tomcat50.sar/server.xml -
-- remove/comment the following XML fragment:

<!-- A HTTP/1.1 Connector on port 8080 -->


<Connector port="8080"
address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25"
maxSpareThreads="75" enableLookups="false"
redirectPort="8443" acceptCount="100"
connectionTimeout="20000"
disableUploadTimeout="true"/>

© JBoss, Inc. 2003-2005 58


Slimming
Professional Open Source™

If you do not need to be able to deploy EAR files


•open server/slim/conf/jboss-service.xml in the vi editor
•remove/comment the following XML fragments from the

from under the


<mbean
code="org.jboss.management.j2ee.LocalJBossSer
verDomain"

MBean
<attribute
name="EARDeployer">jboss.j2ee:service=EARDeploy
er</attribute>
and
<!-- EAR deployer, remove if you are not using Web
layers --> <mbean
code="org.jboss.deployment.EARDeployer"
name="jboss.j2ee:service=EARDeployer">
</mbean>
© JBoss, Inc. 2003-2005 59
Slimming
Professional Open Source™

If you do not need to use CORBA/IIOP


•open server/slim/conf/jboss-service.xml in the vi editor
•remove/comment the following XML fragments from the
from under the <mbean
code="org.jboss.management.j2ee.LocalJBossServer
Domain" MBean
<attribute
name="RMI_IIOPService">jboss:service=CorbaORB</attr
ibute>

If you removed the user-transaction-service.xml


•open server/slim/conf/jboss-service.xml in the vi editor
•remove/comment the following XML fragments from the
from under the <mbean
code="org.jboss.management.j2ee.LocalJBossServer
Domain" MBean
<attribute
name="UserTransactionService">jboss:service=ClientUs
erTransaction</attribute>
© JBoss, Inc. 2003-2005 60
Slimming
Professional Open Source™

If you do not need client-side transaction management


(remember that using this means you're a bad person)
•open server/slim/conf/jboss-service.xml in the vi editor
•remove/comment the following XML fragments

if you do not need persistent MBean attributes (no JBoss


MBeans use this by default...yet)
•open server/slim/conf/jboss-service.xml in the vi editor
•remove/comment this XML fragment

© JBoss, Inc. 2003-2005 61


Slimming
Professional Open Source™

If you do not use RMI Classloading (for loading


codebases from the client using the classes on the server)
•open server/slim/conf/jboss-service.xml in the vi
editor
•remove/comment this XML fragment

If you only want to use JBoss Naming locally (no RMI


clients)
•open server/slim/conf/jboss-service.xml in vi
•change the following XML fragment

© JBoss, Inc. 2003-2005 62


Slimming
Professional Open Source™

If you do not use JBossSX, our integrated JAAS-based


security for EJBs or Web-tier components (then you deserve
to be flogged and I hope you get hacked but thats another
story):

•open server/slim/conf/jboss-service.xml
•remove

If you are not using the Pooled Invoker) then:


•open server/slim/conf/jboss-service.xml
•remove:

© JBoss, Inc. 2003-2005 63


Slimming
Professional Open Source™

If you do not need client-side transaction management


(remember that using this means you're a bad person)
•open server/slim/conf/jboss-service.xml in the vi editor
•remove/comment the following XML fragments

if you do not need persistent MBean attributes (no JBoss


MBeans use this by default...yet)
•open server/slim/conf/jboss-service.xml in the vi editor
•remove/comment this XML fragment

© JBoss, Inc. 2003-2005 64


Slimming
Professional Open Source™

If you do not hot deploy files into the server/slim/deploy directory


without restarting JBoss:
•open server/slim/conf/jboss-service.xml in vi
•change this XML frament:
<!-- An mbean for hot deployment/undeployment of
archives. --> <mbean
code="org.jboss.deployment.scanner.URLDeploymentSc
anner"
name="jboss.deployment:type=DeploymentScanner,fla
vor=URL"> ... <attribute
name="ScanPeriod">5000</attribute> ... </mbean>

to read (by adding):


<!-- An mbean for hot deployment/undeployment of
archives. --> <mbean
code="org.jboss.deployment.scanner.URLDeploymentSc
anner"
name="jboss.deployment:type=DeploymentScanner,fla
vor=URL"> ... <attribute
© JBoss, Inc. 2003-2005 65
Professional Open Source™

Monitoring with Web-Console

© JBoss, Inc. 2003-2005 66


Graphs
Professional Open Source™

 Live graphing of attributes:

© JBoss, Inc. 2003-2005 67


Alerts
Professional Open Source™

 Alerts on server attributes:

© JBoss, Inc. 2003-2005 68


Tomcat Status
Professional Open Source™

 Tomcat Status:

© JBoss, Inc. 2003-2005 69

You might also like