This page describes an older version of the product. The latest stable version is 15.2.

Step Three - Deploying onto the Service Grid

Tutorial ssummary: In this tutorial you learn how to deploy the Hello World application onto the GigaSpaces Service Grid to achieve fail-over, scaling and self-healing capabilities for your application. Approx 10 min

Application Components

The Processing Unit that we deploy onto the Service Grid is our Hello World Processor from the previous step.
Reminder - the Feeder application writes each Message object to the processor Processing Unit, which in turn processes them.

Figure 1. The Hello World Feeder and Processor Processing Unit

Infrastructure (Service Grid) Components

The Service Grid is a set of containers (Grid Service Containers - GSCs) managed by one or more managers (Grid Service Managers - GSMs).
Each Grid Service Container runs inside its own JVM. The containers themselves host Processing Units.
The Grid Service Manager manages the deployment of processing units and their provisioning to the the Grid Service Containers. In production scenarios you may want to have more than one manager, so it does not become a single point of failure.
The GigaSpaces Management Center is the graphical user interface for administrating and monitoring the Service Grid and the deployed applications.

Figure 2. A Service Grid consisting of a Grid Service Manager and two Grid Service Containers

Deployment Overview

In this tutorial we deploy the Hello World Processor onto the service Grid, first as a single instance (Figure 3), then with an additional backup instance to support failover (Figure 4).

Figure 3. The Hello World Processor deployed onto the Service Grid as a single instance

Figure 4. The Hello World Processor deployed onto the Service Grid with one primary instance and one backup instance

What happens during the deployment process
Deploying a Processing Unit is done by selecting its JAR file for deployment from the Management Center user interface. The JAR is then passed to the Grid Service Manager, which analyzes its deployment requirements (These requirements are expressed in a file called the Deployment Descriptor) The Grid Manager then provisions the Processing Unit instances into the Grid Service Containers, which in turn load the processing unit binaries from the Grid Service Manager and start the Processing Unit instance - see Figure 5 below.

Failover to a Backup Instance

To achieve failover capabilities and avoid a single point of failure, the Processing Unit is deployed with two instances - a primary and a backup. All objects written to the space of the primary instance are synchronously replicated to the backup instance, thus enabling quick failover to the backup instance in case the primary instance fails.
In addition, after the failover, the Grid Service Manager provisions a new backup to another Grid Service Container (if it exists), to maintain high availability for the Processing Unit. This is the self-healing part of the GigaSpaces deployment mechanism.

Figure 6. Failover to the backup instance after failure of the primary Processing Unit

Feeder View of the Failover Process

Since the feeder interacts with (writes objects to) the space, using a space proxy, which hides the actual deployment topology and runtime status from it, the whole failover process is completely transparent to it.
The only noticeable effect may be a slight delay in the space response time to the feeder calls.

Figure 7. The Feeder is using a proxy that automatically connects to the primary Processing Unit

Starting the Service Grid Components

Start a GigaSpaces Agent (GSA) by running <GigaSpaces Root>/bin/gs-agent.(sh/bat).
The GSA, by default, will start 2 local Grid Service Containers, and manage a global Grid Service Manager and a global Lookup Service.

A new Grid Service Manager starts on your local machine, and its output can be viewed by clicking its name gsm-1 inside the Hosts tab.
A new Grid Service Containers start on your local machine, and its output can be viewed by clicking their names gsc-1/gsc-2 inside the Hosts tab.
The Grid Service Manger automatically detects the Grid Service Containers. Now we have a Service Grid with one manager and two containers up and running!

(The Service Grid Components started here are local services, all running on your own machine. Naturally, in a production environment, they are started on separate machines, using the startup scripts that the product provides.)

Deploying the Application with No Backup Instances

Prepare the Processor Processing Unit for deployment with No Backups

Build the processor Processing Unit by running <Hello World Example Root>/build.bat(.sh) dist.
This compiles the Processor source files and creates the processing unit JAR file, ready for deployment under <Hello World Example Root>/processor/pu/hello-processor.jar.

Deploying the Hello World Processor with No Backup

Click the Deploy Processing Unit Button to open the Deployment Wizard dialog.

Click the Processing Unit field … button, to browse for the processing unit JAR file.

Browse to the hello-processor.jar JAR file, located at <Hello World Example Root>/processor/pu folder, and select it.

Click the Deploy button, to deploy and wait for the processing unit to be provisioned to the running Grid Service Container.

Running the Feeder

Start the feeder by running <Hello World Example root>/build.bat(.sh) run-feeder.

Before deploying the application with a backup, we first undeploy the current single instance deployment:

Undeploying the Single Instance Deployment

In the Deployed Processing Units tab, under the Processing Units tree, right click the hello-processor* deployment and click *Undeploy.

Click Yes to approve.

Deploying as a Single Instance with Backup

For Community Edition Users

If you are a community edition user, please note that you will not be able to perform this step since the community edition limits the number of space instances to one

Prepare the Processor Processing Unit for deployment as a single instance with backup

Build the processor Processing Unit by running <Hello World Example Root>/build.bat(.sh) dist.
This compiles the processor into a JAR file, ready for deployment, located under <Hello World Example Root>/processor/pu/hello-processor.jar.

Deploying the Hello World Processor as a Single Instance with Backup

Click the Deploy Processing Unit Button* to open the *Deployment Wizard dialog.

Click the Processing Unit field … button, to browse for the processing unit JAR file.

Browse to the hello-processor.jar JAR file, located at <Hello World Example Root>/processor/pu folder, and select it.

Click the Deploy button, to deploy and wait for the processing unit instances to be provisioned to the running Grid Service Containers.

Running the Feeder

Start the feeder by running <Hello World Example root>/build.bat(.sh) run-feeder