﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-我的程序人生-文章分类-java</title><link>http://www.cppblog.com/yb1682003/category/4483.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 05 Aug 2008 09:33:58 GMT</lastBuildDate><pubDate>Tue, 05 Aug 2008 09:33:58 GMT</pubDate><ttl>60</ttl><item><title>jboss性能优化(2)</title><link>http://www.cppblog.com/yb1682003/articles/52041.html</link><dc:creator>lancey</dc:creator><author>lancey</author><pubDate>Tue, 03 Jun 2008 08:41:00 GMT</pubDate><guid>http://www.cppblog.com/yb1682003/articles/52041.html</guid><wfw:comment>http://www.cppblog.com/yb1682003/comments/52041.html</wfw:comment><comments>http://www.cppblog.com/yb1682003/articles/52041.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yb1682003/comments/commentRss/52041.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yb1682003/services/trackbacks/52041.html</trackback:ping><description><![CDATA[<p><a href="http://wiki.jboss.org/wiki/JBossASTuningSliming">http://wiki.jboss.org/wiki/JBossASTuningSliming</a><br><br></p>
<h3>Preface </h3>
<p>This advice is primarily on how to tune and/or slim <a href="http://wiki.jboss.org/wiki/JBossAS"><u><font color=#0000ff>JBossAS</font></u></a>. The two concepts are orthogonal in most cases. While reducing idle service threads through slimming won't have a large impact on performance, using less memory and resources may allow you to tune other performance aspects. Of course this does reduce startup time. Furthermore, as a general security concept -- remove services you don't use. We will separate the two categories: slimming and tuning. We start by using the default configuration and trimming from there (for clustering that will be the topic of a later wiki page ;-) ). This advice does not involve areas of tuning that crosscut developer and administrative roles (application tuning such as cache sizes). This is primarily advice for administrative tuning.
<p>Note for those concerned that this advice will make a technically non-J2EE-compliant instance of JBoss (3.2.6 is not compliant anyhow) as removing key J2EE services would cause JBoss to fail the TCK. Most performance tuning/administrative tasks done in real-world installations technically fall in this category.
<p>Assume that you have copied the server/default directory and its subdirectories to server/slim.
<p>
<h3>Tuning </h3>
<p>
<h4>Java Virtual Machine </h4>
<p>
<ul>
    <li><a href="http://wiki.jboss.org/wiki/TuneVMGarbageCollection"><u><font color=#0000ff>TuneVMGarbageCollection</font></u></a> or <a href="http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html"><u><font color=#0000ff>Tune JDK 5 Garbage Collection</font></u></a><u><font color=#0000ff><img src="http://wiki.jboss.org/wiki/_WikiButtons/out.png"></font></u> for your machine and memory size
    <li>Use a 64 bit machine and 64 bit VM so that you can use large heap sizes, larger than 2-4GB typically. 64 bit support is available on all recent SPARC/Solaris boxes running Solaris 9 or later, Itanium with JDK 1.4, or JDK 5 on Linux x64.
    <li>DO NOT USE -d64 (64-bit) if you do not use ABOVE the maximum 32 bit heap space (2-4 GB of heap). Using 64 bit addressing requires MORE memory to do the same amount of work and provides no advantage for applications that do not need this much memory.
    <li>Avoid extra large heaps but avoid extra small heaps. (We cannot tell you what qualifies because it depends on what you're doing). This affects generational garbage collection and total time to scan the heap. It is difficult to tune a small heap effectively (even if your app only uses 200MB, if you're using parallel garbage collection + CMS, then you're going to need well above 512MB). Oversize heaps spend needless time scanning memory for garbage collection.
    <li>Avoid the Sun 1.4 VM. JDK 5 is VASTLY better especially in the area of garbage collection.
    <li>Use the -server option but use either of -XX:<u>ThreadStackSize</u><a href="http://wiki.jboss.org/wiki/ThreadStackSize"><u><font color=#0000ff>?</font></u></a>=128k (Solaris) or -Xss128k (every other platform). On Solaris -Xss128k does nothing (you can only set LARGER thread stack sizes). This allows you to create more threads by using less memory per thread but might result in blown stacks with extremely recursive code. Still, 128k stack is still nothing to shake a stick at.
    <li>You really need to understand generational garbage collectors to tune this properly and you really have to do load testing (<u>OpenSTA</u><a href="http://wiki.jboss.org/wiki/OpenSTA"><u><font color=#0000ff>?</font></u></a>, JMeter, etc) to know for sure.
    <li>You really should use a multi-processor machine with more than 2 processors and use various parallel and concurrent garbage collection options (we cover this in Advanced JBoss Training hint hint) for maximum performance and high garbage collector throughput. However, you really need to understand how garbage collection works to tune this well. JDK 5 is mostly self-tuning.
    <li>JDK 1.4's default <a href="http://wiki.jboss.org/wiki/NewSize"><u><font color=#0000ff>NewSize</font></u></a> is not a good guess. Bad rule of thumb: &lt; 20% is a good <a href="http://wiki.jboss.org/wiki/NewSize"><u><font color=#0000ff>NewSize</font></u></a>. Above 20% is dangerous due to a nasty JDK bug which can cause it to psychotically run all full garbage collections and never unsuspend or free up enough memory. JDK 5 does not seem to exhibit this bug and seems to pick more sane defaults. </li>
</ul>
<p>
<h4>JBoss/Java on Linux</h4>
<p>If you are running JBoss AS on a Linux server, you should read this article written by Andrew Oliver, one of JBoss, a division of Red Hat, consultants on <a href="http://developer.redhatmagazine.com/2006/09/18/java-performance-tuning-on-linux-with-andrew-oliver/"><u><font color=#0000ff>how tune JBoss/Java in a Linux server</font></u></a><u><font color=#0000ff><img src="http://wiki.jboss.org/wiki/_WikiButtons/out.png"></font></u>
<p>
<h4>Tomcat </h4>
<p>
<ul>
    <li>Edit your server/slim/jbossweb-tomcat5?.sar/server.xml
    <li>Check the XML document for connectors you are using. For example, the HTTP connector: </li>
</ul>
<p>
<pre>
&lt;Connector port="8080" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/&gt;
</pre>
<p>
<ul>
    <li>You should have enough threads (maxThreads) to handle (rule of thumb) 25% more than your maximum expected load (concurrent hits coming in at once)
    <li>You should have minSpareThreads equal just a little more than your normal load
    <li>You should have maxSpareThreads equal just a little more than your peak load
    <li>
    <pre>minSpareThreads</pre>
    means "on start up, always keep at least this many threads waiting idle"
    <li>
    <pre>maxSpareThreads</pre>
    means "if we ever go above minSpareThreads then always keep maxSpareThreads waiting idle" </li>
</ul>
<p>
<ul>
    <li>Remove any unnecessary valves and logging. If you're not using JBoss's security, remove the security valve (see below).
    <li>Precompile JSPs. (The built-in compiler is fairly fast, it may not be worthwhile for small sites.)
    <li>Turn off "development" mode in you sever/slim/jbossweb-tomcat50.sar/conf/web.xml </li>
</ul>
<p>
<h4>RMI for Remote Invocations </h4>
<p>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 <a href="http://wiki.jboss.org/wiki/PooledInvokerConfig"><u><font color=#0000ff>pooled invoker</font></u></a>.
<p>
<ul>
    <li>Edit server/slim/conf/standardjboss.xml
    <li>Change all of the proxy bindings to the pooled invoker by changing every XML fragment reading: </li>
</ul>
<p>
<pre>
&lt;invoker-mbean&gt;jboss:service=invoker,type=jrmp&lt;/invoker-mbean&gt;
</pre>
<p>to
<p>
<pre>
&lt;invoker-mbean&gt;jboss:service=invoker,type=pooled&lt;/invoker-mbean&gt;
</pre>
<p>JBoss also has a mostly undocumented <a href="http://wiki.jboss.org/wiki/PooledInvokerHA"><u><font color=#0000ff>PooledInvokerHA</font></u></a> you may try.
<p>
<h4>Log4j </h4>
<p>Logging has a profound effect on performance. Changing the logging level to TRACE can bring the <a href="http://wiki.jboss.org/wiki/JBossAS"><u><font color=#0000ff>JBossAS</font></u></a> to a crawl. Changing it to ERROR (or WARN) can speed things up dramatically.
<p>
<ul>
    <li>By default, JBoss logs both to the console and server.log and by default it uses level "INFO".
    <li>Consider not logging to System.out (you may still want to redirect it to catch JVM errors)
    <li>Consider changing the log level to ERROR. Remember that JBoss watches its log4j config file for changes and you can always change configuration at runtime.
    <li>Add a category filter for your Java class hierarchy. </li>
</ul>
<p>To turn off console logging:
<p>
<ul>
    <li>Edit server/slim/conf/log4j.xml
    <li>Change the following XML fragment: </li>
</ul>
<p>
<pre>
&lt;root&gt;
&lt;appender-ref ref=CONSOLE"/&gt;
&lt;appender-ref ref="FILE"/&gt;
&lt;/root&gt;
</pre>
<p>make it read
<p>
<pre>
&lt;root&gt;
&lt;appender-ref ref="FILE"/&gt;
&lt;/root&gt;
</pre>
<p>
<ul>
    <li>You can then remove this fragment: </li>
</ul>
<p>
<pre>
&lt;appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"&gt;
&lt;errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/&gt;
&lt;param name="Target" value="System.out"/&gt;
&lt;param name="Threshold" value="INFO"/&gt;
&lt;layout class="org.apache.log4j.PatternLayout"&gt;
&lt;!-- The default pattern: Date Priority [Category] Message\n --&gt;
&lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/&gt;
&lt;/layout&gt;
&lt;/appender&gt;
</pre>
<p>To change the log level:
<p>
<ul>
    <li>Edit server/slim/conf/log4j.xml
    <li>Remove/comment these XML fragments: </li>
</ul>
<p>
<pre>
&lt;category name="org.apache"&gt;
&lt;priority value="INFO"/&gt;
&lt;/category&gt;
&lt;!-- Limit org.jgroups category to INFO --&gt;
&lt;category name="org.jgroups"&gt;
&lt;priority value="INFO"/&gt;
&lt;/category&gt;
</pre>
<p>
<ul>
    <li>Change the root category by changing this XML fragment: </li>
</ul>
<p>
<pre>
&lt;root&gt;
&lt;appender-ref ref="CONSOLE"/&gt; &lt;!-- you may have removed this earlier --&gt;
&lt;appender-ref ref="FILE"/&gt;
&lt;/root&gt;
</pre>
<p>to look like this
<p>
<pre>
&lt;root&gt;
&lt;priority value="ERROR" /&gt;
&lt;appender-ref ref="CONSOLE"/&gt; &lt;!-- you may have removed this earlier --&gt;
&lt;appender-ref ref="FILE"/&gt;
&lt;/root&gt;
</pre>
<p>And finally, probably the most important thing in log4j, make sure you limit the logging level on <strong>your own class hierarchy</strong>. 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
<pre>if (log.isDebugEnabled())...</pre>
<p>. 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: </p>
<p>
<pre>
&lt;!-- Limit a.b category to INFO --&gt;
&lt;category name="a.b"&gt;
&lt;priority value="INFO"/&gt;
&lt;/category&gt;
</pre>
<p>This can be added in the same area where you find the category filters for org.apache and org.jboss (see above).
<p>
<p>
<h4>Deployment Scanner </h4>
<p>
<ul>
    <li>The deployment scanner scanning every 5 seconds eats up cycles especially on systems with a slow filesystem (*cough* NTFS *cough*).
    <li>See the below slimming stuff on how to turn the number of seconds such that it happens less frequently or not at all </li>
</ul>
<p>
<h4>Stateless Session Beans </h4>
<p>
<ul>
    <li>EJB 1.x-2.x stateless session beans operate with an ill-advised pooling model (required by the specification). If you find that you need more than the default (10) instances consider setting the minimum pool size: </li>
</ul>
<p>edit
<pre>server/slim/conf/standardjboss.xml</pre>
<p>, scroll down to: </p>
<pre>
&lt;container-configuration&gt;
&lt;container-name&gt;Standard Stateless SessionBean&lt;/container-name&gt;
&lt;call-logging&gt;false&lt;/call-logging&gt;
&lt;invoker-proxy-binding-name&gt;stateless-rmi-invoker&lt;/invoker-proxy-binding-name&gt;
&lt;container-interceptors&gt;
</pre>
<p>and find:
<p>
<pre>
&lt;container-pool-conf&gt;
&lt;MaximumSize&gt;100&lt;/MaximumSize&gt;
&lt;/container-pool-conf&gt;
&lt;/container-configuration&gt;
</pre>
<p>change it to read:
<p>
<pre>
&lt;container-pool-conf&gt;
&lt;MinimumSize&gt;100&lt;/MinimumSize&gt;
&lt;MaximumSize&gt;100&lt;/MaximumSize&gt;
&lt;strictMaximumSize/&gt;
&lt;strictTimeout&gt;30000&lt;/strictTimeout&gt;
&lt;/container-pool-conf&gt;
&lt;/container-configuration&gt;
</pre>
<p>For the most part a server environment doesn't want these pools growing and shrinking (because it causes memory-fragmentation and thats worse than latent heap usage). From a performance standpoint, the nuber should be big enough to serve all your requests with no blocking.
<p>
<h4>CMP tuning </h4>
<p>
<ul>
    <li>Read this: http://www.artima.com/forums/flat.jsp?forum=141&amp;thread=24532
    <li>and this: http://www.onjava.com/pub/a/onjava/2003/05/28/jboss_optimization.html
    <li>now ditch CMP and use <a href="http://wiki.jboss.org/wiki/JBossHibernate"><u><font color=#0000ff>JBossHibernate</font></u></a> instead </li>
</ul>
<p>
<h4>Connection Pools </h4>
<p>
<ul>
    <li>Don't use XA versions unless you really know you need them. XA connections do not have good performance.
    <li>Use database specific "ping" support where available for "check-connection" or use database-specific driver fail-over support rather than checking connections at all. (remember that not all tuning options may be feasible in your environment, we're talking optimal) </li>
</ul>
<p>
<p>
<h3>Slimming </h3>
<p>
<h4>When not using the mail-service (J2EE standard <a href="http://wiki.jboss.org/wiki/JavaMail"><u><font color=#0000ff>JavaMail</font></u></a> client) </h4>
<p>
<ul>
    <li>remove server/slim/deploy/mail-service.xml
    <li>remove server/slim/lib/mail* (mail-plugin.jar, mail.jar - <a href="http://wiki.jboss.org/wiki/JavaMail"><u><font color=#0000ff>JavaMail</font></u></a> stuff)
    <li>remove server/slim/lib/activation.jar (Java Activation Framework is used by <a href="http://wiki.jboss.org/wiki/JavaMail"><u><font color=#0000ff>JavaMail</font></u></a>) </li>
</ul>
<p>
<h4>When not using the cache invalidation service (used for CMP Option A beans with Cache Invalidation usually in a clustered configuration) </h4>
<p>
<ul>
    <li>remove server/slim/deloy/cache-invalidation-service.xml </li>
</ul>
<p>
<h4>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) </h4>
<p>
<ul>
    <li>remove server/slim/deploy/client-deployer-service.xml </li>
</ul>
<p>
<h4>When not using the integrated HAR deployer and Hibernate session management services </h4>
<p>
<ul>
    <li>remove server/slim/deploy/hibernate-deployer-service.xml (HAR support)
    <li>remove server/slim/lib/jboss-hibernate.jar (HAR support)
    <li>remove server/slim/lib/hibernate2.jar (Hibernate itself)
    <li>remove server/slim/lib/cglib-full-2.0.1.jar (used by Hibernate to create proxies of POJOs)
    <li>remove server/slim/lib/odmg-3.0.jar (some goofy object-relational mapping thing used by hibernate from some goofy committee http://www.service-architecture.com/database/articles/odmg_3_0.html) </li>
</ul>
<p>
<h4>When not using Hypersonic (which you should not in production) </h4>
<p>Note that <a href="http://wiki.jboss.org/wiki/JBossMQ"><u><font color=#0000ff>JBossMQ</font></u></a> as deployed in the default configuration uses <a href="http://wiki.jboss.org/wiki/DefaultDS"><u><font color=#0000ff>DefaultDS</font></u></a> with mappings for Hypersonic. See <a href="http://wiki.jboss.org/wiki/ConfigJBossMQPersistence"><u><font color=#0000ff>JBoss MQ Persistence Wiki pages</font></u></a> for more information on configuring other alternatives.
<p>
<ul>
    <li>remove server/slim/deploy/hsqldb-ds.xml
    <li>remove server/slim/lib/hsqldb-plugin.jar
    <li>remove server/slim/lib/hsqldb.jar </li>
</ul>
<p>
<h4>When not using <a href="http://wiki.jboss.org/wiki/JBossMQ"><u><font color=#0000ff>JBossMQ</font></u></a> (our JMS server) </h4>
<p>
<ul>
    <li>remove the entire server/slim/deploy/jms directory
    <li>remove server/slim/lib/jbossmq.jar </li>
</ul>
<p>
<h4>When not using the HTTPInvoker (which lets you tunnel RMI over HTTP) </h4>
<p>
<ul>
    <li>remove the entire server/slim/deploy/http-invoker.sar directory </li>
</ul>
<p>
<h4>When not using XA datasources (Distributed and/or recoverable transactions) </h4>
<p>
<ul>
    <li>remove server/slim/deploy/jboss-xa-jdbc.rar </li>
</ul>
<p>
<h4>If you do not need the JMX-Console then remove it </h4>
<p>
<ul>
    <li>remove server/slim/deploy/jmx-console.war
    <li>Otherwise <a href="http://wiki.jboss.org/wiki/SecureTheJmxConsole"><u><font color=#0000ff>Secure it</font></u></a> </li>
</ul>
<p>
<h4>If you do not need to make JMX calls over RMI (warning the shutdown.sh DOES do this) </h4>
<p>
<ul>
    <li>remove server/slim/deploy/jmx-invoker-adaptor-server.sar
    <li>remove server/slim/deploy/jmx-adaptor-plugin.jar
    <li>or you may want to just <a href="http://wiki.jboss.org/wiki/SecureTheInvokers"><u><font color=#0000ff>secure the JMX invoker-adaptor</font></u></a> instead </li>
</ul>
<p>
<h4>If you do not need the web-console </h4>
<p>
<ul>
    <li>remove server/slim/deploy/management/web-console.war </li>
</ul>
<p>
<h4>If you do not need JSR-77 extensions for JMX </h4>
<p>
<ul>
    <li>remove server/slim/deploy/management/console-mgr.sar </li>
</ul>
<p>
<h4>If you need neither the web-console or jsr-77 extensions </h4>
<p>
<ul>
    <li>remove server/slim/deploy/management directory entirely </li>
</ul>
<p>
<h4>If you are not using console/email monitor alerts </h4>
<p>
<ul>
    <li>remove server/slim/deploy/monitoring-service.xml
    <li>remove server/slim/lib/jboss-monitoring.jar </li>
</ul>
<p>
<h4>If you are not using rich property editors (JMX) or loading properties into system properties via the Properties Service </h4>
<p>
<ul>
    <li>remove server/slim/deploy/properties-service.xml
    <li>remove server/slim/lib/properties-plugin.jar </li>
</ul>
<p>
<h4>The scheduler-service.xml is an example unless you have put your own in it </h4>
<p>
<ul>
    <li>remove server/slim/deploy/scheduler-service.xml </li>
</ul>
<p>
<h4>If you are not using the JBoss Scheduler Manager (allows you to schedule invocations against MBeans) </h4>
<p>
<ul>
    <li>remove server/slim/deploy/schedule-manager-service.xml
    <li>remove server/slim/lib/scheduler-plugin* (scheduler-plugin.jar, scheduler-plugin-example.jar) </li>
</ul>
<p>
<h4>If you do not need vendor-specific sql exception handing (just leave it, really) </h4>
<p>
<ul>
    <li>remove server/slim/deploy/sqlexception-service.xml </li>
</ul>
<p>
<h4>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-&gt;DB User -- using this means you are a bad person and need to be smacked) </h4>
<p>
<ul>
    <li>remove server/slim/deploy/user-service.xml </li>
</ul>
<p>
<h4>If you do not use JBoss UUID key generation (often used with CMP primary keys, but we have database specific support as well) </h4>
<p>
<ul>
    <li>remove server/slim/deploy/uuid-key-generator.sar
    <li>remove server/slim/lib/autonumber-plugin.jar </li>
</ul>
<p>
<h4>user-service.xml is an example -- unless you put something in it (your own mbeans) you can always remove it. </h4>
<p>
<ul>
    <li>remove server/slim/deploy/user-service.xml </li>
</ul>
<p>
<h4>If your users directly connect to Tomcat via HTTP and do not pass through Apache/mod_jk: </h4>
<p>
<ul>
    <li>open server/slim/deploy/jbossweb-tomcat50.sar/server.xml in the vi editor
    <li>remove/comment the following XML fragment: </li>
</ul>
<p>
<pre>
&lt;!-- A AJP 1.3 Connector on port 8009 --&gt;
&lt;Connector port="8009" address="${jboss.bind.address}"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3"/&gt;
</pre>
<p>
<h4>If your users do not directly connect to Tomcat via HTTP and always pass through Apache/mod_jk </h4>
<p>
<ul>
    <li>open server/slim/deploy/jbossweb-tomcat50.sar/server.xml in the vi editor
    <li>remove/comment the following XML fragment: </li>
</ul>
<p>
<pre>
&lt;!-- A HTTP/1.1 Connector on port 8080 --&gt;
&lt;Connector port="8080" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/&gt;
</pre>
<p>
<h4>If you do not need to be able to deploy EAR files </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in the vi editor
    <li>remove/comment the following XML fragments from the </li>
</ul>
<p>from under the
<pre>&lt;mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"</pre>
<p>MBean </p>
<pre>
&lt;attribute name="EARDeployer"&gt;jboss.j2ee:service=EARDeployer&lt;/attribute&gt;
</pre>
<p>and
<p>
<pre>
&lt;!-- EAR deployer, remove if you are not using Web layers --&gt;
&lt;mbean code="org.jboss.deployment.EARDeployer" name="jboss.j2ee:service=EARDeployer"&gt;
&lt;/mbean&gt;
</pre>
<p>
<h4>If you do not need to be able to deploy JMS Queues </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in the vi editor
    <li>remove/comment the following XML fragments from the </li>
</ul>
<p>from under the
<pre>&lt;mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"</pre>
<p>MBean </p>
<pre>
&lt;attribute name="JMSService"&gt;jboss.mq:service=DestinationManager&lt;/attribute&gt;
</pre>
<p>
<p>
<h4>If you do not need to use CORBA/IIOP </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in the vi editor
    <li>remove/comment the following XML fragments from the </li>
</ul>
<p>from under the
<pre>&lt;mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"</pre>
<p>MBean </p>
<pre>
&lt;attribute name="RMI_IIOPService"&gt;jboss:service=CorbaORB&lt;/attribute&gt;
</pre>
<p>
<h4>If you removed the user-transaction-service.xml </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in the vi editor
    <li>remove/comment the following XML fragments from the </li>
</ul>
<p>from under the
<pre>&lt;mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"</pre>
<p>MBean </p>
<pre>
&lt;attribute name="UserTransactionService"&gt;jboss:service=ClientUserTransaction&lt;/attribute&gt;
</pre>
<p>
<h4>If you do not need JSR-77 support (tried to make JBoss, Weblogic and Websphere support some basic similar JMX monitoring) you can remove/comment the entire fragment from server/slim/conf/jboss-service.xml: </h4>
<p>
<pre>
&lt;!-- ==================================================================== --&gt;
&lt;!-- JSR-77 Single JBoss Server Management Domain --&gt;
&lt;!-- ==================================================================== --&gt;
&lt;mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
name="jboss.management.local:j2eeType=J2EEDomain,name=Manager"&gt;
&lt;attribute name="MainDeployer"&gt;jboss.system:service=MainDeployer&lt;/attribute&gt;
&lt;attribute name="SARDeployer"&gt;jboss.system:service=ServiceDeployer&lt;/attribute&gt;
&lt;!-- &lt;attribute name="EARDeployer"&gt;jboss.j2ee:service=EARDeployer&lt;/attribute&gt;--&gt;
&lt;attribute name="EJBDeployer"&gt;jboss.ejb:service=EJBDeployer&lt;/attribute&gt;
&lt;attribute name="RARDeployer"&gt;jboss.jca:service=RARDeployer&lt;/attribute&gt;
&lt;attribute name="CMDeployer"&gt;jboss.jca:service=ConnectionFactoryDeployer&lt;/attribute&gt;
&lt;attribute name="WARDeployer"&gt;jboss.web:service=WebServer&lt;/attribute&gt;
&lt;attribute name="MailService"&gt;jboss:service=Mail&lt;/attribute&gt;
&lt;!-- &lt;attribute name="JMSService"&gt;jboss.mq:service=DestinationManager&lt;/attribute&gt;--&gt;
&lt;attribute name="JNDIService"&gt;jboss:service=Naming&lt;/attribute&gt;
&lt;attribute name="JTAService"&gt;jboss:service=TransactionManager&lt;/attribute&gt;
&lt;!-- &lt;attribute name="UserTransactionService"&gt;jboss:service=ClientUserTransaction&lt;/attribute&gt;
&lt;attribute name="RMI_IIOPService"&gt;jboss:service=CorbaORB&lt;/attribute&gt;--&gt;
&lt;/mbean&gt;
</pre>
<p>
<h4>If you do not need client-side transaction management (remember that using this means you're a bad person) </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in the vi editor
    <li>remove/comment the following XML fragments </li>
</ul>
<p>
<pre>
&lt;!--
| UserTransaction support.
--&gt;
&lt;mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"
name="jboss:service=ClientUserTransaction"
xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml"&gt;
&lt;depends&gt;
&lt;mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="jboss:service=proxyFactory,target=ClientUserTransactionFactory"&gt;
&lt;attribute name="InvokerName"&gt;jboss:service=invoker,type=jrmp&lt;/attribute&gt;
&lt;attribute name="TargetName"&gt;jboss:service=ClientUserTransaction&lt;/attribute&gt;
&lt;attribute name="JndiName"&gt;UserTransactionSessionFactory&lt;/attribute&gt;
&lt;attribute name="ExportedInterface"&gt;
org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory
&lt;/attribute&gt;
&lt;attribute name="ClientInterceptors"&gt;
&lt;interceptors&gt;
&lt;interceptor&gt;org.jboss.proxy.ClientMethodInterceptor&lt;/interceptor&gt;
&lt;interceptor&gt;org.jboss.invocation.InvokerInterceptor&lt;/interceptor&gt;
&lt;/interceptors&gt;
&lt;/attribute&gt;
&lt;depends&gt;jboss:service=invoker,type=jrmp&lt;/depends&gt;
&lt;/mbean&gt;
&lt;/depends&gt;
&lt;depends optional-attribute-name="TxProxyName"&gt;
&lt;mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="jboss:service=proxyFactory,target=ClientUserTransaction"&gt;
&lt;attribute name="InvokerName"&gt;jboss:service=invoker,type=jrmp&lt;/attribute&gt;
&lt;attribute name="TargetName"&gt;jboss:service=ClientUserTransaction&lt;/attribute&gt;
&lt;attribute name="JndiName"&gt;&lt;/attribute&gt;
&lt;attribute name="ExportedInterface"&gt;
org.jboss.tm.usertx.interfaces.UserTransactionSession
&lt;/attribute&gt;
&lt;attribute name="ClientInterceptors"&gt;
&lt;interceptors&gt;
&lt;interceptor&gt;org.jboss.proxy.ClientMethodInterceptor&lt;/interceptor&gt;
&lt;interceptor&gt;org.jboss.invocation.InvokerInterceptor&lt;/interceptor&gt;
&lt;/interceptors&gt;
&lt;/attribute&gt;
&lt;depends&gt;jboss:service=invoker,type=jrmp&lt;/depends&gt;
&lt;/mbean&gt;
&lt;/depends&gt;
&lt;/mbean&gt;
</pre>
<ul>
    <li>you can now remove server/slim/conf/xmdesc/ClientUserTransaction-xmbean.xml since its not referenced </li>
</ul>
<p>
<h4>if you do not need persistent MBean attributes (no JBoss MBeans use this by default...yet) </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in the vi editor
    <li>remove/comment this XML fragment </li>
</ul>
<p>
<pre>
&lt;!-- ==================================================================== --&gt;
&lt;!-- XMBean Persistence --&gt;
&lt;!-- ==================================================================== --&gt;
&lt;mbean code="org.jboss.system.pm.AttributePersistenceService"
name="jboss:service=AttributePersistenceService"
xmbean-dd="resource:xmdesc/AttributePersistenceService-xmbean.xml"&gt;
&lt;attribute name="AttributePersistenceManagerClass"&gt;
org.jboss.system.pm.XMLAttributePersistenceManager
&lt;/attribute&gt;
&lt;attribute name="AttributePersistenceManagerConfig"&gt;
&lt;data-directory&gt;data/xmbean-attrs&lt;/data-directory&gt;
&lt;/attribute&gt;
&lt;attribute name="ApmDestroyOnServiceStop"&gt;false&lt;/attribute&gt;
&lt;attribute name="VersionTag"&gt;&lt;/attribute&gt;
&lt;/mbean&gt;
</pre>
<ul>
    <li>you can also remove server/slim/conf/xmdec/xmdesc/AttributePersistenceService-xmbean.xml since it is no longer referenced </li>
</ul>
<p>
<h4>If you do not use RMI Classloading (for loading codebases from the client using the classes on the server) </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in the vi editor
    <li>remove/comment this XML fragment </li>
</ul>
<p>
<pre>
&lt;!-- ==================================================================== --&gt;
&lt;!-- JBoss RMI Classloader - only install when available --&gt;
&lt;!-- ==================================================================== --&gt;
&lt;mbean code="org.jboss.util.property.jmx.SystemPropertyClassValue"
name="jboss.rmi:type=RMIClassLoader"&gt;
&lt;attribute name="Property"&gt;java.rmi.server.RMIClassLoaderSpi&lt;/attribute&gt;
&lt;attribute name="ClassName"&gt;org.jboss.system.JBossRMIClassLoader&lt;/attribute&gt;
&lt;/mbean&gt;
</pre>
<p>and
<p>
<pre>
&lt;!-- ==================================================================== --&gt;
&lt;!-- Class Loading --&gt;
&lt;!-- ==================================================================== --&gt;
&lt;mbean code="org.jboss.web.WebService"
name="jboss:service=WebService"&gt;
&lt;attribute name="Port"&gt;8083&lt;/attribute&gt;
&lt;!-- Should resources and non-EJB classes be downloadable --&gt;
&lt;attribute name="DownloadServerClasses"&gt;true&lt;/attribute&gt;
&lt;attribute name="Host"&gt;${jboss.bind.address}&lt;/attribute&gt;
&lt;attribute name="BindAddress"&gt;${jboss.bind.address}&lt;/attribute&gt;
&lt;/mbean&gt;
</pre>
<p>
<ul>
    <li>and change this XML fragment (<strong>NOTE:</strong> In JBoss 4.0, this is located in the file <tt>server/slim/deploy/ejb-deployer.xml</tt>): </li>
</ul>
<p>
<pre>
&lt;!-- EJB deployer, remove to disable EJB behavior--&gt;
&lt;mbean code="org.jboss.ejb.EJBDeployer" name="jboss.ejb:service=EJBDeployer"&gt;
&lt;attribute name="VerifyDeployments"&gt;true&lt;/attribute&gt;
...
&lt;depends optional-attribute-name="WebServiceName"&gt;jboss:service=WebService&lt;/depends&gt;
&lt;/mbean&gt;
</pre>
<p>to read like this:
<p>
<pre>
&lt;!-- EJB deployer, remove to disable EJB behavior--&gt;
&lt;mbean code="org.jboss.ejb.EJBDeployer" name="jboss.ejb:service=EJBDeployer"&gt;
&lt;attribute name="VerifyDeployments"&gt;true&lt;/attribute&gt;
...
&lt;!-- &lt;depends optional-attribute-name="WebServiceName"&gt;jboss:service=WebService&lt;/depends&gt; --&gt;
&lt;/mbean&gt;
</pre>
<p>or alternatively remove the <u>WebServiceName</u><a href="http://wiki.jboss.org/wiki/WebServiceName"><u><font color=#0000ff>?</font></u></a> depends/attribute.
<p>
<p>
<h4>If you only want to use JBoss Naming locally (no RMI clients) </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in vi
    <li>change the following XML fragment </li>
</ul>
<p>
<pre>
&lt;!-- ==================================================================== --&gt;
&lt;!-- JNDI --&gt;
&lt;!-- ==================================================================== --&gt;
&lt;mbean code="org.jboss.naming.NamingService"
name="jboss:service=Naming"
xmbean-dd="resource:xmdesc/NamingService-xmbean.xml"&gt;
...
&lt;!-- The listening port for the bootstrap JNP service. Set this to -1
to run the NamingService without the JNP invoker listening port.
--&gt;
&lt;attribute name="Port"&gt;1099&lt;/attribute&gt;
...
&lt;!-- The port of the RMI naming service, 0 == anonymous --&gt;
&lt;attribute name="RmiPort"&gt;1098&lt;/attribute&gt;
...
&lt;/mbean&gt;
</pre>
<p>To read
<p>
<pre>
&lt;!-- ==================================================================== --&gt;
&lt;!-- JNDI --&gt;
&lt;!-- ==================================================================== --&gt;
&lt;mbean code="org.jboss.naming.NamingService"
name="jboss:service=Naming"
xmbean-dd="resource:xmdesc/NamingService-xmbean.xml"&gt;
...
&lt;!-- The listening port for the bootstrap JNP service. Set this to -1
to run the NamingService without the JNP invoker listening port.
--&gt;
&lt;attribute name="Port"&gt;-1&lt;/attribute&gt;
...
&lt;!-- The port of the RMI naming service, 0 == anonymous --&gt;
&lt;attribute name="RmiPort"&gt;0&lt;/attribute&gt;
...
&lt;/mbean&gt;
</pre>
<p>The <a href="http://wiki.jboss.org/wiki/RmiPort"><u><font color=#0000ff>RmiPort</font></u></a> is mostly optional but it means we won't bind to 1098 so that can be helpful.
<p>You may also want to remove the thread pool associated by removing this line from the same XML block:
<p>
<pre>
&lt;depends optional-attribute-name="LookupPool"
proxy-type="attribute"&gt;jboss.system:service=ThreadPool&lt;/depends&gt;
</pre>
<p>and the thread pool block itself:
<p>
<pre>
&lt;!-- A Thread pool service --&gt;
&lt;mbean code="org.jboss.util.threadpool.BasicThreadPool"
name="jboss.system:service=ThreadPool"&gt;
&lt;attribute name="Name"&gt;JBoss System Threads&lt;/attribute&gt;
&lt;attribute name="ThreadGroupName"&gt;System Threads&lt;/attribute&gt;
&lt;attribute name="KeepAliveTime"&gt;60000&lt;/attribute&gt;
&lt;attribute name="MinimumPoolSize"&gt;1&lt;/attribute&gt;
&lt;attribute name="MaximumPoolSize"&gt;10&lt;/attribute&gt;
&lt;attribute name="MaximumQueueSize"&gt;1000&lt;/attribute&gt;
&lt;attribute name="BlockingMode"&gt;run&lt;/attribute&gt;
&lt;/mbean&gt;
</pre>
<p>
<h4>The JNDIView MBean (shows the JNDI naming tree) is increadibly useful from the JMX Console if you want to use it, but if you don't </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in vi
    <li>remove </li>
</ul>
<p>
<pre>
&lt;mbean code="org.jboss.naming.JNDIView"
name="jboss:service=JNDIView"
xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml"&gt;
&lt;/mbean&gt;
</pre>
<ul>
    <li>you can also remove server/slim/conf/xmdesc/JNDIView-xmbean.xml </li>
</ul>
<p>
<p>
<h4>If you do not use <a href="http://wiki.jboss.org/wiki/JBossSX"><u><font color=#0000ff>JBossSX</font></u></a>, 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): </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in vi
    <li>remove </li>
</ul>
<p>
<pre>
&lt;!-- ==================================================================== --&gt;
&lt;!-- Security --&gt;
&lt;!-- ==================================================================== --&gt;
&lt;!--
&lt;mbean code="org.jboss.security.plugins.SecurityConfig"
name="jboss.security:service=SecurityConfig"&gt;
&lt;attribute name="LoginConfig"&gt;jboss.security:service=XMLLoginConfig&lt;/attribute&gt;
&lt;/mbean&gt;
&lt;mbean code="org.jboss.security.auth.login.XMLLoginConfig"
name="jboss.security:service=XMLLoginConfig"&gt;
&lt;attribute name="ConfigResource"&gt;login-config.xml&lt;/attribute&gt;
&lt;/mbean&gt;
</pre>
<p>
<ul>
    <li>edit server/slim/deploy/jbossweb-tomcatxx.sar/META-INF/jboss-service.xml and comment out these fragments: </li>
</ul>
<p>
<pre>
&lt;!-- The JAAS security domain to use in the absense of an explicit
security-domain specification in the war WEB-INF/jboss-web.xml
--&gt;
&lt;!-- &lt;attribute name="DefaultSecurityDomain"&gt;java:/jaas/other&lt;/attribute&gt;--&gt;
</pre>
<p>and
<p>
<pre>
&lt;!-- A mapping to the server security manager service which must be
operation compatible with type
org.jboss.security.plugins.JaasSecurityManagerServiceMBean. This is only
needed if web applications are allowed to flush the security manager
authentication cache when the web sessions invalidate.
--&gt;
&lt;!-- &lt;depends optional-attribute-name="SecurityManagerService"
proxy-type="attribute"&gt;jboss.security:service=JaasSecurityManager
&lt;/depends&gt;--&gt;
</pre>
<p>
<ul>
    <li>also remove/comment: </li>
</ul>
<p>
<pre>
&lt;!-- JAAS security manager and realm mapping --&gt; &lt;mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
name="jboss.security:service=JaasSecurityManager"&gt;
&lt;attribute name="SecurityManagerClassName"&gt;
org.jboss.security.plugins.JaasSecurityManager
&lt;/attribute&gt;
&lt;attribute name="DefaultCacheTimeout"&gt;1800&lt;/attribute&gt;
&lt;attribute name="DefaultCacheResolution"&gt;60&lt;/attribute&gt;
&lt;/mbean&gt;
</pre>
<p>
<ul>
    <li>If you're using <a href="http://wiki.jboss.org/wiki/JBossMQ"><u><font color=#0000ff>JBossMQ</font></u></a> you'll need to either remove (preferred) all test queues/topics from server/slim/deploy/jms/jbossmq-destinations-service.xml or comment out their security information. Add comments like the following if you choose to keep the example topics/queues: </li>
</ul>
<p>
<pre>
&lt;mbean code="org.jboss.mq.server.jmx.Topic"
name="jboss.mq.destination:service=Topic,name=testTopic"&gt;
&lt;depends optional-attribute-name="DestinationManager"&gt;jboss.mq:service=DestinationManager&lt;/depends&gt;
&lt;!-- &lt;depends optional-attribute-name="SecurityManager"&gt;jboss.mq:service=SecurityManager&lt;/depends&gt;
&lt;attribute name="SecurityConf"&gt;
&lt;security&gt;
&lt;role name="guest" read="true" write="true"/&gt;
&lt;role name="publisher" read="true" write="true" create="false"/&gt;
&lt;role name="durpublisher" read="true" write="true" create="true"/&gt;
&lt;/security&gt;
&lt;/attribute&gt;--&gt;
&lt;/mbean&gt;
&lt;mbean code="org.jboss.mq.server.jmx.Topic"
name="jboss.mq.destination:service=Topic,name=testTopic"&gt;
&lt;depends optional-attribute-name="DestinationManager"&gt;jboss.mq:service=DestinationManager&lt;/depends&gt;
&lt;!-- &lt;depends optional-attribute-name="SecurityManager"&gt;jboss.mq:service=SecurityManager&lt;/depends&gt;
&lt;attribute name="SecurityConf"&gt;
&lt;security&gt;
&lt;role name="guest" read="true" write="true"/&gt;
&lt;role name="publisher" read="true" write="true" create="false"/&gt;
&lt;role name="durpublisher" read="true" write="true" create="true"/&gt;
&lt;/security&gt;
&lt;/attribute&gt;--&gt;
&lt;/mbean&gt;
&lt;mbean code="org.jboss.mq.server.jmx.Topic"
name="jboss.mq.destination:service=Topic,name=testDurableTopic"&gt;
&lt;depends optional-attribute-name="DestinationManager"&gt;jboss.mq:service=DestinationManager&lt;/depends&gt;
&lt;!--
&lt;depends optional-attribute-name="SecurityManager"&gt;jboss.mq:service=SecurityManager&lt;/depends&gt;
&lt;attribute name="SecurityConf"&gt;
&lt;security&gt;
&lt;role name="guest" read="true" write="true"/&gt;
&lt;role name="publisher" read="true" write="true" create="false"/&gt;
&lt;role name="durpublisher" read="true" write="true" create="true"/&gt;
&lt;/security&gt;
&lt;/attribute&gt;--&gt;
&lt;/mbean&gt;
&lt;mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=testQueue"&gt;
&lt;depends optional-attribute-name="DestinationManager"&gt;jboss.mq:service=DestinationManager&lt;/depends&gt;
&lt;!--
&lt;depends optional-attribute-name="SecurityManager"&gt;jboss.mq:service=SecurityManager&lt;/depends&gt;
&lt;attribute name="SecurityConf"&gt;
&lt;security&gt;
&lt;role name="guest" read="true" write="true"/&gt;
&lt;role name="publisher" read="true" write="true" create="false"/&gt;
&lt;role name="noacc" read="false" write="false" create="false"/&gt;
&lt;/security&gt;
&lt;/attribute&gt;--&gt;
&lt;/mbean&gt;
</pre>
<p>
<ul>
    <li>if using <a href="http://wiki.jboss.org/wiki/JBossMQ"><u><font color=#0000ff>JBossMQ</font></u></a> you'll also need to edit server/slim/deploy/jms/jbossmq-service.xml and change the <u>InterceptorLoader</u><a href="http://wiki.jboss.org/wiki/InterceptorLoader"><u><font color=#0000ff>?</font></u></a> XML fragment to read like this: </li>
</ul>
<p>
<pre>
&lt;mbean code="org.jboss.mq.server.jmx.InterceptorLoader" name="jboss.mq:service=TracingInterceptor"&gt;
&lt;attribute name="InterceptorClass"&gt;org.jboss.mq.server.TracingInterceptor&lt;/attribute&gt;
&lt;depends optional-attribute-name="NextInterceptor"&gt;jboss.mq:service=DestinationManager&lt;/depends&gt;
&lt;!--
&lt;depends optional-attribute-name="NextInterceptor"&gt;jboss.mq:service=SecurityManager&lt;/depends&gt;
--&gt;
&lt;/mbean&gt;
</pre>
<p>
<ul>
    <li>you'll also need to comment out or remove (from server/slim/deploy/jms/jbossmq-service.xml): </li>
</ul>
<p>
<pre>
&lt;!-- &lt;mbean code="org.jboss.mq.security.SecurityManager" name="jboss.mq:service=SecurityManager"&gt;
&lt;attribute name="DefaultSecurityConfig"&gt;
&lt;security&gt;
&lt;role name="guest" read="true" write="true" create="true"/&gt;
&lt;/security&gt;
&lt;/attribute&gt;
&lt;attribute name="SecurityDomain"&gt;java:/jaas/jbossmq&lt;/attribute&gt;
&lt;depends optional-attribute-name="NextInterceptor"&gt;jboss.mq:service=DestinationManager&lt;/depends&gt;
&lt;/mbean&gt;
--&gt;
</pre>
<p>
<ul>
    <li>alter the dead letter queue entry (server/slim/deploy/jms/jbossmq-service.xml) by commenting out the security stuff: </li>
</ul>
<p>
<pre>
&lt;!-- Dead Letter Queue --&gt;
&lt;mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=DLQ"&gt;
&lt;depends optional-attribute-name="DestinationManager"&gt;jboss.mq:service=DestinationManager&lt;/depends&gt;
&lt;!--
&lt;depends optional-attribute-name="SecurityManager"&gt;jboss.mq:service=SecurityManager&lt;/depends&gt;--&gt;
&lt;/mbean&gt;
</pre>
<p>
<ul>
    <li>in server/slim/deploy/jms/jms-ds.xml alter the <a href="http://wiki.jboss.org/wiki/JmsXA"><u><font color=#0000ff>JmsXA</font></u></a> entry to read as follows: </li>
</ul>
<p>
<pre>
&lt;!-- JMS XA Resource adapter, use this to get transacted JMS in beans --&gt;
&lt;tx-connection-factory&gt;
&lt;jndi-name&gt;JmsXA&lt;/jndi-name&gt;
&lt;xa-transaction/&gt;
&lt;adapter-display-name&gt;JMS Adapter&lt;/adapter-display-name&gt;
&lt;config-property name="SessionDefaultType" type="java.lang.String"&gt;javax.jms.Topic&lt;/config-property&gt;
&lt;config-property name="JmsProviderAdapterJNDI" type="java.lang.String"&gt;java:/DefaultJMSProvider&lt;/config-property&gt;
&lt;max-pool-size&gt;20&lt;/max-pool-size&gt;
&lt;!--
&lt;security-domain-and-application&gt;JmsXARealm&lt;/security-domain-and-application&gt;--&gt;
&lt;/tx-connection-factory&gt;
</pre>
<p>
<ul>
    <li>If using JBoss 4, also do this 2 things:
    <li>in conf/login-config.xml, comment as follows: </li>
</ul>
<p>
<pre>&lt;!-- Security domains for testing new jca framework
&lt;application-policy name = "HsqlDbRealm"&gt;
&lt;authentication&gt;
&lt;login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
flag = "required"&gt;
&lt;module-option name = "principal"&gt;sa&lt;/module-option&gt;
&lt;module-option name = "userName"&gt;sa&lt;/module-option&gt;
&lt;module-option name = "password"&gt;&lt;/module-option&gt;
&lt;module-option name = "managedConnectionFactoryName"&gt;
jboss.jca:service=LocalTxCM,name=DefaultDS
&lt;/module-option&gt;
&lt;/login-module&gt;
&lt;/authentication&gt;
&lt;/application-policy&gt;
&lt;application-policy name = "JmsXARealm"&gt;
&lt;authentication&gt;
&lt;login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
flag = "required"&gt;
&lt;module-option name = "principal"&gt;guest&lt;/module-option&gt;
&lt;module-option name = "userName"&gt;guest&lt;/module-option&gt;
&lt;module-option name = "password"&gt;guest&lt;/module-option&gt;
&lt;module-option name = "managedConnectionFactoryName"&gt;
jboss.jca:service=TxCM,name=JmsXA
&lt;/module-option&gt;
&lt;/login-module&gt;
&lt;/authentication&gt;
&lt;/application-policy&gt; --&gt;
</pre>
<p>
<ul>
    <li>and in deploy/hsqldb-ds.xml comment: </li>
</ul>
<p>
<pre>&lt;!-- Use the security domain defined in conf/login-config.xml
&lt;security-domain&gt;HsqlDbRealm&lt;/security-domain&gt; --&gt;
</pre>
<p>
<p>
<h4>If you are not using the Pooled Invoker (see tuning section, you may want to use the pooled invoker) then: </h4>
<p>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in vi
    <li>remove: </li>
</ul>
<p>
<pre>
&lt;!--
&lt;mbean code="org.jboss.invocation.pooled.server.PooledInvoker"
name="jboss:service=invoker,type=pooled"&gt;
&lt;attribute name="NumAcceptThreads"&gt;1&lt;/attribute&gt;
&lt;attribute name="MaxPoolSize"&gt;300&lt;/attribute&gt;
&lt;attribute name="ClientMaxPoolSize"&gt;300&lt;/attribute&gt;
&lt;attribute name="SocketTimeout"&gt;60000&lt;/attribute&gt;
&lt;attribute name="ServerBindAddress"&gt;${jboss.bind.address}&lt;/attribute&gt;
&lt;attribute name="ServerBindPort"&gt;4445&lt;/attribute&gt;
&lt;attribute name="ClientConnectAddress"&gt;${jboss.bind.address}&lt;/attribute&gt;
&lt;attribute name="ClientConnectPort"&gt;0&lt;/attribute&gt;
&lt;attribute name="EnableTcpNoDelay"&gt;false&lt;/attribute&gt;
&lt;depends optional-attribute-name="TransactionManagerService"&gt;
jboss:service=TransactionManager&lt;/depends&gt;
&lt;/mbean&gt;
</pre>
<p>
<p>
<h4>If you do not wish to use the <a href="http://wiki.jboss.org/wiki/BeanShell"><u><font color=#0000ff>BeanShell</font></u></a> deployer </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in vi
    <li>remove or comment </li>
</ul>
<p>
<pre>
&lt;mbean code="org.jboss.varia.deployment.BeanShellSubDeployer"
name="jboss.scripts:service=BSHDeployer"&gt;
&lt;/mbean&gt;
</pre>
<p>
<p>
<ul>
    <li>remove server/slim/bsh* (bsh-deployer.jar, bsh-1.3.0.jar) </li>
</ul>
<p>
<h4>If you do not hot deploy files into the server/slim/deploy directory without restarting JBoss: </h4>
<p>
<ul>
    <li>open server/slim/conf/jboss-service.xml in vi
    <li>change this XML frament: </li>
</ul>
<p>
<pre>
&lt;!-- An mbean for hot deployment/undeployment of archives.
--&gt;
&lt;mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
name="jboss.deployment:type=DeploymentScanner,flavor=URL"&gt;
...
&lt;attribute name="ScanPeriod"&gt;5000&lt;/attribute&gt;
...
&lt;/mbean&gt;
</pre>
<p>to read (by adding):
<p>
<pre>
&lt;!-- An mbean for hot deployment/undeployment of archives.
--&gt;
&lt;mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
name="jboss.deployment:type=DeploymentScanner,flavor=URL"&gt;
...
&lt;attribute name="ScanPeriod"&gt;5000&lt;/attribute&gt;
&lt;attribute name="ScanEnabled"&gt;False&lt;/attribute&gt;
...
&lt;/mbean&gt;
</pre>
<p>
<ul>
    <li>see the tuning section for other advice regarding this from a performance perspective </li>
</ul>
<p>
<h4>If you do not use clustering</h4>
<p>
<ul>
    <li>The best way to do this is to start from the "default" config rather than the "all" config. Then bring over from the "all" config any miscellaneous services that you are using that aren't in "default".
    <li>If you must to start from the "all" config:
    <ul>
        <li>Remove server/slim/farm
        <li>Remove server/slim/deploy-hasingleton
        <li>Remove server/slim/deploy/cluster-service.xml
        <li>Remove server/slim/deploy/tc5-cluster-service.xml (OR server/slim/deploy/tc5-cluster.sar on 4.0.4 or later)
        <li>Remove server/slim/deploy/deploy.last/farm-service.xml
        <li>Remove server/slim/deploy/deploy-hasingleton-service.xml
        <li>Go into the server/slim/deploy/jms folder, remove it's contents, and replace them with the contents of the server/default/deploy/jms folder.
        <li>Edit server/slim/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml to remove this fragment: </li>
    </ul>
    </li>
</ul>
<p>
<pre>&lt;!--
Needed if using HTTP Session Clustering or if the
ClusteredSingleSignOn valve is enabled in the tomcat server.xml file
--&gt;
&lt;depends&gt;jboss.cache:service=TomcatClusteringCache&lt;/depends&gt;
</pre>
<p>
<h4>If you do not use distributed (clustered) web sessions</h4>
<p>
<ul>
    <li>Remove server/slim/deploy/tc5-cluster-service.xml (OR server/slim/deploy/tc5-cluster.sar on 4.0.4 or later)
    <li>Edit server/slim/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml to remove this fragment: </li>
</ul>
<p>
<pre>&lt;!--
Needed if using HTTP Session Clustering or if the
ClusteredSingleSignOn valve is enabled in the tomcat server.xml file
--&gt;
&lt;depends&gt;jboss.cache:service=TomcatClusteringCache&lt;/depends&gt;
</pre>
<p>
<h4>If you do not use the Farm service (replicated deployments)</h4>
<p>
<ul>
    <li>Remove server/slim/farm
    <li>Remove server/slim/deploy/deploy.last/farm-service.xml </li>
</ul>
<p><br><a href="http://wiki.jboss.org/wiki/JBossASServiceDependencies"><u><font color=#0000ff>Click here for a complete list of service dependencies.</font></u></a></p>
<img src ="http://www.cppblog.com/yb1682003/aggbug/52041.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yb1682003/" target="_blank">lancey</a> 2008-06-03 16:41 <a href="http://www.cppblog.com/yb1682003/articles/52041.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jboss性能调整(转)</title><link>http://www.cppblog.com/yb1682003/articles/52036.html</link><dc:creator>lancey</dc:creator><author>lancey</author><pubDate>Tue, 03 Jun 2008 08:12:00 GMT</pubDate><guid>http://www.cppblog.com/yb1682003/articles/52036.html</guid><description><![CDATA[之前的JAVA_OPTS是 -Xms 520m -Xmx 1220m -Xss 15120k +XX:AggressiveHeap<br>这个JAVA_OPTS犯了2个致命的错误：<br>1. +XX:AggressiveHeap会使得 Xms 1220m没有意义。这个参数让jvm忽略Xmx参数，疯狂地吃完一个G物理内存，再吃尽一个G的swap。<br>另外Xmx作为允许jvm使用的最大内存数量，不应该超过物理内存的90％。<br>而之所以使用了这个参数，是因为不加的话，JBoss会在运行一天左右的时间后迅速崩溃，上机课是，甚至出现过半个小时就崩溃的情况。<br>之所以要用这个参数，用swap支持服务器运行，是因为犯了下面的错误：<br>2. -Xss 15120k <br>这使得JBoss每增加一个线程（thread)就会立即消耗15M内存，而最佳值应该是128K,默认值好像是512k.<br>这就是JBoss刚启动时，还有200Mb内存富余，但会在一个小时内迅速用完，因为服务器的threads在迅速增加。前3天，每天都多吃80Mb左右的swap.在第四天开始稳定下来。今年春节在外度假，观察到了这个现象，却不理解其原因：服务器在线程到达100之后，一般不再增加新的线程，新增加的在用完之后，会被迅速destroy，?褂玫哪诖嬉不厥樟恕Ｒ虼耍旁诖航谄诩洌鄄斓椒衿髟?1.25-2.10所使用的线程基本是1.21-1.23创建的，因此没有再消耗新的内存。服务器持续运行时间，也因此大大超乎我5天的预期，到达了20天。<br>昨天所作的修改：<br>1.修改JAVA_OPTS,去掉+XX:AggressiveHeap，修改Xss。现在的JAVA_OPTS为：<br>－Xms 520m -Xmx 900m -Xss 128k<br>2.修改deploy/jbossweb-tomcat55.sar/service.xml<br>将maxThreads根据目前的访问量由默认的250降为75，并使用jboss 4默认未写在标准service.xml里面而jboss 3写入了的2个参数: maxSparseThreads=55，minSparseThreads=25<br>3.修改了oracle-ds.xml将最大连接数有150降为50.<br>4.去掉了一些不用的服务
<img src ="http://www.cppblog.com/yb1682003/aggbug/52036.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yb1682003/" target="_blank">lancey</a> 2008-06-03 16:12 <a href="http://www.cppblog.com/yb1682003/articles/52036.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>