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:
- 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
- In the console, change directory to <GigaSpaces Root>\ServiceGrid\bin
- 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:
- Start the gs shell using the gs command located at <GigaSpaces Root>\ServiceGrid\bin
- cd to the following directory: <GigaSpaces Root>\ServiceGrid\config\deployment
- 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
- 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>
- 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:
- Start the Service Grid Admin UI, using the gs-ui script located at <GigaSpaces Root>\ServiceGrid\bin folder.
- 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.
- 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. |
- 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.
- 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.
- 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:
- Select the Compute Grid element in the deployment tree.
- In the deployed instances view, double-click the green box labeled Job Submission. The Job Submission Administration UI is displayed.
- From the Job Name drop-down menu, select Prime Number Cruncher.
- In the Arguments field, type a large number.
- 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:
- cd to <GigaSpaces Root>\ServiceGrid\examples\prime\bin
- Run the prime-cli script and follow the instructions. See sample output below.
RELATED TOPICS
Add Comment