0 Replies Latest reply on Feb 25, 2004 12:30 AM by chacko

    How to implement Load balancing in jboss clustering

    chacko

      I have clustered two computers by changing cluster-service.xml and farm.xml as given below.

      cluster-service.xml
      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- Sample Clustering Service Configuration -->
      <!-- -->
      <!-- ===================================================================== -->





      <!-- ==================================================================== -->
      <!-- Cluster Partition: defines cluster -->
      <!-- ==================================================================== -->



      <!-- Name of the partition being built -->
      MySpecialNewPartition
      <!-- Determine if deadlock detection is enabled -->
      True
      <!-- The JavaGroups protocol configuration -->


      <!-- UDP: if you have a multihomed machine,
      set the bind_addr attribute to the appropriate NIC IP address -->
      <!-- UDP: On Windows machines, because of the media sense feature
      being broken with multicast (even after disabling media sense)
      set the loopback attribute to true -->
      <UDP mcast_addr="228.1.2.3" mcast_port="45566"
      ip_ttl="64" ip_mcast="true"
      mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
      ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
      loopback="false" />
      <PING timeout="2000" num_initial_members="3"
      up_thread="true" down_thread="true" />
      <MERGE2 min_interval="5000" max_interval="10000" />
      <FD shun="true" up_thread="true" down_thread="true" />
      <VERIFY_SUSPECT timeout="1500"
      up_thread="true" down_thread="true" />
      <pbcast.STABLE desired_avg_gossip="20000"
      up_thread="true" down_thread="true" />
      <pbcast.NAKACK gc_lag="50" retransmit_timeout="300,600,1200,2400,4800"
      up_thread="true" down_thread="true" />
      <UNICAST timeout="5000" window_size="100" min_threshold="10"
      down_thread="true" />
      <FRAG frag_size="8192"
      down_thread="true" up_thread="true" />
      <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
      shun="true" print_local_addr="true" />
      <pbcast.STATE_TRANSFER up_thread="true" down_thread="true" />




      <!-- ==================================================================== -->
      <!-- HA Session State Service for SFSB -->
      <!-- ==================================================================== -->


      jboss:service=MySpecialNewPartition
      <!-- Name of the partition to which the service is linked -->
      MySpecialNewPartition
      <!-- JNDI name under which the service is bound -->
      /HASessionState/Default
      <!-- Max delay before cleaning unreclaimed state.
      Defaults to 30*60*1000 => 30 minutes -->
      0


      <!-- ==================================================================== -->
      <!-- HA JNDI -->
      <!-- ==================================================================== -->


      jboss:service=MySpecialNewPartition
      <!-- Name of the partition to which the service is linked -->
      MySpecialNewPartition
      <!-- RmiPort to be used by the HA-JNDI service
      once bound. 0 => auto. -->
      0
      <!-- Port on which the HA-JNDI stub is made available -->
      1100
      <!-- Backlog to be used for client-server RMI
      invocations during JNDI queries -->
      50

      <!-- Multicast Address and Group used for auto-discovery -->
      230.0.0.4
      1102

      <!-- Client socket factory to be used for client-server
      RMI invocations during JNDI queries -->
      <!--attribute name="ClientSocketFactory">custom</attribute-->
      <!-- Server socket factory to be used for client-server
      RMI invocations during JNDI queries -->
      <!--attribute name="ServerSocketFactory">custom</attribute-->



      <!--
      0
      custom
      custom
      custom
      -->


      <!-- ==================================================================== -->
      <!-- Distributed cache invalidation -->
      <!-- ==================================================================== -->


      jboss:service=MySpecialNewPartition
      jboss.cache:service=InvalidationManager
      jboss.cache:service=InvalidationManager
      MySpecialNewPartition
      DefaultJGBridge



      farm-service.xml
      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- Sample Farming Service Configuration -->
      <!-- -->
      <!-- ===================================================================== -->






      jboss:service=MySpecialNewPartition
      MySpecialNewPartition

      jboss.web:service=WebServer

      <!-- Uncomment (and comment/remove version below) to enable usage of the
      DeploymentCache
      <depends optional-attribute-name="Deployer">jboss.deployment:type=DeploymentCache
      -->
      <depends optional-attribute-name="Deployer">jboss.system:service=MainDeployer



      <!-- The URLComparator can be used to specify a deployment ordering
      for deployments found in a scanned directory. The class specified
      must be an implementation of java.util.Comparator, it must be able
      to compare two URL objects, and it must have a no-arg constructor.
      Two deployment comparators are shipped with JBoss:
      - org.jboss.deployment.DeploymentSorter
      Sorts by file extension, as follows:
      "sar", "service.xml", "rar", "jar", "war", "wsr", "ear", "zip",
      "*"
      - org.jboss.deployment.scanner.PrefixDeploymentSorter
      If the name portion of the url begins with 1 or more digits, those
      digits are converted to an int (ignoring leading zeroes), and
      files are deployed in that order. Files that do not start with
      any digits will be deployed last, and they will be sorted by
      extension as above with DeploymentSorter.
      -->
      org.jboss.deployment.DeploymentSorter
      <!--
      org.jboss.deployment.scanner.PrefixDeploymentSorter
      -->

      <!-- The Filter specifies a java.io.FileFilter for scanned
      directories. Any file not accepted by this filter will not be
      deployed. The org.jboss.deployment.scanner.DeploymentFilter
      rejects the following patterns:
      "#*", "%*", ",*", ".*", "_$*", "*#", "*$", "*%", "*.BAK",
      "*.old", "*.orig", "*.rej", "*.bak", "*,v", "*~", ".make.state",
      ".nse_depinfo", "CVS", "CVS.admin", "RCS", "RCSLOG", "SCCS",
      "TAGS", "core", "tags"
      -->
      org.jboss.deployment.scanner.DeploymentFilter

      5000

      <!-- URLs are comma seperated and unprefixed arguments are considered
      file URLs and resolve relative to server home(JBOSS_DIST/server/default)
      unless the given path is absolute. Any referenced directories cannot
      be unpackaged archives, use the parent directory of the unpacked
      archive.
      -->

      farm/





      and all\deploy\jbossha-httpsession.sar\ClusteredHttpSessionEB.jar\META-INF\jboss.xml

      <?xml version='1.0' ?>
      <!DOCTYPE jboss PUBLIC
      "-//JBoss//DTD JBOSS 3.2//EN"
      "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">

      <!-- Version: $Id: jboss.xml,v 1.6.2.3 2003/03/05 02:40:34 starksm Exp $ -->

      <invoker-proxy-bindings>
      <invoker-proxy-binding>
      this-rmi-invoker
      <invoker-mbean>jboss:service=invoker,type=jrmp</invoker-mbean>
      <proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
      <proxy-factory-config>
      <client-interceptors>

      org.jboss.proxy.ejb.HomeInterceptor
      org.jboss.ha.httpsession.beanimpl.ejb.ClientTCLInterceptor
      org.jboss.invocation.InvokerInterceptor


      org.jboss.proxy.ejb.EntityInterceptor
      org.jboss.ha.httpsession.beanimpl.ejb.ClientTCLInterceptor
      org.jboss.invocation.InvokerInterceptor

      <list-entity>
      org.jboss.proxy.ejb.ListEntityInterceptor
      org.jboss.ha.httpsession.beanimpl.ejb.ClientTCLInterceptor
      org.jboss.invocation.InvokerInterceptor
      </list-entity>
      </client-interceptors>
      </proxy-factory-config>
      </invoker-proxy-binding>
      </invoker-proxy-bindings>

      <enterprise-beans>

      <ejb-name>ClusteredHTTPSession</ejb-name>
      <jndi-name>clustering/HTTPSession</jndi-name>
      <local-jndi-name>clustering/LocalHTTPSession</local-jndi-name>
      <configuration-name>Clustered in-memory CMP EntityBean</configuration-name>
      <invoker-bindings>

      <invoker-proxy-binding-name>this-rmi-invoker</invoker-proxy-binding-name>

      </invoker-bindings>

      </enterprise-beans>

      <container-configurations>
      <container-configuration>
      <container-name>Clustered in-memory CMP EntityBean</container-name>
      <call-logging>false</call-logging>
      <container-interceptors>
      org.jboss.ha.httpsession.beanimpl.ejb.ServerTCLInterceptor
      org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor
      org.jboss.ejb.plugins.LogInterceptor
      org.jboss.ejb.plugins.EntityLockInterceptor
      org.jboss.ejb.plugins.EntityInstanceInterceptor
      org.jboss.ejb.plugins.EntitySynchronizationInterceptor
      </container-interceptors>
      <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
      <instance-cache>org.jboss.ejb.plugins.ClusterSyncEntityInstanceCache</instance-cache>
      <persistence-manager>org.jboss.ejb.plugins.CMPClusteredInMemoryPersistenceManager</persistence-manager>
      <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>

      <container-cache-conf>
      <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
      <cache-policy-conf>
      <min-capacity>50</min-capacity>
      <max-capacity>1000000</max-capacity>
      <overager-period>300</overager-period>
      <max-bean-age>600</max-bean-age>
      <resizer-period>400</resizer-period>
      <max-cache-miss-period>60</max-cache-miss-period>
      <min-cache-miss-period>1</min-cache-miss-period>
      <cache-load-factor>0.75</cache-load-factor>
      </cache-policy-conf>
      </container-cache-conf>
      <container-pool-conf>
      10
      100
      </container-pool-conf>
      <commit-option>A</commit-option>
      <cluster-config>
      <partition-name>MySpecialNewPartition</partition-name>
      </cluster-config>
      jboss:service=MySpecialNewPartition
      jboss:service=invoker,type=jrmp
      </container-configuration>
      </container-configurations>





      I am able to see the clustered view also.I am using a non-ejb application that contains java,jsp,servlets etc.Next step i want to put a new node for load balancing .I want to know how to do it.I want to implement it.Along with that i want to know any mistake i made in the above files that need to be rectified.Please help me in this matter