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

Deploying onto the Service Grid


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.

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.

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).

Application With Infra.jpg

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

Sync2Backup With Infra.jpg

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

Deployment Process

After the Hello World Processor application is built and put into a JAR file, we start the Service Grid Components. We use the Management Center GUI to deploy the Hello World Processor to the Service Grid, first as a single instance, and then with a backup instance as well, to demonstrate failover.

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.

Deploying.jpg

Figure 5. Deploying the Processor Processing Unit onto the Service Grid

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.

Failover.jpg 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.

Feeder Proxy.jpg

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

Starting the Service Grid Components and Deploying the Application

Steps to deploy the application:

Install GigaSpaces

Note

After going through the previous tutorial Step Two - Creating the Hello World Application, you should have GigaSpaces installed and the Hello World sample application environment set. If not, please download GigaSpaces and set up your development environment to work with GigaSpaces - this is needed to run the tutorial sample application.

Starting the Service Grid Components

  1. Start GigaSpaces Management Center (GS-UI) by running <XAP Root>/bin/gs-ui.bat(.sh).
  2. Start a GigaSpaces Agent (GSA) by running <XAP 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.

The GigaSpaces Agent

The GigaSpaces Agent (GSA) acts as a process manager that can spawn and manage Service Grid processes (Operating System level processes) such as the Grid Service Manager (aka The GigaSpaces Manager), the Grid Service Container (aka The GigaSpaces Container), and 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!

Tip

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

Step 1. 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

Step 2. Click the Deploy Processing Unit Button deploy_processing_unit_button.jpg to open the Deployment Wizard dialog.
Step 3. Click the Processing Unit field button, to browse for the processing unit JAR file.
Step 4. Browse to the hello-processor.jar JAR file, located at <Hello World Example Root>/processor/pu folder, and select it.
Step 5. Click the Deploy button, to deploy and wait for the processing unit to be provisioned to the running Grid Service Container.

Running the Feeder

Step 6. 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

Step 7. In the Deployed Processing Units tab, under the Processing Units tree, right click the hello-processor* deployment and click *Undeploy.
Step 8. Click Yes to approve.

Deploying as a Single Instance with Backup

Note

If you are a community edition user, 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

Step 1. Edit the processor’s pu.xml configuration file located under <XAP root>/examples/helloworld/processor/src/META-INF/spring folder.
Step 2. Uncomment (Remove the surrounding ), or add the following SLA bean definition, which contains the deployment configuration, to the pu.xml file:

<os-sla:sla
    cluster-schema="partitioned-sync2backup"
    number-of-instances="1"
    number-of-backups="1"
    max-instances-per-vm="1">
</os-sla:sla>

Step 3. 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

Step 4. Click the Deploy Processing Unit Button* deploy_processing_unit_button.jpg to open the *Deployment Wizard dialog.
Step 5. Click the Processing Unit field button, to browse for the processing unit JAR file.
Step 6. Browse to the hello-processor.jar JAR file, located at <Hello World Example Root>/processor/pu folder, and select it.
Step 7. 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