SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Downloaden Sie, um offline zu lesen
Installing and Running GridGain-1.5.1



1.0 GridGain Definition

GridGain is a grid computing platform for Java. It is developed in Java for Java developers and is
a natural extension of the latest Java development methodologies.

2.0   Description of Experiment and Defining Requirements
The goal of the experiment is to setup GridGain and run a gridded application on the platform.

Hardware Architecture: Dell Dimension 8200
Software Configuration:

Processor – Intel Pentium 4 1.8GHz

RAM – 512mb

Operating System – Fedora Core 6

Installed Software:

      1) GridGain – 1.5.1 – obtained free from http://www.gridgain.com
      2) Java 1.6 – obtained free from http://java.sun.com/javase/6/
      3) Eclipse – obtained free from http://www.eclipse.org

3 Setting up software and hardware
This section details how we set up Java 1.6, Eclipse, and GridGain

3.1 Setting up Java 1.6
Installation of Java 1.6 was straightforward. After obtaining the installation (bin) files, we ran
the program and Java was installed

 However, this new installation did not replace the java file in /usr/bin, which is the default
command run whenever the java command is issued. Thus, the system continued to use the old
java installation. We created a symbolic link in the /usr/bin folder called java that pointed to the
location of the newly installed java file. The syntax is sudo ln –s <location of new java file>
java. This operation would fail if there already is a file called java in /usr/bin. It is wise to
rename the current java file before creating the link. The syntax to rename the file would be
mv java <new name for java file>. The version of Java installation can be checked by running
the command java –version.

3.2 Setting up GridGain 1.5
We encountered one problem when we tried to install GridGain. GridGain requires that a
JAVA_HOME environment variable be set. This environment variable points to the location of
the java installation that GridGain would use. This Java installation has to be version 1.5 or later.
To set this environment variable, we added the line export JAVA_HOME=<location of java
installation> to the /etc/profile file. After the variable was set, the GridGain installation run
smoothly.

Running a node of GridGain presented us with new problems. GridGain requires that a
GRIDGAIN_HOME environment variable be set. This environment variable points to the
installation folder of GridGain. The environment variable is set in the same way as the
JAVA_HOME environment variable. The line export GRIDGAI _HOME=<location of
GridGain installation> is added to /etc/profile file.

In order to give GridGain access to other computers on the network, multicast should be enabled
on the local computer. However, multicast is turned off by default. To turn it on, we run the
command route –add –net 224.0.0.0 netmask 240.0.0.0 dev eth0

This however did not fully solve the problem. The local firewall was blocking GridGain’s
attempts to contact other computers. To turn the firewall off, we run the command sudo
/sbin/service iptables stop

After these steps, the node started up.

3.3 Setting up Eclipse
Eclipse runs without a problem after downloading and extracting it. It should be noted that
Eclipse 3 requires Java 1.6.

4.0 Experiment Setup and Code
We decided to implement a gridded merge sort application. The merge sort algorithm splits the
input to sort the items. This makes it an easy algorithm to distribute over several nodes.

4.1 How Merge Sort works
The algorithm recursively splits the input array into smaller arrays until each array has a size of
one. It then puts the array back together, sorting the items before putting them in the array.

How the Gridded Merge Sort works. It recursively splits the input array until the constituent
arrays are below a specified size. The arrays are then sent to remote nodes for execution. Each
node runs the merge sort algorithm and returns a sorted version of the array it received. These
sorted arrays are then merged to form the whole sorted array.

4.2 Programming in GridGain
The documentation and API for GridGain can be found at
http://www.gridgain.com/javadoc/org/gridgain/grid/package-summary.html.

4.3 Experiment Setup
I used a modified form of the merge sort algorithm implementation found on the site 


To set up the experiment, we first started up the Eclipse IDE. We created a new Java project.
After this, we added the GridGain libraries to the build path of the project.

4.4 Code
The merge sort class extends the GridTaskSplitAdapter class. The GridTaskSplitAdapter adapter
can be used when jobs can be randomly assigned to available grid nodes. This adapter is
sufficient in most homogenous environments where all nodes are equally suitable for executing
grid job. Therefore, this is perfect for our needs. The code that does the sorting is readily
available on the internet and is omitted from this report.



The abstract method split() must controls how the task is split up into jobs. This implementation
of the split method recursively splits the array until it reaches a specified size.
public Collection<? extends GridJob> split(int gridSize, int[] A) throws
GridException {

                 List<GridJob> jobs = new ArrayList<GridJob>(array.size());

              if (A.length<=10)//add array to list of jobs if it meets the
size requirement
              {
                    jobnum++;
                    array.add(A);
                    System.out.println("Job "+ jobnum + (" added"));
              }

                 else //recursively split arrays if size is greater than 10
                 {

                         int mid   = A.length/2;
                         int k =   mid;
                         int[] B   = new int[mid];
                         int[] C   = new int[(A.length-mid)];

                         for (int i = 0; i<mid; i++)
{
                                B[i]=A[i];

                         }

                         for (int i = 0; i<(A.length-mid); i++)
                         {
                               C[i]=A[k];
                               k++;
                         }

                         split(gridSize, B);//recursively split arrays
                         split(gridSize, C); //recursively split arrays

                     }
                 //assign each task to a job

              for (final int [] arra : array)
              {
                    jobs.add(new GridJobAdapter<int[]>(arra)//create jobs
from items in the job list
                    {

                                public Serializable execute()//code for each job to
execute
                                {
                                        System.out.println("Sorting... Be patient");
                                        MergeSort.sort(arra);
                                        nodecount++;
                                        System.out.println("Node "+ nodecount + "
results ...");
                                        for (int i = 0; i<arra.length; i++)
                                              System.out.println(arra[i]+ " ");
                                        System.out.println("");
                                        return arra;
                                }
                         });

                      }
                      return jobs;
                                                            }



When the task is split, each individual task is assigned to a job (GridJobAdapter). Each job
executes the code found in the execute method of the GridJobAdapter. This implementation of
the execute method calls the sort method of the class. When the job is complete, the results are
put in a collection and returned.

The reduce method aggregates the job results received from the split method. This
implementation of the split method merges the sorted arrays into one sorted array. It uses a
helper method called collapse.
public Serializable reduce(List<GridJobResult> results) throws GridException
//aggregates results from grids
        {
              int[] sorted = new int[5];

                     Vector<int[]> store = new Vector<int[]>();

                 for (GridJobResult res : results)//get data from successful grid
jobs
                 {
                          store.add((int[]) res.getData());
                 }

                 while (store.size()>2)//merge individual arrays received from
grids
                          collapse(store);

           if (store.size()<= 2)
           {
             if (store.size()==2)
             {
                  sorted = new
int[(store.elementAt(0).length+store.elementAt(1).length)];
                   merge(store.elementAt(0), store.elementAt(1), sorted);
             }
             if (store.size()==1)
             {
                   sorted = new int[store.elementAt(0).length];
                   sorted = store.elementAt(0);
             }
           }


                return sorted;
           }
 }

private void collapse(Vector<int[]> store)
        {
              int size = store.size();
              if (size==2)
                    return;
              else
              {
                    int[] temp = new
int[(store.lastElement().length+store.elementAt(size-2).length)];
                    merge(store.lastElement(), store.elementAt(size-2),
temp);
                    store.add(size-2, temp);
                    store.setSize(size-1);
                    return ;
              }
        }

The gridded merge sort application is complete. All that is required now is the driver. The driver contains
the main method. It starts the grid, and tells the grid what to execute. Here is the code for my driver.
import java.util.Random;

import org.gridgain.grid.Grid;
import org.gridgain.grid.GridException;
import org.gridgain.grid.GridFactory;


public class MergeSortExample{

         /**
          * @param args
          */
         public static void main(String[] args) throws GridException{
               GridFactory.start();//starts the grid

               try {
                       Grid grid = GridFactory.getGrid();//creates an instance of
a grid
                     int[] test = new int[1000];
                   Random jon = new Random();

                         for (int i=0; i<1000; i++)
                         {
                               test[i] = jon.nextInt(1000);
                         }

                         for (int i = 0; i<test.length; i++)
                               System.out.print(test[i] + " ");


                          test =(int[])grid.execute(MergeSort.class.getName(),
test).get();

                         System.out.println("The gridded sort result is ...");
                         for (int i = 0; i<test.length; i++)
                         {
                               System.out.print(test[i] + " ");
                         }

                         System.out.println("");

               }

               finally {
                     GridFactory.stop(true);//stops the grid
               }

         }

}
5.0 Results of Experiment

To test the setup, I run three GridGain nodes on the host computer. One node run from the
Eclipse IDE and the others were standalone nodes. I also run three additional nodes on a
Windows machine. I did this to see if GridGain could really distribute across different operating
systems. Below are screen shots of the nodes from both machines. The first screenshot is from
the host machine.




The top two visible windows are the standalone GridGain nodes. The window at the bottom is
the node from Eclipse IDE and it displays part of the results of the final sorted array

The next screenshot shows the nodes run on the Windows box.
The three GridGain nodes and the results of their computation can be seen here.


6.0 Conclusion
We were able to achieve the goals we set for ourselves for the experiment. We installed
GridGain and successfully run an application on it. GridGain provides a great API for quick
development of gridded applications. Anyone who can program in Java can quickly catch on to
the GridGain API and be writing applications in no time. As demonstrated by the experiment, the
underlying architecture of the remote nodes does not matter to GridGain. It can distribute jobs to
remote computers that run different operating systems and have different hardware
implementations. This is one of the big advantages of grid computing, and GridGain implements
it very well.

Weitere Àhnliche Inhalte

Was ist angesagt?

Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Paul King
 
Jdbc oracle
Jdbc oracleJdbc oracle
Jdbc oracleyazidds2
 
XSpect, a lightweight library to make your code reusable and maintainable.
XSpect, a lightweight library to make your code reusable and maintainable.XSpect, a lightweight library to make your code reusable and maintainable.
XSpect, a lightweight library to make your code reusable and maintainable.ćČĄè«­ 李
 
concurrency gpars
concurrency gparsconcurrency gpars
concurrency gparsPaul King
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL fileRACHIT_GUPTA
 
Mathemetics module
Mathemetics moduleMathemetics module
Mathemetics modulemanikanta361
 
The Ring programming language version 1.2 book - Part 78 of 84
The Ring programming language version 1.2 book - Part 78 of 84The Ring programming language version 1.2 book - Part 78 of 84
The Ring programming language version 1.2 book - Part 78 of 84Mahmoud Samir Fayed
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest MatchersShai Yallin
 
ë§êł 100 볮드로 ë†€ì•„ëłŽìž 19
ë§êł 100 볮드로 ë†€ì•„ëłŽìž 19ë§êł 100 볮드로 ë†€ì•„ëłŽìž 19
ë§êł 100 볮드로 ë†€ì•„ëłŽìž 19ìą…ìž 전
 
Leveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyLeveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyDavid GĂłmez GarcĂ­a
 
Uncommon Design Patterns
Uncommon Design PatternsUncommon Design Patterns
Uncommon Design PatternsStefano Fago
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java ConcurrencyCarol McDonald
 
Autoboxing and unboxing
Autoboxing and unboxingAutoboxing and unboxing
Autoboxing and unboxingGeetha Manohar
 
Task and Data Parallelism
Task and Data ParallelismTask and Data Parallelism
Task and Data ParallelismSasha Goldshtein
 
Java concurrency
Java concurrencyJava concurrency
Java concurrencyHithem Ahmed
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartGabriele Lana
 
Saving lives with rx java
Saving lives with rx javaSaving lives with rx java
Saving lives with rx javaShahar Barsheshet
 
Finagle and Java Service Framework at Pinterest
Finagle and Java Service Framework at PinterestFinagle and Java Service Framework at Pinterest
Finagle and Java Service Framework at PinterestPavan Chitumalla
 

Was ist angesagt? (20)

Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
 
Jdbc oracle
Jdbc oracleJdbc oracle
Jdbc oracle
 
XSpect, a lightweight library to make your code reusable and maintainable.
XSpect, a lightweight library to make your code reusable and maintainable.XSpect, a lightweight library to make your code reusable and maintainable.
XSpect, a lightweight library to make your code reusable and maintainable.
 
concurrency gpars
concurrency gparsconcurrency gpars
concurrency gpars
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL file
 
Mathemetics module
Mathemetics moduleMathemetics module
Mathemetics module
 
The Ring programming language version 1.2 book - Part 78 of 84
The Ring programming language version 1.2 book - Part 78 of 84The Ring programming language version 1.2 book - Part 78 of 84
The Ring programming language version 1.2 book - Part 78 of 84
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest Matchers
 
ë§êł 100 볮드로 ë†€ì•„ëłŽìž 19
ë§êł 100 볮드로 ë†€ì•„ëłŽìž 19ë§êł 100 볮드로 ë†€ì•„ëłŽìž 19
ë§êł 100 볮드로 ë†€ì•„ëłŽìž 19
 
Leveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyLeveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results Asynchrhonously
 
Autoboxing And Unboxing In Java
Autoboxing And Unboxing In JavaAutoboxing And Unboxing In Java
Autoboxing And Unboxing In Java
 
Uncommon Design Patterns
Uncommon Design PatternsUncommon Design Patterns
Uncommon Design Patterns
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
 
Autoboxing and unboxing
Autoboxing and unboxingAutoboxing and unboxing
Autoboxing and unboxing
 
Workflows ss
Workflows ssWorkflows ss
Workflows ss
 
Task and Data Parallelism
Task and Data ParallelismTask and Data Parallelism
Task and Data Parallelism
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
 
Saving lives with rx java
Saving lives with rx javaSaving lives with rx java
Saving lives with rx java
 
Finagle and Java Service Framework at Pinterest
Finagle and Java Service Framework at PinterestFinagle and Java Service Framework at Pinterest
Finagle and Java Service Framework at Pinterest
 

Ähnlich wie Grid gain paper

Flink Batch Processing and Iterations
Flink Batch Processing and IterationsFlink Batch Processing and Iterations
Flink Batch Processing and IterationsSameer Wadkar
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
 
Gephi Toolkit Tutorial
Gephi Toolkit TutorialGephi Toolkit Tutorial
Gephi Toolkit TutorialGephi Consortium
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdf
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdfPart 1 - Written AnswersDownload the GridWriter.zip file and exami.pdf
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdfkamdinrossihoungma74
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIjagriti srivastava
 
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdfGetting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdfinfo309708
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyJAXLondon_Conference
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSTechWell
 
Forgive me for i have allocated
Forgive me for i have allocatedForgive me for i have allocated
Forgive me for i have allocatedTomasz Kowalczewski
 
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMEREVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMERAndrey Karpov
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorialFALLEE31188
 
6_Array.pptx
6_Array.pptx6_Array.pptx
6_Array.pptxshafat6712
 
Thread
ThreadThread
Threadphanleson
 

Ähnlich wie Grid gain paper (20)

Flink Batch Processing and Iterations
Flink Batch Processing and IterationsFlink Batch Processing and Iterations
Flink Batch Processing and Iterations
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
J2SE 5
J2SE 5J2SE 5
J2SE 5
 
Unit 3
Unit 3 Unit 3
Unit 3
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
Gephi Toolkit Tutorial
Gephi Toolkit TutorialGephi Toolkit Tutorial
Gephi Toolkit Tutorial
 
Celery with python
Celery with pythonCelery with python
Celery with python
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdf
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdfPart 1 - Written AnswersDownload the GridWriter.zip file and exami.pdf
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdf
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
 
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdfGetting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter Lawrey
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOS
 
Forgive me for i have allocated
Forgive me for i have allocatedForgive me for i have allocated
Forgive me for i have allocated
 
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMEREVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
EVERYTHING ABOUT STATIC CODE ANALYSIS FOR A JAVA PROGRAMMER
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
6_Array.pptx
6_Array.pptx6_Array.pptx
6_Array.pptx
 
java-programming.pdf
java-programming.pdfjava-programming.pdf
java-programming.pdf
 
Thread
ThreadThread
Thread
 

KĂŒrzlich hochgeladen

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

KĂŒrzlich hochgeladen (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Grid gain paper

  • 1. Installing and Running GridGain-1.5.1 1.0 GridGain Definition GridGain is a grid computing platform for Java. It is developed in Java for Java developers and is a natural extension of the latest Java development methodologies. 2.0 Description of Experiment and Defining Requirements The goal of the experiment is to setup GridGain and run a gridded application on the platform. Hardware Architecture: Dell Dimension 8200 Software Configuration: Processor – Intel Pentium 4 1.8GHz RAM – 512mb Operating System – Fedora Core 6 Installed Software: 1) GridGain – 1.5.1 – obtained free from http://www.gridgain.com 2) Java 1.6 – obtained free from http://java.sun.com/javase/6/ 3) Eclipse – obtained free from http://www.eclipse.org 3 Setting up software and hardware This section details how we set up Java 1.6, Eclipse, and GridGain 3.1 Setting up Java 1.6 Installation of Java 1.6 was straightforward. After obtaining the installation (bin) files, we ran the program and Java was installed However, this new installation did not replace the java file in /usr/bin, which is the default command run whenever the java command is issued. Thus, the system continued to use the old java installation. We created a symbolic link in the /usr/bin folder called java that pointed to the location of the newly installed java file. The syntax is sudo ln –s <location of new java file> java. This operation would fail if there already is a file called java in /usr/bin. It is wise to rename the current java file before creating the link. The syntax to rename the file would be
  • 2. mv java <new name for java file>. The version of Java installation can be checked by running the command java –version. 3.2 Setting up GridGain 1.5 We encountered one problem when we tried to install GridGain. GridGain requires that a JAVA_HOME environment variable be set. This environment variable points to the location of the java installation that GridGain would use. This Java installation has to be version 1.5 or later. To set this environment variable, we added the line export JAVA_HOME=<location of java installation> to the /etc/profile file. After the variable was set, the GridGain installation run smoothly. Running a node of GridGain presented us with new problems. GridGain requires that a GRIDGAIN_HOME environment variable be set. This environment variable points to the installation folder of GridGain. The environment variable is set in the same way as the JAVA_HOME environment variable. The line export GRIDGAI _HOME=<location of GridGain installation> is added to /etc/profile file. In order to give GridGain access to other computers on the network, multicast should be enabled on the local computer. However, multicast is turned off by default. To turn it on, we run the command route –add –net 224.0.0.0 netmask 240.0.0.0 dev eth0 This however did not fully solve the problem. The local firewall was blocking GridGain’s attempts to contact other computers. To turn the firewall off, we run the command sudo /sbin/service iptables stop After these steps, the node started up. 3.3 Setting up Eclipse Eclipse runs without a problem after downloading and extracting it. It should be noted that Eclipse 3 requires Java 1.6. 4.0 Experiment Setup and Code We decided to implement a gridded merge sort application. The merge sort algorithm splits the input to sort the items. This makes it an easy algorithm to distribute over several nodes. 4.1 How Merge Sort works The algorithm recursively splits the input array into smaller arrays until each array has a size of one. It then puts the array back together, sorting the items before putting them in the array. How the Gridded Merge Sort works. It recursively splits the input array until the constituent arrays are below a specified size. The arrays are then sent to remote nodes for execution. Each
  • 3. node runs the merge sort algorithm and returns a sorted version of the array it received. These sorted arrays are then merged to form the whole sorted array. 4.2 Programming in GridGain The documentation and API for GridGain can be found at http://www.gridgain.com/javadoc/org/gridgain/grid/package-summary.html. 4.3 Experiment Setup I used a modified form of the merge sort algorithm implementation found on the site 
 To set up the experiment, we first started up the Eclipse IDE. We created a new Java project. After this, we added the GridGain libraries to the build path of the project. 4.4 Code The merge sort class extends the GridTaskSplitAdapter class. The GridTaskSplitAdapter adapter can be used when jobs can be randomly assigned to available grid nodes. This adapter is sufficient in most homogenous environments where all nodes are equally suitable for executing grid job. Therefore, this is perfect for our needs. The code that does the sorting is readily available on the internet and is omitted from this report. The abstract method split() must controls how the task is split up into jobs. This implementation of the split method recursively splits the array until it reaches a specified size. public Collection<? extends GridJob> split(int gridSize, int[] A) throws GridException { List<GridJob> jobs = new ArrayList<GridJob>(array.size()); if (A.length<=10)//add array to list of jobs if it meets the size requirement { jobnum++; array.add(A); System.out.println("Job "+ jobnum + (" added")); } else //recursively split arrays if size is greater than 10 { int mid = A.length/2; int k = mid; int[] B = new int[mid]; int[] C = new int[(A.length-mid)]; for (int i = 0; i<mid; i++)
  • 4. { B[i]=A[i]; } for (int i = 0; i<(A.length-mid); i++) { C[i]=A[k]; k++; } split(gridSize, B);//recursively split arrays split(gridSize, C); //recursively split arrays } //assign each task to a job for (final int [] arra : array) { jobs.add(new GridJobAdapter<int[]>(arra)//create jobs from items in the job list { public Serializable execute()//code for each job to execute { System.out.println("Sorting... Be patient"); MergeSort.sort(arra); nodecount++; System.out.println("Node "+ nodecount + " results ..."); for (int i = 0; i<arra.length; i++) System.out.println(arra[i]+ " "); System.out.println(""); return arra; } }); } return jobs; } When the task is split, each individual task is assigned to a job (GridJobAdapter). Each job executes the code found in the execute method of the GridJobAdapter. This implementation of the execute method calls the sort method of the class. When the job is complete, the results are put in a collection and returned. The reduce method aggregates the job results received from the split method. This implementation of the split method merges the sorted arrays into one sorted array. It uses a helper method called collapse.
  • 5. public Serializable reduce(List<GridJobResult> results) throws GridException //aggregates results from grids { int[] sorted = new int[5]; Vector<int[]> store = new Vector<int[]>(); for (GridJobResult res : results)//get data from successful grid jobs { store.add((int[]) res.getData()); } while (store.size()>2)//merge individual arrays received from grids collapse(store); if (store.size()<= 2) { if (store.size()==2) { sorted = new int[(store.elementAt(0).length+store.elementAt(1).length)]; merge(store.elementAt(0), store.elementAt(1), sorted); } if (store.size()==1) { sorted = new int[store.elementAt(0).length]; sorted = store.elementAt(0); } } return sorted; } } private void collapse(Vector<int[]> store) { int size = store.size(); if (size==2) return; else { int[] temp = new int[(store.lastElement().length+store.elementAt(size-2).length)]; merge(store.lastElement(), store.elementAt(size-2), temp); store.add(size-2, temp); store.setSize(size-1); return ; } } The gridded merge sort application is complete. All that is required now is the driver. The driver contains the main method. It starts the grid, and tells the grid what to execute. Here is the code for my driver.
  • 6. import java.util.Random; import org.gridgain.grid.Grid; import org.gridgain.grid.GridException; import org.gridgain.grid.GridFactory; public class MergeSortExample{ /** * @param args */ public static void main(String[] args) throws GridException{ GridFactory.start();//starts the grid try { Grid grid = GridFactory.getGrid();//creates an instance of a grid int[] test = new int[1000]; Random jon = new Random(); for (int i=0; i<1000; i++) { test[i] = jon.nextInt(1000); } for (int i = 0; i<test.length; i++) System.out.print(test[i] + " "); test =(int[])grid.execute(MergeSort.class.getName(), test).get(); System.out.println("The gridded sort result is ..."); for (int i = 0; i<test.length; i++) { System.out.print(test[i] + " "); } System.out.println(""); } finally { GridFactory.stop(true);//stops the grid } } }
  • 7. 5.0 Results of Experiment To test the setup, I run three GridGain nodes on the host computer. One node run from the Eclipse IDE and the others were standalone nodes. I also run three additional nodes on a Windows machine. I did this to see if GridGain could really distribute across different operating systems. Below are screen shots of the nodes from both machines. The first screenshot is from the host machine. The top two visible windows are the standalone GridGain nodes. The window at the bottom is the node from Eclipse IDE and it displays part of the results of the final sorted array The next screenshot shows the nodes run on the Windows box.
  • 8. The three GridGain nodes and the results of their computation can be seen here. 6.0 Conclusion We were able to achieve the goals we set for ourselves for the experiment. We installed GridGain and successfully run an application on it. GridGain provides a great API for quick development of gridded applications. Anyone who can program in Java can quickly catch on to the GridGain API and be writing applications in no time. As demonstrated by the experiment, the underlying architecture of the remote nodes does not matter to GridGain. It can distribute jobs to remote computers that run different operating systems and have different hardware implementations. This is one of the big advantages of grid computing, and GridGain implements it very well.