JBoss AS 调优(三)

接上一节。

瘦身(二)

如果你使用通过HTTP直接连接Tomcat而不是通过Apache/mod_jk:  辑器打开server/slim/deploy/jbossweb-tomcat50.sar/server.xml,移除/注释下面的XML 片段:  

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

 
如果你的用户总是不通过HTTP连接到Tomcat而总是通过Apache/mod_jk连接,编辑server/slim/deploy/jbossweb-tomcat50.sar/server.xml 文件,移除/注释下面的XML片段:  

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

 
如果你不需要可以部署EAR文件l  使用vi打开编辑 server/slim/conf/jboss-service.xml文件,移除/注释下面的XML片段从这

从这个

<mbean code="org.jboss.management.j2ee.LocalJBossServerDomain">

 
MBean 下面

<attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>

  
和 

<!-- EAR 部署,如果你不使用Web分层,删除-->
<mbean code="org.jboss.deployment.EARDeployer"name="jboss.j2ee:service=EARDeployer"></mbean>

  
 如果你不需要可以部署JMS队列,打开 server/slim/conf/jboss-service.xml 文件,移除/注释下面的XML片段

从这个

<mbean code="org.jboss.management.j2ee.LocalJBossServerDomain" >

 

Mbean下面 

<attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>

 

如果你不需要使用CORBA/IIOP,编辑 server/slim/conf/jboss-service.xml文件,移除/注释下面的XML片段
从这个

<mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"> 

 
MBean 下面

<attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>

  
如果你删除user-transaction-service.xml,server/slim/conf/jboss-service.xml 文件,移除/注释下面的XML片段

从这个

<mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"> 

 

MBean 下面

<attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>

 
如果你不需要JSR-77支持 (尝试做JBoss, Weblogic 和 Websphere支持一些基于同类的JMX监控)你可以删除/注释server/slim/conf/jboss-service.xml文件关于JSR-77的全部片段: 

<!-- ==================================================================== -->  
<!-- JSR-77 Single JBoss Server Management Domain -->  
<!-- ==================================================================== -->  
<mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"  
name="jboss.management.local:j2eeType=J2EEDomain,name=Manager">  
<attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>  
<attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>  
<!-- <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>-->  
<attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>  
<attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>  
<attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>  
<attribute name="WARDeployer">jboss.web:service=WebServer</attribute>  
<attribute name="MailService">jboss:service=Mail</attribute>  
<!-- <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>-->  
<attribute name="JNDIService">jboss:service=Naming</attribute>  
<attribute name="JTAService">jboss:service=TransactionManager</attribute>  
<!-- <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>  
<attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>-->  
</mbean>  

 
如果你不需要client-side事务管理 (记住,使用这个那意味着你是一个坏人) ,编辑 server/slim/conf/jboss-service.xml文件,移除/注释下面的XML片段 

<!--  UserTransaction support.  -->  

<mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"  
name="jboss:service=ClientUserTransaction"  
xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">  
<depends>  
<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"  
name="jboss:service=proxyFactory,target=ClientUserTransactionFactory">  
<attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>  
<attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>  
<attribute name="JndiName">UserTransactionSessionFactory</attribute>  
<attribute name="ExportedInterface"> 
org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory 
</attribute>  
<attribute name="ClientInterceptors">  
<interceptors>  
<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>  
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>  
</interceptors>  
</attribute>  
<depends>jboss:service=invoker,type=jrmp</depends>  
</mbean>  
</depends>  
<depends optional-attribute-name="TxProxyName">  
<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"  
name="jboss:service=proxyFactory,target=ClientUserTransaction">  
<attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>  
<attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>  
<attribute name="JndiName"></attribute>  
<attribute name="ExportedInterface"> org.jboss.tm.usertx.interfaces.UserTransactionSession 
</attribute>  
<attribute name="ClientInterceptors">  
<interceptors>  
<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>  
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>  
</interceptors>  
</attribute>  
<depends>jboss:service=invoker,type=jrmp</depends>  
</mbean>  
</depends>  
</mbean>

 
你现在能删除从来没有引用的server/slim/conf/xmdesc/ClientUserTransaction-xmbean.xml 文件如果你不需要持久化MBean(persistent MBean )特性 (默认情况下,没有JBoss MBeans使用它...yet),编辑 server/slim/conf/jboss-service.xml文件,移除/注释这个XML片段  

<!-- ==================================================================== -->  
<!-- XMBean Persistence -->  
<!-- ==================================================================== -->  
<mbean code="org.jboss.system.pm.AttributePersistenceService"  
name="jboss:service=AttributePersistenceService"  
xmbean-dd="resource:xmdesc/AttributePersistenceService-xmbean.xml">  
<attribute name="AttributePersistenceManagerClass">  org.jboss.system.pm.XMLAttributePersistenceManager 
</attribute>  
<attribute name="AttributePersistenceManagerConfig">  
<data-directory>data/xmbean-attrs</data-directory>  
</attribute>  
<attribute name="ApmDestroyOnServiceStop">false</attribute>  
<attribute name="VersionTag"></attribute>  
</mbean>

 
 既然server/slim/conf/xmdec/xmdesc/AttributePersistenceService-xmbean.xml已经不在被引用,你也可以删除它。 如果你不使用RMI类装载器 (在服务器上利用classes从客户端装载代码),编辑 server/slim/conf/jboss-service.xml文件,移除/注释这个XML片段 

<!-- ==================================================================== -->  
<!-- JBoss RMI Classloader - only install when available -->  
<!-- ==================================================================== -->  
<mbean code="org.jboss.util.property.jmx.SystemPropertyClassValue"  
name="jboss.rmi:type=RMIClassLoader">  
<attribute name="Property">java.rmi.server.RMIClassLoaderSpi</attribute>  
<attribute name="ClassName">org.jboss.system.JBossRMIClassLoader</attribute>  
</mbean>

 

 和

<!-- ==================================================================== -->  
<!-- Class Loading -->  
<!-- ==================================================================== -->  
<mbean code="org.jboss.web.WebService"  
name="jboss:service=WebService">  
<attribute name="Port">8083</attribute>  
<!-- Should resources and non-EJB classes be downloadable -->  
<attribute name="DownloadServerClasses">true</attribute>  
<attribute name="Host">${jboss.bind.address}</attribute>  
<attribute name="BindAddress">${jboss.bind.address}</attribute>  
</mbean> 

 
修改XML片段 (注意: 在JBoss 4.0里,是在server/slim/deploy/ejb-deployer.xml文件里的一点设置): 

<!-- EJB deployer, remove to disable EJB behavior-->  
<mbean code="org.jboss.ejb.EJBDeployer" name="jboss.ejb:service=EJBDeployer">  
<attribute name="VerifyDeployments">true</attribute>  

...  

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

 
象这样标明: 

<!-- EJB deployer, remove to disable EJB behavior-->  
<mbean code="org.jboss.ejb.EJBDeployer" name="jboss.ejb:service=EJBDeployer">  
<attribute name="VerifyDeployments">true</attribute>  

...  

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

 

或者选择性的移除WebServiceName? depends/attribute.
如果你只想使用 JBoss Naming locally (没有 RMI 客户端),打开 server/slim/conf/jboss-service.xml文件,更改下面的XML片段 

<!-- ==================================================================== -->  
<!-- JNDI -->  
<!-- ==================================================================== -->  
<mbean code="org.jboss.naming.NamingService"  
name="jboss:service=Naming"  
xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">  

...  

<!-- The listening port for the bootstrap JNP service. Set this to -1  
to run the NamingService without the JNP invoker listening port.  
-->  
<attribute name="Port">1099</attribute>  

...  

<!-- The port of the RMI naming service, 0 == anonymous -->  
<attribute name="RmiPort">1098</attribute>  

...  

</mbean> 

 
改写 

<!-- ==================================================================== -->  
<!-- JNDI -->  
<!-- ==================================================================== -->  
<mbean code="org.jboss.naming.NamingService"  
name="jboss:service=Naming"  
xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">  

...  

<!-- The listening port for the bootstrap JNP service. Set this to -1  
to run the NamingService without the JNP invoker listening port.  
-->  
<attribute name="Port">-1</attribute>  

...  

<!-- The port of the RMI naming service, 0 == anonymous -->  
<attribute name="RmiPort">0</attribute>  

...  

</mbean>

 

 

该RmiPort 大多是可选的,但是它意味着我们将不绑定到1098端口,以便这是有益的. 你也可以从相同的XML区域删除此行,来删除相关联的线程池:

<depends optional-attribute-name="LookupPool"  proxy-type="attribute">jboss.system:service=ThreadPool</depends>

  
 和它自己的线程池块:

 <!-- A Thread pool service -->  
<mbean code="org.jboss.util.threadpool.BasicThreadPool"  
name="jboss.system:service=ThreadPool"> 
<attribute name="Name">JBoss System Threads</attribute>  
<attribute name="ThreadGroupName">System Threads</attribute>  
<attribute name="KeepAliveTime">60000</attribute>  
<attribute name="MinimumPoolSize">1</attribute>  
<attribute name="MaximumPoolSize">10</attribute>  
<attribute name="MaximumQueueSize">1000</attribute>  
<attribute name="BlockingMode">run</attribute>  
</mbean>

 
如果你使用它,从JMX控制台(显示JNDI命名树) 此JNDIView MBean 是非常有用的, 除非你不使用它.打开 server/slim/conf/jboss-service.xml ,删除 

<mbean code="org.jboss.naming.JNDIView"  name="jboss:service=JNDIView" xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml"></mbean>

 
 你可以也删掉server/slim/conf/xmdesc/JNDIView-xmbean.xml 文件如果你不使用JBossSX, 我们为EJBs或者Web层组件继承的基于JAAS的安全 (then you deserve to be flogged and I hope you get hacked but thats another story),打开 server/slim/conf/jboss-service.xml,

 删除

<!-- ==================================================================== -->  
<!-- Security -->  
<!-- ==================================================================== -->  
<!--  
<mbean code="org.jboss.security.plugins.SecurityConfig"  
name="jboss.security:service=SecurityConfig">  
<attribute name="LoginConfig">jboss.security:service=XMLLoginConfig</attribute>  
</mbean>  
<mbean code="org.jboss.security.auth.login.XMLLoginConfig"  
name="jboss.security:service=XMLLoginConfig">  
<attribute name="ConfigResource">login-config.xml</attribute>  
</mbean>

 
编辑 server/slim/deploy/jbossweb-tomcatxx.sar/META-INF/jboss-service.xml 并注释掉这些片段: 

<!-- The JAAS security domain to use in the absense of an explicit  
security-domain specification in the war WEB-INF/jboss-web.xml  
-->  
<!-- <attribute name="DefaultSecurityDomain">java:/jaas/other</attribute>--> 
 
<!-- 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.  
-->  
<!— 
<depends optional-attribute-name="SecurityManagerService"  
proxy-type="attribute">jboss.security:service=JaasSecurityManager  
</depends> 
--> 

 
也移除/注释: <!-- JAAS 安全性管理和区域mapping --> 

<mbean code="org.jboss.security.plugins.JaasSecurityManagerService"  
name="jboss.security:service=JaasSecurityManager">  
<attribute name="SecurityManagerClassName">  
org.jboss.security.plugins.JaasSecurityManager  
</attribute>  
<attribute name="DefaultCacheTimeout">1800</attribute>  
<attribute name="DefaultCacheResolution">60</attribute>  
</mbean>

 
如果你使用JBossMQ,你将需要从server/slim/deploy/jms/jbossmq-destinations-service.xml文件的所有测试 queues/topics中删掉任何一个 (优先的)或者注释掉他们的安全性信息. 如果你选择保持示例topics/queues增加如下注释: 

<mbean code="org.jboss.mq.server.jmx.Topic"  
name="jboss.mq.destination:service=Topic,name=testTopic">  
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>  
<!—- 
<depends optional-attribute-name="SecurityManager"> 
jboss.mq:service=SecurityManager </depends>  
<attribute name="SecurityConf">  
<security>  
<role name="guest" read="true" write="true"/>  
<role name="publisher" read="true" write="true" create="false"/>  
<role name="durpublisher" read="true" write="true" create="true"/>  
</security>  
</attribute> 
-->  
</mbean>  
<mbean code="org.jboss.mq.server.jmx.Topic"  
name="jboss.mq.destination:service=Topic,name=testTopic">  
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>  
<!-- <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>  
<attribute name="SecurityConf">  
<security>  
<role name="guest" read="true" write="true"/>  
<role name="publisher" read="true" write="true" create="false"/>  
<role name="durpublisher" read="true" write="true" create="true"/>  
</security>  
</attribute> 
-->  
</mbean>  
<mbean code="org.jboss.mq.server.jmx.Topic"  
name="jboss.mq.destination:service=Topic,name=testDurableTopic">  
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>  
<!--  
<depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>  
<attribute name="SecurityConf">  
<security>  
<role name="guest" read="true" write="true"/>  
<role name="publisher" read="true" write="true" create="false"/>  
<role name="durpublisher" read="true" write="true" create="true"/>  
</security>  
</attribute> 
-->  
</mbean>  
<mbean code="org.jboss.mq.server.jmx.Queue"  

name="jboss.mq.destination:service=Queue,name=testQueue">  

<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>  

<!--  
<depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>  
<attribute name="SecurityConf">  
<security>  
<role name="guest" read="true" write="true"/>  
<role name="publisher" read="true" write="true" create="false"/>  
<role name="noacc" read="false" write="false" create="false"/>  
</security>  
</attribute> 
-->  
</mbean>

 

你可能感兴趣的:(xml,jboss,webservice,ejb,Security)