Deploying Compute Grid and Running Jobs

  GigaSpaces 5.X

Documentation Home
Quick Start Guide
Release Notes

Previous release

  Search Here
Searching GigaSpaces Platform 5.X Documentation

                                               

Summary: An example of how to prepare the environment, deploy the Compute Grid service, and run a job.

Overview

To demonstrate how to deploy the Compute Grid, this section explains how to prepare and run the Prime Number Computation example.

Preparing the Example

To prepare the environment for the Compute Grid:

  1. Verify that prime-job.jar is located under the <GigaSpaces Root>\ServiceGrid\examples\prime\lib directory. If not, run the ant command under the ServiceGrid\examples\prime directory.
    D:\GigaSpacesEE5.0\ServiceGrid\examples\prime>ant
    Buildfile: build.xml
    prepare:
        [mkdir] Created dir: D:\GigaSpacesEE5.0\ServiceGrid\examples\prime\build\classes
        [mkdir] Created dir: D:\GigaSpacesEE5.0\ServiceGrid\examples\prime\lib
        [mkdir] Created dir: D:\GigaSpacesEE5.0\ServiceGrid\deploy\examples\prime\lib
    compile:
        [javac] Compiling 5 source files to D:\GigaSpacesEE5.0\ServiceGrid\examples\prime\build\classes
    prime-job.jar:
          [jar] Building jar: D:\GigaSpacesEE5.0\ServiceGrid\examples\prime\lib\prime-job.jar
    jars:
    install:
         [copy] Copying 1 file to D:\GigaSpacesEE5.0\ServiceGrid\deploy\examples\prime
    all:
    BUILD SUCCESSFUL
  2. In the console, change directory to <GigaSpaces Root>\ServiceGrid\bin
  3. Type gs-all. This command starts an instance of the Grid Service Container (GSC) and Grid Service Monitor (GSM) under the same VM.

Deploying Compute Grid

This section explains how to deploy the Compute Grid, with specific configuration parameters needed for the prime number example, using either the Service Grid CLI or the Admin UI.

Deploying Compute Grid Using CLI

To deploy the Compute Grid using the Service Grid CLI:

  1. Start the gs shell using the gs command located at <GigaSpaces Root>\ServiceGrid\bin
  2. cd to the following directory: <GigaSpaces Root>\ServiceGrid\config\deployment
  3. Run the ls command to see the available deployment descriptors.
    The following output is displayed:
    gs> pwd
    "D:\GigaSpacesEE5.0\ServiceGrid\config\deployment" is the current working directory
    gs> ls
    total 11367
    computegrid.xml
    CVS
    gigaspace-service.xml
    gigaspace.xml
    includes
    partitioned_cluster.xml
    replicated_cluster.xml
  4. Deploy the Compute Grid service with the specific override provided for the prime example, by typing deploy computegrid.xml <GigaSpaces Root>\ServiceGrid\examples\prime\config\override.xml
    The following output is displayed:
    gs> deploy computegrid.xml D:\GigaSpacesEE5.0\ServiceGrid\examples\prime\config\override.xml
    total 1
    Deploying [Compute Grid, GigaSpace Service Deployment], total services [4] ...
            [1] GigaSpace provisioned to    192.168.2.101
            - There are [3] service provisioning requests outstanding
    Deployment notification time 5000 millis, Command completed
    gs>
  5. Verify that the services have been deployed correctly, by running the list gsm command.
    The following output is displayed:
    gs> list gsm
    total 1
    [1]   Grid Service Manager     gs-grid                      PC-SHAY@192.168.2.
            Compute Grid    role=primary
                Job Submission      planned=1       actual=1        pending=0
                    id=1            192.168.2.101
                GigaSpace Worker    planned=2       actual=2        pending=0
                    id=2            192.168.2.101
                    id=1            192.168.2.101
            GigaSpace Service Deployment    role=primary
                GigaSpace           planned=1       actual=1        pending=0
                    id=1            192.168.2.101

Deploying Compute Grid Using Admin UI

To deploy the Compute Grid using the Service Grid admin UI:

  1. Start the Service Grid Admin UI, using the gs-ui script located at <GigaSpaces Root>\ServiceGrid\bin folder.
  2. Start the Deployment Wizard by clicking the Deploy button or the File->Deploy Application menu.

    The Deploy Wizard will be displayed:

    Select An Application As defined by a deployment descriptor option as the deployment type. Click Next.

  3. In this wizard step, fill in the two fields as follows:
    • In the Deployment Descriptor field, type <GigaSpaces Root>\ServiceGrid\config\deployment\computegrid.xml
    • In the Configuration Override field, type <GigaSpaces Root>\ServiceGrid\examples\prime\config\override.xml

      The deployment descriptor for the Compute Grid contains the definition of two services: Job Submission (master) and Compute Agents (workers). Both services have dependency on a Space Service instance named GigaSpace.
      The configuration override file provided in the Prime Computation Example, override.xml, is used to load the predefined job definition of the example. It does this by overriding the job submission resources in the Compute Grid deployment descriptor with the Prime task JAR. The Job Submission service then scans all the classes in the JAR that implement the task interface, and adds them to the list upon deployment.
  4. In this wizard step you determine the location of the code of the GigaSpaces service, by selecting a codebase server. This enables the Service Grid to dynamically deploy GigaSpaces instances on machines that do not have GigaSpaces installed. The server location is provided as a URL.
    Select one of the GSM instances from the list.

  5. Click Verify. This verifies that the location provided by the deployment descriptor is available. If not, another GSM instance, which maintains a reference to the service, is suggested.
    The verification step is required only if the codebase server provided in the deployment descriptor is unavailable.

    Once the verification finishes successfully, the Deploy button becomes enabled.

  6. Click the Deploy button to start the deployment process.
    Once the Service has been deployed successfully the Deployment Wizard will display the following:

Monitoring Compute Grid Deployment Using Admin UI

Upon successful deployment, the Service Grid Admin UI displays the deployment tree of the services and their dependencies.

Running the Prime Number Computation Job

This section explains how to run the prime number computation job, using either the Service Grid Admin UI or the CLI.

Running Using Admin UI

To run the Prime Number Computation example:

  1. Select the Compute Grid element in the deployment tree.

  2. In the deployed instances view, double-click the green box labeled Job Submission. The Job Submission Administration UI is displayed.
  3. From the Job Name drop-down menu, select Prime Number Cruncher.

  4. In the Arguments field, type a large number.
    You can find large prime numbers at: http://primes.utm.edu/largest.html
  5. Click Submit.

Once the Compute Grid will require additional compute resources (more workers) it will launch these automatically. See below how the Service Grid launch additional worker:

See below the worker Service UI displaying the backlog trace. You can access this by double clicking the worker Service.

You can view the amount of Task and Result objects in the space by clicking the Space View button and later clicking the Classes node at the GigaSpaces space.

Running Using CLI

To run the Prime Number Computation example using CLI:

  1. cd to <GigaSpaces Root>\ServiceGrid\examples\prime\bin
  2. Run the prime-cli script and follow the instructions. See sample output below.
    D:\GigaSpacesEE5.0\ServiceGrid\examples\prime\bin>prime-cli.cmd
    JAVA_HOME environment variable is set to D:\JDK\jdk1.5.0_04 in "<GigaSpaces Root>\bin\setenv.bat"
    Environment set successfully from D:\GigaSpacesEE5.0\bin\\..
    Setting java.rmi.server.codebase : http://192.168.2.101:1209/prime-job.jar
    Using Lookup argument : jini://*//*/GigaSpace?groups=gigaspaces-1506
    Proceed? [y]/n n
    Enter Lookup argument : jini://*//*/GigaSpace?groups=gigaspaces-5.0EE
    Using Lookup argument : jini://*//*/GigaSpace?groups=gigaspaces-5.0EE
    Proceed? [y]/n y
    Discovering compute grid ...
    Enter prime number candidate : 5435345
    Submitting PrimeTask ...
    Creating 2331 tasks, 2331 numbers per task.
    Waiting for results, total tasks=2331, transaction=null
    [2331] results tallied, divisor 1087069 found for 5435345
    Wrote [2331] entries in 1375 millis, Workers took total of 3546 millis to process
    5435345 is prime : false
    

RELATED TOPICS

Compute Grid
Creating a Custom Job
Running Jobs from the Command Line
Spring Parallel Processing Integration
task - Service Grid CLI

Wiki Content Tree


Your Feedback Needed!

We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.

Labels

 
(None)