Facebook Twitter Gplus LinkedIn YouTube E-mail RSS
Home Caching HelloWorld — a bonus readme

HelloWorld — a bonus readme

When you download the GigaSpacesXAP product (currently at version 6.6.1) you get a few really nice examples.

With those examples come some very detailed instructions and explanations as to how to use GigaSpaces. These instructions are found in the "docs" subfolder under the example root and are written in rich HTML with beautiful screenshots and graphics to help guide the reader.

Example:

GS_HOME/examples/helloworld/docs

Despite the existence of these terrific resources, for some people who are new to the GigaSpaces experience, it might be helpful to have a set of instructions in the traditional readme.txt file. ( I can be so old fashioned sometimes...)

I created the following in the hopes that it will prove useful and speed up the adoption of this wonderful application platform known as GigaSpacesXAP.

Here goes... (Imagine this readme is located in the root of the helloworld example like this:

GS_HOME/examples/helloworld/readme )

The Owen Taylor supplementary HelloWorld README for the GigaSpacesXAP6.6.1 helloworld example:


Hello and welcome to Space-based Computing!

This example shows the basic interaction between a processing unit (where objects are processed) and a simple client that feeds the processing unit with objects to be processed.

There are two ways to run this example: (provided as scripts in this directory)

The first way is simplest and shows the processing unit running in one process and the Feed running in another. Neither of the processes are managed and no clustering technology is employed to provide fail-over or scaling.

To try out the example in this simple way read and follow the first set of instructions below.

[To try out the more complex topology, read and follow the second set of instructions below.]

_______________________________________
FIRST SET OF INSTRUCTIONS::
_______________________________________

This example does the following:
1) starts the processing unit containing the processor and a space
[this is where the work of processing information goes on]
2) Starts the client-side Feeder
[this populates the system with 1000 objects to be processed]

Instructions:
1) Ensure you have GigaSpacesXAP6.6 or higher
2) Ensure you have JDK1.5
3) Navigate to the directory containing this example readme file

Execute the following
> build.sh dist
It will:

a) Build the application and create the jar file versions of the deployment units

Next Execute:

> ../../bin/puInstance.sh ./processor/pu/hello-processor.jar

This will:

b) Start the space-side system which includes a processor and a space

Edit the build.xml file so that this line:

<target name="run-feeder" depends="dist">

Is changed to equal this:

<target name="run-feeder" depends="">

Next Execute:

> build.sh run-feeder

This will:

c) Start the client-side Feeder which populates the system with 1000 objects


If you want to use a GUI to examine what is running, execute:
>../../bin/gs-ui.sh

If you want to feed more information into the system,
you can execute the

> build.sh run-feeder

more than once.

Note: If you wish to open the three Eclipse projects that make up the source for
this example in Eclipse, be aware that they use a variable GS_HOME that must be
configured in your Eclipse workspace. It should point to the install
directory/folder of GigaSpacesXAP6.6.1



_______________________________________
SECOND SET OF INSTRUCTIONS::
_______________________________________

This example does the following:

1) Starts the GigaSpacesXAP runtime environment (Service Grid)
2) Deploys the space-side system as a "cluster" which is split into 4 processing units:

2 partitions
(which divide the total work up between them)

2 dedicated backups
(one for each active partition)

3) Starts the client-side Feeder
[this populates the entire system with 1000 objects to be processed]

Instructions:
1) Ensure you have GigaSpacesXAP6.6 or higher
2) Ensure you have JDK1.5
3) Navigate to the directory containing this example readme file

Execute the following:
> build.sh dist
It will:

a) Build the application and create the jar file versions of the deployment units

Next Execute: (add piping to a log file if you like)

> ../../bin/gsc.sh &
> ../../bin/gsc.sh &
> ../../bin/gsm.sh &


This will:

b) Start the service grid which is the Gigaspaces application server runtime environment

Next Execute:

> ../../bin/gs-ui.sh &

This will:
c) Start the gs-ui so you can see when the service grid is started

(Switch to the middle tab on the left-hand side of the GUI called “Deployments,Details” and you should see two boxes in the bottom left of the screen. Those are your empty GSC runtime containers.)


Edit the build.xml file so that this section:

<macrodef name="deploy">
<attribute name="name"/>
<sequential>
<java classname="org.openspaces.pu.container.servicegrid.deploy.Deploy" fork="false">
<classpath refid="all-libs"/>
<arg value="-groups"/>
<arg value="${groups}"/>
<arg value="-timeout"/>
<arg value="15000"/>
<arg value="@{name}"/>
</java>
</sequential>
</macrodef>

Is changed to equal this:

<macrodef name="deploy">
<attribute name="name"/>
<sequential>
<java classname="org.openspaces.pu.container.servicegrid.deploy.Deploy" fork="false">
<classpath refid="all-libs"/>
<arg value="-groups"/>
<arg value="${groups}"/>
<arg value="-timeout"/>
<arg value="90000"/>
<arg value="-locators"/>
<arg value="localhost"/> <!-- assumes GSM is on same host as you-->
<arg value="-cluster"/>
<arg value="schema=partitioned-sync2backup"/>
<arg value="total_members=2,1"/>
<arg value="@{name}"/>
</java>
</sequential>
</macrodef>

This edit changes the topology of the application being deployed so that there will be 2 primary active instances and 2 backup instances deployed into the service grid.

Next Execute:

> build.sh deploy-processor

This will deploy the newly re-defined 2 primary spaces and accompanying workers and their backup service instances into the service grid (you will see them appear in the gs-ui GUI)

Wait for all the nodes to appear. (There should be 2 nodes with a ‘p’ for primary and 2 nodes with a ‘b’ for backup)
This can take a while… (up to 2 minutes the first time depending on the machine and network)

Next Execute:

> build.sh run-feeder

This will:

c) Start the client-side Feeder which populates the system with 1000 objects


If you want to feed more information into the system,
you can execute the

> build.sh run-feeder

more than once.

Note: If you wish to open the three Eclipse projects that make up the source for
this example in Eclipse, be aware that they use a variable GS_HOME that must be
configured in your Eclipse workspace. It should point to the install
directory/folder of GigaSpacesXAP6.6.1
HTH Owen.
 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
1 Comment  comments 
  • http://www.free-wowgold.com Free WOW Gold

    Thank you for sharing, I came across this article whilst looking for infomation for my term paper, fascinating comments and excellent points produced.

© GigaSpaces on Application Scalability | Open Source PaaS and More