Knight of the round table

          wansong

          JBoss AS 調優(三)

          接上一節。

          瘦身(二)

          如果你使用通過HTTP直接連接Tomcat而不是通過Apache/mod_jk:  輯器打開server/slim/deploy/jbossweb-tomcat50.sar/server.xml,移除/注釋下面的XML 片段:  

          Xml代碼 復制代碼 收藏代碼
          1. <!-- A AJP 1.3 Connector on port 8009 -->     
          2. <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片段:  

          Xml代碼 復制代碼 收藏代碼
          1. <!-- A HTTP/1.1 Connector on port 8080 -->     
          2. <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片段從這

          從這個

          Xml代碼 復制代碼 收藏代碼
          1. <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain">  

           
          MBean 下面

          Xml代碼 復制代碼 收藏代碼
          1. <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>  

            
          和 

          Xml代碼 復制代碼 收藏代碼
          1. <!-- EAR 部署,如果你不使用Web分層,刪除-->  
          2. <mbean code="org.jboss.deployment.EARDeployer"name="jboss.j2ee:service=EARDeployer"></mbean>  

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

          從這個

          Xml代碼 復制代碼 收藏代碼
          1. <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain" >  

           

          Mbean下面 

          Xml代碼 復制代碼 收藏代碼
          1. <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>  

           

          如果你不需要使用CORBA/IIOP,編輯 server/slim/conf/jboss-service.xml文件,移除/注釋下面的XML片段
          從這個

          Xml代碼 復制代碼 收藏代碼
          1. <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain">   

           
          MBean 下面

          Xml代碼 復制代碼 收藏代碼
          1. <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>  

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

          從這個

          Xml代碼 復制代碼 收藏代碼
          1. <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain">   

           

          MBean 下面

          Xml代碼 復制代碼 收藏代碼
          1. <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>  

           
          如果你不需要JSR-77支持 (嘗試做JBoss, Weblogic 和 Websphere支持一些基于同類的JMX監控)你可以刪除/注釋server/slim/conf/jboss-service.xml文件關于JSR-77的全部片段: 

          Xml代碼 復制代碼 收藏代碼
          1. <!-- ==================================================================== -->     
          2. <!-- JSR-77 Single JBoss Server Management Domain -->     
          3. <!-- ==================================================================== -->     
          4. <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"     
          5. name="jboss.management.local:j2eeType=J2EEDomain,name=Manager">     
          6. <attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>     
          7. <attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>     
          8. <!-- <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>-->     
          9. <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>     
          10. <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>     
          11. <attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>     
          12. <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>     
          13. <attribute name="MailService">jboss:service=Mail</attribute>     
          14. <!-- <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>-->     
          15. <attribute name="JNDIService">jboss:service=Naming</attribute>     
          16. <attribute name="JTAService">jboss:service=TransactionManager</attribute>     
          17. <!-- <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>     
          18. <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>-->     
          19. </mbean>    

           
          如果你不需要client-side事務管理 (記住,使用這個那意味著你是一個壞人) ,編輯 server/slim/conf/jboss-service.xml文件,移除/注釋下面的XML片段 

          Xml代碼 復制代碼 收藏代碼
          1. <!--  UserTransaction support.  -->     
          2.   
          3. <mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"     
          4. name="jboss:service=ClientUserTransaction"     
          5. xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">     
          6. <depends>     
          7. <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"     
          8. name="jboss:service=proxyFactory,target=ClientUserTransactionFactory">     
          9. <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>     
          10. <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>     
          11. <attribute name="JndiName">UserTransactionSessionFactory</attribute>     
          12. <attribute name="ExportedInterface">    
          13. org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory    
          14. </attribute>     
          15. <attribute name="ClientInterceptors">     
          16. <interceptors>     
          17. <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>     
          18. <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>     
          19. </interceptors>     
          20. </attribute>     
          21. <depends>jboss:service=invoker,type=jrmp</depends>     
          22. </mbean>     
          23. </depends>     
          24. <depends optional-attribute-name="TxProxyName">     
          25. <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"     
          26. name="jboss:service=proxyFactory,target=ClientUserTransaction">     
          27. <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>     
          28. <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>     
          29. <attribute name="JndiName"></attribute>     
          30. <attribute name="ExportedInterface"> org.jboss.tm.usertx.interfaces.UserTransactionSession    
          31. </attribute>     
          32. <attribute name="ClientInterceptors">     
          33. <interceptors>     
          34. <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>     
          35. <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>     
          36. </interceptors>     
          37. </attribute>     
          38. <depends>jboss:service=invoker,type=jrmp</depends>     
          39. </mbean>     
          40. </depends>     
          41. </mbean>  

           
          你現在能刪除從來沒有引用的server/slim/conf/xmdesc/ClientUserTransaction-xmbean.xml 文件如果你不需要持久化MBean(persistent MBean )特性 (默認情況下,沒有JBoss MBeans使用它...yet),編輯 server/slim/conf/jboss-service.xml文件,移除/注釋這個XML片段  

          Xml代碼 復制代碼 收藏代碼
          1. <!-- ==================================================================== -->     
          2. <!-- XMBean Persistence -->     
          3. <!-- ==================================================================== -->     
          4. <mbean code="org.jboss.system.pm.AttributePersistenceService"     
          5. name="jboss:service=AttributePersistenceService"     
          6. xmbean-dd="resource:xmdesc/AttributePersistenceService-xmbean.xml">     
          7. <attribute name="AttributePersistenceManagerClass">  org.jboss.system.pm.XMLAttributePersistenceManager    
          8. </attribute>     
          9. <attribute name="AttributePersistenceManagerConfig">     
          10. <data-directory>data/xmbean-attrs</data-directory>     
          11. </attribute>     
          12. <attribute name="ApmDestroyOnServiceStop">false</attribute>     
          13. <attribute name="VersionTag"></attribute>     
          14. </mbean>  

           
           既然server/slim/conf/xmdec/xmdesc/AttributePersistenceService-xmbean.xml已經不在被引用,你也可以刪除它。 如果你不使用RMI類裝載器 (在服務器上利用classes從客戶端裝載代碼),編輯 server/slim/conf/jboss-service.xml文件,移除/注釋這個XML片段 

          Xml代碼 復制代碼 收藏代碼
          1. <!-- ==================================================================== -->     
          2. <!-- JBoss RMI Classloader - only install when available -->     
          3. <!-- ==================================================================== -->     
          4. <mbean code="org.jboss.util.property.jmx.SystemPropertyClassValue"     
          5. name="jboss.rmi:type=RMIClassLoader">     
          6. <attribute name="Property">java.rmi.server.RMIClassLoaderSpi</attribute>     
          7. <attribute name="ClassName">org.jboss.system.JBossRMIClassLoader</attribute>     
          8. </mbean>  

           

           和

          Xml代碼 復制代碼 收藏代碼
          1. <!-- ==================================================================== -->     
          2. <!-- Class Loading -->     
          3. <!-- ==================================================================== -->     
          4. <mbean code="org.jboss.web.WebService"     
          5. name="jboss:service=WebService">     
          6. <attribute name="Port">8083</attribute>     
          7. <!-- Should resources and non-EJB classes be downloadable -->     
          8. <attribute name="DownloadServerClasses">true</attribute>     
          9. <attribute name="Host">${jboss.bind.address}</attribute>     
          10. <attribute name="BindAddress">${jboss.bind.address}</attribute>     
          11. </mbean>   

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

          Xml代碼 復制代碼 收藏代碼
          1. <!-- EJB deployer, remove to disable EJB behavior-->     
          2. <mbean code="org.jboss.ejb.EJBDeployer" name="jboss.ejb:service=EJBDeployer">     
          3. <attribute name="VerifyDeployments">true</attribute>     
          4.   
          5. ...     
          6.   
          7. <depends optional-attribute-name="WebServiceName">jboss:service=WebService</depends>  
          8. </mbean>   

           
          象這樣標明: 

          Xml代碼 復制代碼 收藏代碼
          1. <!-- EJB deployer, remove to disable EJB behavior-->     
          2. <mbean code="org.jboss.ejb.EJBDeployer" name="jboss.ejb:service=EJBDeployer">     
          3. <attribute name="VerifyDeployments">true</attribute>     
          4.   
          5. ...     
          6.   
          7. <!-- <depends optional-attribute-name="WebServiceName">jboss:service=WebService</depends> -->     
          8. </mbean>  

           

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

          Xml代碼 復制代碼 收藏代碼
          1. <!-- ==================================================================== -->     
          2. <!-- JNDI -->     
          3. <!-- ==================================================================== -->     
          4. <mbean code="org.jboss.naming.NamingService"     
          5. name="jboss:service=Naming"     
          6. xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">     
          7.   
          8. ...     
          9.   
          10. <!-- The listening port for the bootstrap JNP service. Set this to -1     
          11. to run the NamingService without the JNP invoker listening port.     
          12. -->     
          13. <attribute name="Port">1099</attribute>     
          14.   
          15. ...     
          16.   
          17. <!-- The port of the RMI naming service, 0 == anonymous -->     
          18. <attribute name="RmiPort">1098</attribute>     
          19.   
          20. ...     
          21.   
          22. </mbean>   

           
          改寫 

          Xml代碼 復制代碼 收藏代碼
          1. <!-- ==================================================================== -->     
          2. <!-- JNDI -->     
          3. <!-- ==================================================================== -->     
          4. <mbean code="org.jboss.naming.NamingService"     
          5. name="jboss:service=Naming"     
          6. xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">     
          7.   
          8. ...     
          9.   
          10. <!-- The listening port for the bootstrap JNP service. Set this to -1     
          11. to run the NamingService without the JNP invoker listening port.     
          12. -->     
          13. <attribute name="Port">-1</attribute>     
          14.   
          15. ...     
          16.   
          17. <!-- The port of the RMI naming service, 0 == anonymous -->     
          18. <attribute name="RmiPort">0</attribute>     
          19.   
          20. ...     
          21.   
          22. </mbean>  

           

           

          該RmiPort 大多是可選的,但是它意味著我們將不綁定到1098端口,以便這是有益的. 你也可以從相同的XML區域刪除此行,來刪除相關聯的線程池:

          Xml代碼 復制代碼 收藏代碼
          1. <depends optional-attribute-name="LookupPool"  proxy-type="attribute">jboss.system:service=ThreadPool</depends>  

            
           和它自己的線程池塊:

          Xml代碼 復制代碼 收藏代碼
          1.  <!-- A Thread pool service -->     
          2. <mbean code="org.jboss.util.threadpool.BasicThreadPool"     
          3. name="jboss.system:service=ThreadPool">    
          4. <attribute name="Name">JBoss System Threads</attribute>     
          5. <attribute name="ThreadGroupName">System Threads</attribute>     
          6. <attribute name="KeepAliveTime">60000</attribute>     
          7. <attribute name="MinimumPoolSize">1</attribute>     
          8. <attribute name="MaximumPoolSize">10</attribute>     
          9. <attribute name="MaximumQueueSize">1000</attribute>     
          10. <attribute name="BlockingMode">run</attribute>     
          11. </mbean>  

           
          如果你使用它,從JMX控制臺(顯示JNDI命名樹) 此JNDIView MBean 是非常有用的, 除非你不使用它.打開 server/slim/conf/jboss-service.xml ,刪除 

          Xml代碼 復制代碼 收藏代碼
          1. <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,

           刪除

          Xml代碼 復制代碼 收藏代碼
          1. <!-- ==================================================================== -->     
          2. <!-- Security -->     
          3. <!-- ==================================================================== -->     
          4. <!--     
          5. <mbean code="org.jboss.security.plugins.SecurityConfig"     
          6. name="jboss.security:service=SecurityConfig">     
          7. <attribute name="LoginConfig">jboss.security:service=XMLLoginConfig</attribute>     
          8. </mbean>     
          9. <mbean code="org.jboss.security.auth.login.XMLLoginConfig"     
          10. name="jboss.security:service=XMLLoginConfig">     
          11. <attribute name="ConfigResource">login-config.xml</attribute>     
          12. </mbean>  

           
          編輯 server/slim/deploy/jbossweb-tomcatxx.sar/META-INF/jboss-service.xml 并注釋掉這些片段: 

          Xml代碼 復制代碼 收藏代碼
          1. <!-- The JAAS security domain to use in the absense of an explicit     
          2. security-domain specification in the war WEB-INF/jboss-web.xml     
          3. -->     
          4. <!-- <attribute name="DefaultSecurityDomain">java:/jaas/other</attribute>-->   
          Xml代碼 復制代碼 收藏代碼
          1. 和  
          Xml代碼 復制代碼 收藏代碼
          1.     
          2. <!-- A mapping to the server security manager service which must be  operation compatible with type    
          3. 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.     
          4. -->     
          5. <!—    
          6. <depends optional-attribute-name="SecurityManagerService"     
          7. proxy-type="attribute">jboss.security:service=JaasSecurityManager     
          8. </depends>    
          9. -->   

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

          Xml代碼 復制代碼 收藏代碼
          1. <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"     
          2. name="jboss.security:service=JaasSecurityManager">     
          3. <attribute name="SecurityManagerClassName">     
          4. org.jboss.security.plugins.JaasSecurityManager     
          5. </attribute>     
          6. <attribute name="DefaultCacheTimeout">1800</attribute>     
          7. <attribute name="DefaultCacheResolution">60</attribute>     
          8. </mbean>  

           
          如果你使用JBossMQ,你將需要從server/slim/deploy/jms/jbossmq-destinations-service.xml文件的所有測試 queues/topics中刪掉任何一個 (優先的)或者注釋掉他們的安全性信息. 如果你選擇保持示例topics/queues增加如下注釋: 

          Xml代碼 復制代碼 收藏代碼
          1. <mbean code="org.jboss.mq.server.jmx.Topic"     
          2. name="jboss.mq.destination:service=Topic,name=testTopic">     
          3. <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>     
          4. <!—-    
          5. <depends optional-attribute-name="SecurityManager">    
          6. jboss.mq:service=SecurityManager </depends>     
          7. <attribute name="SecurityConf">     
          8. <security>     
          9. <role name="guest" read="true" write="true"/>     
          10. <role name="publisher" read="true" write="true" create="false"/>     
          11. <role name="durpublisher" read="true" write="true" create="true"/>     
          12. </security>     
          13. </attribute>    
          14. -->     
          15. </mbean>     
          16. <mbean code="org.jboss.mq.server.jmx.Topic"     
          17. name="jboss.mq.destination:service=Topic,name=testTopic">     
          18. <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>     
          19. <!-- <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>     
          20. <attribute name="SecurityConf">     
          21. <security>     
          22. <role name="guest" read="true" write="true"/>     
          23. <role name="publisher" read="true" write="true" create="false"/>     
          24. <role name="durpublisher" read="true" write="true" create="true"/>     
          25. </security>     
          26. </attribute>    
          27. -->     
          28. </mbean>     
          29. <mbean code="org.jboss.mq.server.jmx.Topic"     
          30. name="jboss.mq.destination:service=Topic,name=testDurableTopic">     
          31. <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>     
          32. <!--     
          33. <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>     
          34. <attribute name="SecurityConf">     
          35. <security>     
          36. <role name="guest" read="true" write="true"/>     
          37. <role name="publisher" read="true" write="true" create="false"/>     
          38. <role name="durpublisher" read="true" write="true" create="true"/>     
          39. </security>     
          40. </attribute>    
          41. -->     
          42. </mbean>     
          43. <mbean code="org.jboss.mq.server.jmx.Queue"     
          44.   
          45. name="jboss.mq.destination:service=Queue,name=testQueue">     
          46.   
          47. <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>     
          48.   
          49. <!--     
          50. <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>     
          51. <attribute name="SecurityConf">     
          52. <security>     
          53. <role name="guest" read="true" write="true"/>     
          54. <role name="publisher" read="true" write="true" create="false"/>     
          55. <role name="noacc" read="false" write="false" create="false"/>     
          56. </security>     
          57. </attribute>    
          58. -->     
          59. </mbean>  

          posted on 2011-08-07 13:07 w@ns0ng 閱讀(322) 評論(0)  編輯  收藏 所屬分類: jboss

          主站蜘蛛池模板: 安多县| 张家界市| 保靖县| 东乡| 从江县| 西华县| 和硕县| 杂多县| 阿合奇县| 正镶白旗| 资溪县| 永丰县| 新田县| 高台县| 衡水市| 鹿泉市| 伽师县| 佛坪县| 开江县| 枣阳市| 邹平县| 黎川县| 福海县| 安龙县| 江山市| 肇东市| 阿克陶县| 信丰县| 新竹市| 新昌县| 浦北县| 左云县| 蕲春县| 湾仔区| 舟山市| 黄山市| 化德县| 新郑市| 青浦区| 萍乡市| 齐河县|