all. This means that every reducer node tries to find
leaf reducer and if none is fount, tree development
terminates. Number of mapper nodes per reducer is
set by system developer, as well as number of su-
pervisors required per reducer. One supervisor may
supervise numerous reducers and take on mapper or
reducer roles at the same time depending on self eval-
uation results.
Job execution terminates when all mapper nodes
pass their results to corresponding reducers and all re-
ducers in a hierarchy pass processed results up to the
level of the broker node.
It is also remarkable that the broker agent does not
have any mapper nodes, but every reducer node does.
Supervisors monitor reducer nodes and reducers carry
out supervision role for their mapper nodes.
On the node level there are three main com-
ponents: broker agent, performer agent and com-
piler/interpreter.
When node receives a broadcast message, it is
handled by the performer agent. Performer agent
evaluates nodes current state and makes a decision
whether to form an offer message or to do nothing. If
an offer is issued to the requesting node, performer is
responsible for handling upcoming operations. That
is finding supervisors, passing executable code to the
interpreter/compiler, retrieving execution results and
sending them to the destination.
Broker agent is created by interpreter/compiler
when user wants to launch a computing task. It
is responsible for broadcasting information mes-
sages, finding itself supervisor and reducer nodes and
handling organizational communication at execution
time.
Figure 3 presents class diagram, which visualizes
nodes structure, system roles and their relationship to
the user interface.
Figure 3: UML Class Diagram describing nodes composite
structure, their roles and relationship with user interface.
More details on agent decision making are ex-
plained in Section 3.
2.2 Implementation
We implemented system prototype using JADE (Bel-
lifemine et al., 2007) due to cross platform prop-
erties and well established development tools of
Java. Moreover, availability of standard Jade behav-
iors allowed convenient grouping of individual op-
erations using ParallelBehaviour and SequentialBe-
haviour classes, supplied in JADE-4.2.0 distribution.
Executable code (written in Lisp) is encapsulated
into ACLMessage object and passed between agents.
Code is executed on Java Virtual Machine using
Clojure-1.4 (PC and server machines) and JSceme-
7.2 (mobile devices). It is important that standard
JSceme libraries had to be modified in order to work
with floating point numbers and files on mobile de-
vices. Apart from that software was used as supplied
in standard distribution.
Agent initialization includes publishing two ad-
vertisements: first, supervision services, second,
MapReduce services. As noted before there is no pre-
defined mapper or reducer role, because it depends on
self-evaluation at execution time.
Supervisor does not copy reducer state directly,
but knows about changes by listening to duplicated
messages, sent to the reducer. In other words it up-
dates state record when receives mapper and leaf re-
ducer message duplicates.
In order to describe job submission and failure
recovery mechanisms we take example scenario that
corresponds to the algorithm described in Figure 1:
1. All agents register their supervision and execution
services using DFAgentDescription class;
2. When job arrives broker agent breaks it down into
map and reduce operations and launches initiate-
Execution behavior, which is an extention of the
Jade Behaviour;
3. When perspective performer receives offer it de-
cides to execute the reduce task or not. If deci-
sion is positive, agent instantiates SequentialBe-
haviour object with unique CoversationId;
4. Broker tracks best offer among received within
specified timeout and sends confirmation;
5. Perspective performer becomes reducer node
and searches for supervisors by broadcasting
ACLMessage.INFORM. When answers are re-
ceived first three answer owners become super-
visors and their addresses are put into offerMes-
sage. Then offerMessage is broadcasted to new
potential performers;
6. Supervisors monitor their reduce node. If a call
timeout is reached, supervisor tries to re-launch
Peer-to-PeerMapReducePlatform
567