Skip to content

Akka actor base clustering, parallel distributed execution

Notifications You must be signed in to change notification settings

asethia/akkacluster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is sample application for akka cluster balancing work across nodes

Design

Seed nodes are starting point for the cluster, and they serve as the first point of contact for Master, Worker and Job Worker nodes. Nodes join the cluster by sending a join message which contains the unique address of the node that joins. Atleast one seed node should be up and running, It is necessary that before a seed node goes down atleast other seed should be up and running. Seed nodes are configured in the application.conf resource file.

Processing Job in the cluster is consist of Seed Nodes, Master, Worker Master, and Job Workers. Master node control and supervise the completion of Job and It queues Jobs if workers are not available. Master node allocate work to Worker Master based on their availability. The Job workers request work from a Worker Master, process parts of the job, and return the Partial results to the Worker Master. The worker master reports the result to Master once all Job Worker finishes their allocated work. A job is repeated if any Worker Master or Job worker node fails during the process.

Prerequisite
  1. JRE 1.8.x
  2. Scala 2.11.5
  3. Apache Maven
Install

The application can be install using following command:

mvn install

This will create akkaclustersampleapp-1.0-jar-with-dependencies.jar in the traget directory.

Running

To run the cluster we need to run following command from the target folder in different console window:

  1. Mandatory - Start Seed Node#1 - java -classpath akkaclustersampleapp-1.0-jar-with-dependencies.jar com.akka.cluster.main.SeedMain 2551
  2. Optional - Start Seed Node#2 - java -classpath akkaclustersampleapp-1.0-jar-with-dependencies.jar com.akka.cluster.main.SeedMain 2552
  3. Mandatory - Start Master Node#1 - java -classpath akkaclustersampleapp-1.0-jar-with-dependencies.jar com.akka.cluster.main.MasterMain 3551
  4. Optional - Start Master Node#2 - java -classpath akkaclustersampleapp-1.0-jar-with-dependencies.jar com.akka.cluster.main.MasterMain 3552
  5. Mandatory - Start WorkerMaster Node#1 - java -classpath akkaclustersampleapp-1.0-jar-with-dependencies.jar com.akka.cluster.main.WorkerMasterMain 4551
  6. Optional - Start WorkerMaster Node#2 - java -classpath akkaclustersampleapp-1.0-jar-with-dependencies.jar com.akka.cluster.main.WorkerMasterMain 4552

After running above command, seed nodes, master and worker master are ready to start processing the job.

Submit Multiple Jobs to the Master1

The TestMain class is using ClusterClient to submit 3 jobs to Master1 (running on port 3551) Node. The following command can be used to start the Job Submission, the output can be seen on Master1 console window:

java -jar akkaclustersampleapp-1.0-jar-with-dependencies.jar com.akka.cluster.main.TestMain

About

Akka actor base clustering, parallel distributed execution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages