Top Banner
Professional Open Source™ © JBoss, Inc. 2003-2005. 1 June 16, 2005 JBoss Tuning Run, Forrest, Run!
69
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: JBossTuning

Professional Open Source™

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

JBoss Tuning Run, Forrest, Run!

Page 2: JBossTuning

© JBoss, Inc. 2003-2005 2

Professional Open Source™

Topics

Tuning the front-end– Incoming HTTP requests

– JSP compilation

Tuning the back-end– Database connection pooling

Tuning the memory allocation– Garbage Collectors

Page 3: JBossTuning

© JBoss, Inc. 2003-2005 3

Professional Open Source™

EIS

EIS

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

AdministratorAdministratorConfigure Configure

Tune, monitor and secure

Page 4: JBossTuning

© JBoss, Inc. 2003-2005 4

Professional Open Source™

Topics

- 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

JBossApplication

Page 5: JBossTuning

© JBoss, Inc. 2003-2005 5

Professional Open Source™

Choice of JVM

Page 6: JBossTuning

© JBoss, Inc. 2003-2005 6

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

Choice of JVM

Page 7: JBossTuning

© JBoss, Inc. 2003-2005 7

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)

Choice of JVM

To modify the heap size

Modify %Jboss_Home%/bin/run.bat file

Set JAVA_OPTS = %JAVA_OPTS% -xms128m -xmx512m

Page 8: JBossTuning

© JBoss, Inc. 2003-2005 8

Professional Open Source™

Tomcat Tuning

Page 9: JBossTuning

© JBoss, Inc. 2003-2005 9

Professional Open Source™

Web Tier Optimizations

We will look at:– Middleware stack front-end

• Incoming HTTP requests

• Servicing dynamic web content

Identity

Database

User

Database

Web Interface for the User(Tomcat Servlets/JSP)

HTTP

JBoss Application Server

Security Framework

EJB

EJB

Servlet

Servlet

2. Establish user identity across the

server

Transactional work in the EJB

tier

Embedded Tomcat:– Version 5.0.x with JBoss 3.2.4+

– Version 5.5.x with JBoss 4.0.2+

Page 10: JBossTuning

© JBoss, Inc. 2003-2005 10

Professional Open Source™

Tomcat Tuning

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

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

Page 11: JBossTuning

© JBoss, Inc. 2003-2005 11

Professional Open Source™

Tomcat Tuning

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.enableLookups – set this to true if you want calls to perform Domain Name System(DNS) lookups. DisableUploadTimeout – This flag allows the servlet container to use a different, longer connection timeout while servlet is being executed.

Page 12: JBossTuning

© JBoss, Inc. 2003-2005 12

Professional Open Source™

Tomcat Tuning

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

Page 13: JBossTuning

© JBoss, Inc. 2003-2005 13

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>

Configuring Tomcat

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

Page 14: JBossTuning

© JBoss, Inc. 2003-2005 14

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>

Configuring Tomcat

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

Page 15: JBossTuning

© JBoss, Inc. 2003-2005 15

Professional Open Source™

JSP Optimization

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] <!--

Page 16: JBossTuning

© JBoss, Inc. 2003-2005 16

Professional Open Source™

JSP Optimization

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

Page 17: JBossTuning

© JBoss, Inc. 2003-2005 17

Professional Open Source™

Tomcat Connectors

Incoming connections:– From HTTP server (Apache/IIS via mod_jk)

• AJP protocol

– Direct client connections

• HTTP/HTTPS

HTTP

mod_jk

AJP

HTTP

Page 18: JBossTuning

© JBoss, Inc. 2003-2005 18

Professional Open Source™

The HTTP/1.1 connector

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

Page 19: JBossTuning

© JBoss, Inc. 2003-2005 19

Professional Open Source™

The AJP/1.3 connector

– 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

Page 20: JBossTuning

© JBoss, Inc. 2003-2005 20

Professional Open Source™

Tomcat Connectors

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" scheme="https" secure="true" clientAuth="false" keystoreFile="${jboss.server.home.dir}/conf/chap8.keystore" keystorePass="rmi+ssl" sslProtocol = "TLS" />

Page 21: JBossTuning

© JBoss, Inc. 2003-2005 21

Professional Open Source™

HTTP/1.1 tweaking

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

Page 22: JBossTuning

© JBoss, Inc. 2003-2005 22

Professional Open Source™

Performance settings: AJP Connector

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.

Page 23: JBossTuning

© JBoss, Inc. 2003-2005 23

Professional Open Source™

Performance settings: Static Resource Cache

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

Page 24: JBossTuning

© JBoss, Inc. 2003-2005 24

Professional Open Source™

Performance settings: String Cache

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

Page 25: JBossTuning

© JBoss, Inc. 2003-2005 25

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>

Page 26: JBossTuning

© JBoss, Inc. 2003-2005 26

Professional Open Source™

Log4J

Page 27: JBossTuning

© JBoss, Inc. 2003-2005 27

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.

Log4J

Page 28: JBossTuning

© JBoss, Inc. 2003-2005 28

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

Log4J

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

Page 29: JBossTuning

© JBoss, Inc. 2003-2005 29

Professional Open Source™

Log4J

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>

Page 30: JBossTuning

© JBoss, Inc. 2003-2005 30

Professional Open Source™

Log4J

you can then remove this fragment also :

<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <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>

Page 31: JBossTuning

© JBoss, Inc. 2003-2005 31

Professional Open Source™

Log4J

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

Page 32: JBossTuning

© JBoss, Inc. 2003-2005 32

Professional Open Source™

Log4J

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>

Page 33: JBossTuning

© JBoss, Inc. 2003-2005 33

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>

Log4J

Page 34: JBossTuning

© JBoss, Inc. 2003-2005 34

Professional Open Source™

Deployment Scanner

Page 35: JBossTuning

© JBoss, Inc. 2003-2005 35

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

Deployment Scanner

Page 36: JBossTuning

© JBoss, Inc. 2003-2005 36

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>

Deployment Scanner

Page 37: JBossTuning

© JBoss, Inc. 2003-2005 37

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>

Deployment Scanner

Page 38: JBossTuning

© JBoss, Inc. 2003-2005 38

Professional Open Source™

Database and SQL Tuning

Page 39: JBossTuning

© JBoss, Inc. 2003-2005 39

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

Database and SQL Tuning

Page 40: JBossTuning

© JBoss, Inc. 2003-2005 40

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

Database and SQL Tuning

Page 41: JBossTuning

© JBoss, Inc. 2003-2005 41

Professional Open Source™

Connector Tuning

Page 42: JBossTuning

© JBoss, Inc. 2003-2005 42

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.

Connector Tuning

Page 43: JBossTuning

© JBoss, Inc. 2003-2005 43

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

Connector Tuning

Page 44: JBossTuning

© JBoss, Inc. 2003-2005 44

Professional Open Source™

Connection Tuning

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>

Page 45: JBossTuning

© JBoss, Inc. 2003-2005 45

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

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.,

Connector Tuning

s

Page 46: JBossTuning

© JBoss, Inc. 2003-2005 46

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.

Connector Tuning

Page 47: JBossTuning

© JBoss, Inc. 2003-2005 47

Professional Open Source™

Connection Tuning

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

Page 48: JBossTuning

© JBoss, Inc. 2003-2005 48

Professional Open Source™

Slimming

Page 49: JBossTuning

© JBoss, Inc. 2003-2005 49

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?)

Slimming

Page 50: JBossTuning

© JBoss, Inc. 2003-2005 50

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

Slimming

Page 51: JBossTuning

© JBoss, Inc. 2003-2005 51

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

Slimming

Page 52: JBossTuning

© JBoss, Inc. 2003-2005 52

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

Slimming

Page 53: JBossTuning

© JBoss, Inc. 2003-2005 53

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

Slimming

Page 54: JBossTuning

© JBoss, Inc. 2003-2005 54

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

Slimming

Page 55: JBossTuning

© JBoss, Inc. 2003-2005 55

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

Slimming

Page 56: JBossTuning

© JBoss, Inc. 2003-2005 56

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

Slimming

Page 57: JBossTuning

© JBoss, Inc. 2003-2005 57

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"/>

Slimming

Page 58: JBossTuning

© JBoss, Inc. 2003-2005 58

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"/>

Slimming

Page 59: JBossTuning

© JBoss, Inc. 2003-2005 59

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.LocalJBossServerDomain"

MBean <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute> and <!-- EAR deployer, remove if you are not using Web layers --> <mbean code="org.jboss.deployment.EARDeployer" name="jboss.j2ee:service=EARDeployer"> </mbean>

Slimming

Page 60: JBossTuning

© JBoss, Inc. 2003-2005 60

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.LocalJBossServerDomain" MBean <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>

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.LocalJBossServerDomain" MBean <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>

Slimming

Page 61: JBossTuning

© JBoss, Inc. 2003-2005 61

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

Slimming

Page 62: JBossTuning

© JBoss, Inc. 2003-2005 62

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

Slimming

Page 63: JBossTuning

© JBoss, Inc. 2003-2005 63

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:

Slimming

Page 64: JBossTuning

© JBoss, Inc. 2003-2005 64

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

Slimming

Page 65: JBossTuning

© JBoss, Inc. 2003-2005 65

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.URLDeploymentScanner" name="jboss.deployment:type=DeploymentScanner,flavor=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.URLDeploymentScanner" name="jboss.deployment:type=DeploymentScanner,flavor=URL"> ... <attribute name="ScanPeriod">5000</attribute> <attribute name="ScanEnabled">False</attribute> ...

Slimming

Page 66: JBossTuning

© JBoss, Inc. 2003-2005 66

Professional Open Source™

Monitoring with Web-Console

Page 67: JBossTuning

© JBoss, Inc. 2003-2005 67

Professional Open Source™

Graphs

Live graphing of attributes:

Page 68: JBossTuning

© JBoss, Inc. 2003-2005 68

Professional Open Source™

Alerts

Alerts on server attributes:

Page 69: JBossTuning

© JBoss, Inc. 2003-2005 69

Professional Open Source™

Tomcat Status

Tomcat Status: