TrackStudio 3.0 Documentation
Clustering

This topic described how to configure TrackStudio to be launched on several application servers grouped into a cluster.

For the sake of better scalability and stability TrackStudio can be launched on several application servers grouped into a cluster. Load balancing makes it possible to distribute the load between servers in the cluster. A failover cluster is a set of servers that are configured so that if one server becomes unavailable, another server automatically takes over for the failed server and continues processing. 

TrackStudio uses cache for data processing. The cache stores the information about tasks and users that have been accessed and contains the results of database queries. When TrackStudio works within an application server cluster, it is important to synchronize the caches between cluster nodes. Once any object in the cache is changed, TrackStudio sends out notifications to TrackStudio instances running on other cluster nodes. Those notifications are used to clear the changed objects from their caches. 

To configure a TrackStudio cluster: 

1) Install TrackStudio on all cluster nodes. As TrackStudio uses broadcast messages to send notifications, the cluster nodes must be within one physical network. All instances must use the same version of TrackStudio Enterprise. 

2) Edit the trackstudio.properties files on both nodes. Set trackstudio.cluster to yes and specify the same trackstudio.cluster.name for all cluster nodes. 

3) Specify a directory for storing uploaded files: trackstudio.uploadDir. Both instances must use the same directory in which to store uploads. You can use shared disk in Windows or NFS in UNIX. 

4) Specify a directory in which to store the full text search index: trackstudio.indexDir. Each instance must have a local copy of indexDir

5) Configure database connections. Both instances must use the same database. 

6) Configure the rest of the settings and launch TrackStudio on all cluster nodes. While loading, TrackStudio displays messages about active nodes in the cluster. For instance, if there are 2 instances on the cluster (both are running on one server), the display will be as follows:

-------------------------------------------------------
GMS: address is TMK-12X3:4390
-------------------------------------------------------
[18:38:19.93] ... finished starting new JavaGroups Communicator.
[18:38:19.98] A host has joined the cache notification bus: TMK-12X3:4383
[18:38:19.98] A host has joined the cache notification bus: TMK-12X3:4390

Note that TrackStudio synchronizes only caches, but does not synchronize application server sessions. The application server must support session synchronization to make load balancing and failover possible. Refer the documentation for you application server to get more details on how to configure an application server cluster and enable session synchronization. 

 

Jetty included in TrackStudio/SA does not support session replication.

Example. 

To configure an application server cluster using Resin: 

1) Install and configure resin 

2) Install and configure TrackStudio on both nodes 

3) Define cluster configuration: trackstudio.cluster and trackstudio.cluster.name 

4) Set trackstudio.indexDir and trackstudio.uploadDir 

5) Create front.conf and back.conf in [RESIN_HOME]/conf 

 

conf/front.conf:

 

<resin xmlns="http://caucho.com/ns/resin">
  <server>
    <http id='frontend' port='8080'/>
      <cluster id='backend'>
        <srun id='a' host='127.0.0.1' port='6802'/>
        <srun id='b' host='127.0.0.1' port='6803'/>
      </cluster>
      <access-log path='log/access.log'>
        <rollover-period>2W</rollover-period>
      </access-log>
      <host id=''>
        <web-app id='/'>
          <servlet>
            <servlet-name>backend</servlet-name>
            <servlet-class>com.caucho.servlets.LoadBalanceServlet
            </servlet-class>
            <init>
              <cluster>backend</cluster>
            </init>
          </servlet>
          <servlet-mapping url-pattern='/*' servlet-name='backend'/>
        </web-app>
      </host>
  </server>
</resin>
conf/back.conf:

 

<!--
   - Resin 3.0 configuration file.
  -->
<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="http://caucho.com/ns/resin/core">
  <!--
     - Logging configuration for the JDK logging API.
    -->
  <log name='' level='info' path='stdout:' timestamp='[%H:%M:%S.%s] '/>
  <log name='com.caucho.java' level='fine' path='stdout:'
       timestamp='[%H:%M:%S.%s] '/>
  <log name='com.caucho.loader' level='config' path='stdout:'
       timestamp='[%H:%M:%S.%s] '/>

  <!--
     - For production sites, change dependency-check-interval to something
     - like 600s, so it only checks for updates every 10 minutes.
    -->
  <dependency-check-interval>2s</dependency-check-interval>

  <!--
     - You can change the compiler to "javac" or jikes.
     - The default is "internal" only because it's the most
     - likely to be available.
    -->
  <javac compiler="internal" args=""/>

  <!-- Security providers.
     - <security-provider>
     -    com.sun.net.ssl.internal.ssl.Provider
     - </security-provider>
    -->

  <!--
     - If starting bin/resin as root on Unix, specify the user name
     - and group name for the web server user.
     -
     - <user-name>resin</user-name>
     - <group-name>resin</group-name>
    -->

  <!--
     - Configures threads shared among all HTTP and SRUN ports.
    -->
  <thread-pool>
    <!-- Maximum number of threads. -->
    <thread-max>128</thread-max>

    <!-- Minimum number of spare connection threads. -->
    <spare-thread-min>25</spare-thread-min>
  </thread-pool>

  <!--
     - Configures the minimum free memory allowed before Resin
     - will force a restart.
    -->
  <min-free-memory>1M</min-free-memory>

  <server>
    <!-- adds all .jar files under the resin/lib directory -->
    <class-loader>
      <tree-loader path="$resin-home/lib"/>
    </class-loader>

    <!-- Configures the keepalive -->
    <keepalive-max>500</keepalive-max>
    <keepalive-timeout>120s</keepalive-timeout>

    <!--
       - The local cluster, used for load balancing and distributed
       - backup.
      -->
        <cluster>
                <srun id='a' host='127.0.0.1' port='6802' index='1'/>
                <srun id='b' host='127.0.0.1' port='6803' index='2'/>
                <cluster-store type="tcp" path="cluster"/>
        </cluster>

    <!--
       - Enables/disables exceptions when the browser closes a connection.
      -->
    <ignore-client-disconnect>true</ignore-client-disconnect>

    <!--
       - Enables the cache
      -->
    <cache path="cache" memory-size="10M"/>

    <!--
       - Defaults applied to each web-app.
      -->
    <web-app-default>
      <session-config>
          <session-timeout>120</session-timeout>
          <cluster-store/>
      </session-config>

      <!--
         - Sets timeout values for cacheable pages, e.g. static pages.
        -->

      <cache-mapping url-pattern="/" expires="5s"/>
      <cache-mapping url-pattern="*.gif" expires="60s"/>
      <cache-mapping url-pattern="*.jpg" expires="60s"/>

      <!--
         - Servlet to use for directory display.
        -->
      <servlet servlet-name="directory"
              servlet-class="com.caucho.servlets.DirectoryServlet"/>
    </web-app-default>

    <!--
       - Sample database pool configuration
       -
       - The JDBC name is java:comp/env/jdbc/test
       -
         <database>
           <jndi-name>jdbc/mysql</jndi-name>
           <driver type="org.gjt.mm.mysql.Driver">
             <url>jdbc:mysql://localhost:3306/test</url>
             <user></user>
             <password></password>
            </driver>
            <prepared-statement-cache-size>8
            </prepared-statement-cache-size>
            <max-connections>20</max-connections>
            <max-idle-time>30s</max-idle-time>
          </database>
      -->

    <!--
       - Default host configuration applied to all virtual hosts.
      -->
    <host-default>
      <class-loader>
        <compiling-loader path='webapps/WEB-INF/classes'/>
        <library-loader path='webapps/WEB-INF/lib'/>
      </class-loader>

      <!--
         - With another web server, like Apache, this can be commented out
         - because the web server will log this information.
        -->
      <access-log path='logs/access.log'
            format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
            rollover-period='1W'/>

      <!-- creates the webapps directory for .war expansion -->
      <web-app-deploy path='webapps'/>

      <!-- creates the deploy directory for .ear expansion -->
      <ear-deploy path='deploy'>
        <ear-default>
          <!-- Configure this for the ejb server
             -
             - <ejb-server>
             -   <config-directory>WEB-INF</config-directory>
             -   <data-source>jdbc/test</data-source>
             - </ejb-server>
            -->
        </ear-default>
      </ear-deploy>

      <!-- creates the deploy directory for .rar expansion -->
      <resource-deploy path='deploy'/>

      <!-- creates a second deploy directory for .war expansion -->
      <web-app-deploy path='deploy'/>
    </host-default>

    <!-- includes the web-app-default for default web-app behavior -->
    <resin:import path="${resinHome}/conf/app-default.xml"/>

    <!-- configures the default host, matching any host name -->
    <host id=''>
      <document-directory>doc</document-directory>

      <!-- configures the root web-app -->
      <web-app id='/'>
        <!-- adds xsl to the search path -->
        <class-loader>
          <simple-loader path="$host-root/xsl"/>
        </class-loader>

        <servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>
      </web-app>
    </host>
  </server>
</resin>

6) Start instances:

bin/httpd -conf conf/front.conf -server frontend
bin/httpd -conf conf/back.conf -server a
bin/httpd -conf conf/back.conf -server b

7) Now TrackStudio is available on http://127.0.0.1:8080/TrackStudio 

More details on resin configuration is available at http://www.caucho.com/resin-3.0/config/balance.xtp

You are here: Installation > Clustering
Copyright (c) 2002-2004. TrackStudio, Ltd. All rights reserved.