IBM®
Skip to main content
    Country/region [select]      Terms of use
 
 
    
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerworks > My developerWorks >  Dashboard > WebSphere eXtreme Scale V6.1 User Guide > ... > Environment > Installation for a clustered J2SE application
developerWorks
Log In   View a printable version of the current page.
Overview Connect Spaces Forums Wikis
Installation for a clustered J2SE application
Added by bnewport, last edited by Chris.D.Johnson on May 04, 2009  (view change)
Labels: 
(None)

Getting Started Examples Reference API documentation

See the WebSphere eXtreme Scale Wiki for links to eXtreme Scale Version 7.0 documentation.
If you log in with your developerWorks ID, you can leave comments and feedback for the development team.

This topic illustrates how to set up a clustered Java 2 Platform Standard Edition (J2SE) application. A pair of J2SE ObjectGrid server containers is created to host the data, and a single client continually increments an entry in a map.

Setup

Before completing the steps in this topic, either:

  1. Specify the JAVA_HOME system variable in your current operating system command environment, or
  2. Edit the setupCmdLine.bat file in the bin directory of a standalone ObjectGrid installation to specify a JAVA_HOME value.

If you are not using an IBM JVM then please follow the steps in "Using a non-IBM JDK or JRE with ObjectGrid" to ensure the JVM you want to use is configured to use the IBM ORB.

Create a start catalog service script

Standalone ObjectGrid installs with a bin, lib and an xml directory. First, go to the bin directory and create two scripts. Run the following command:

Making a start catalog script (Unix)
startOgServer.sh catalogServer -script startcatalog.sh -listenerHost MyServer.company.com
Making a start catalog script (Windows)
startOgServer.bat catalogServer -script startcatalog.bat -listenerHost MyServer.company.com

This creates a script for starting a single default catalog server. It is important to edit the MyServer.company.com host name to point to the machine running the catalog service. There is no need for application specific class paths on the catalog server.

Create a start application container script

Next, create a startcontainer script as follows:

Making a start container script (Unix)
startOgServer.sh c0 -script startcontainer.sh
-objectgridFile /usr/john/poc/CONFIG/objectgrid.xml
-deploymentPolicyFile /usr/john/poc/CONFIG/deploymentpolicy.xml
-catalogServiceEndpoints MyServer.company.com:2809
-jvmArgs -Xmx1024M -classpath /usr/john/poc/bin
Making a start container script (Windows)
startOgServer.bat c0 -script startcontainer.bat
-objectgridFile /usr/john/poc/CONFIG/objectgrid.xml
-deploymentPolicyFile /usr/john/poc/CONFIG/deploymentpolicy.xml
-catalogServiceEndpoints MyServer.company.com:2809
-jvmArgs -Xmx1024M -classpath /usr/john/poc/bin

Notice that the application classes are added to the class path at /usr/john/poc/bin and are using a 1GB heap. You specified the application objectgrid.xml and deploymentpolicy.xml files on the command line and the catalog server location for bootstrap.

Next, edit the startcontainer.sh (or startcontainer.bat) and replace the reference to 'c0' with $1 (use %1 for Windows). It should have a line similar to the following when you are finished:

Updated start container script
/opt/objectgrid/java/AIX64/jre/bin/java
-Xmx1024M -classpath /usr/john/poc/bin:/opt/objectgrid/java/AIX64/jre/../lib/tools.jar:
/usr/john/lib/objectgrid.jar:/usr/john/session/lib/sessionobjectgrid.jar:
/usr/john/lib/cglib.jar:/usr/john/lib/ogstreamquery.jar:
/usr/john/lib/castor.jar:/usr/john/lib/commons-io.jar:/usr/john/lib/mx4j.jar:
/usr/john/lib/mx4j-tools.jar:/usr/john/lib/mx4j-remote.jar:/usr/john/properties
com.ibm.ws.objectgrid.InitializationService $1
-objectgridFile /usr/john/poc/CONFIG/objectgrid.xml
-deploymentPolicyFile /usr/john/poc/CONFIG/deploymentpolicy.xml
-catalogServiceEndpoints MyServer.company.com:2809

The objectgrid.xml and deploymentdescriptor.xml

Following is a simple objectgrid.xml with a single grid and map contained within it:

Simple objectgrid.xml
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
   xmlns="http://ibm.com/ws/objectgrid/config">
   <objectGrids>
      <objectGrid name="poc" entityMetadataXMLFile="entity.xml">
         <bean id="ObjectGridEventListener" className="poc.Partition">
         </bean>
         <!-- tuning for around 60k (2 x 29023) records in memory -->
         <backingMap name="Record" lockStrategy="PESSIMISTIC" numberOfBuckets="29023" />
      </objectGrid>
   </objectGrids>
</objectGridConfig>

Following is a sample entity.xml file:

Simple entity.xml
<?xml version="1.0" encoding="UTF-8"?>

<entity-mappings xmlns="http://ibm.com/ws/projector/config/emd"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://ibm.com/ws/projector/config/emd ./emd.xsd">

    <description>"Auto-Generated Entity Mapping description"</description>
    <entity class-name="poc.Record" name="Record" access="FIELD"/>
</entity-mappings>

Following is the deploymentpolicy.xml :

deploymentpolicy.xml
<?xml version="1.0" encoding="UTF-8"?>
<deploymentPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ibm.com/ws/objectgrid/deploymentPolicy ../deploymentPolicy.xsd"
   xmlns="http://ibm.com/ws/objectgrid/deploymentPolicy">
   <objectgridDeployment objectgridName="poc">
      <mapSet name="pocset" numberOfPartitions="8" numInitialContainers="2"
 minSyncReplicas="1" maxSyncReplicas="1" maxAsyncReplicas="0">
         <map ref="Record"/>
      </mapSet>
    </objectgridDeployment>
</deploymentPolicy>

These three files comprise the application configuration for a distributed ObjectGrid. The objectgrid.xml file describes each object grid, any plugins or event handlers and the maps within those grids. There is a single grid called poc, with an ObjectGridEventListener attached and a single Map, Record. The objectgrid.xml also has a reference to the entity.xml that in this case, is defined as an entity using J2SE 5 annotations.

The deployment descriptor provides placement information for each grid in the objectgrid.xml. The important points for simple scenarios are:

  • How many partitions?
  • How many synchronous replicas?
  • How many asynchronous replicas?

The sample specifies 8 partitions with each partition primary having 1 synchronous replica and no asynchronous replicas. A numInitialContainers is specified as well to prevent placement, until that number of container JVMs are started. This prevents thrashing, because the catalog service waits for N containers before placement. The default minimum number of initial containers equals one more than the number of minimum synchronous replicas. If you specify a number smaller than the default minimum, the default will be used.

Starting it up

On box A, named MyServer, run the following command:

Starting the catalog server (Unix)
. startcatalog.sh &
Starting the catalog server (Windows)
start startcatalog.bat

This command starts it in the background. Now start one container using this command:

Starting the first container (Unix)
. startcontainer.sh c0 &
Starting the first container (Windows)
start startcontainer.bat c0

Now, on the same machine or on a second machine with the same files installed, run this command to start the second container:

Starting the second container (Unix)
. startcontainer.sh c1 &
Starting the second container (Windows)
start startcontainer.bat c1

Both containers now contact the catalog service. When both JVMs attach, the catalog places the 8 partition primaries and their 8 replicas on those two containers.

Additional Information

Wiki Disclaimer and License
© Copyright IBM Corporation 2007,2009. All Rights Reserved.
Docs Installation for a Java 2 Platform,Standard Edition (J2SE) client (WebSphere eXtreme Scale V6.1 User Guide)


 
    About IBM Privacy Contact