Parallel Computing Using Java Mobile Agents
Parallel Computing Using Java Mobile Agents
3.1 The Mobile Parallel Processing Framework Figure 3: The hierarchy of the TaskHandler library
To realize our approach, a number of processes are The workstation-host: it must be a Java enabled
defined to complement the existing agent execution computer (has installed the Java runtime environment)
environment (i.e., the aglets). In particular the existing that runs the Tahiti Aglet server, in order to host
aglets need to be extended with parallel processing incoming Parallel-aglets.
capabilities. In addition a library of task specific objects, Both, the Parallel-aglet and the TaskHandler,
called TaskHandlers, are implemented to realize the compose the suggested framework, called “The Mobile
computation portion of the application. Specifically the Parallel Processing Framework”, and it is completely
following components comprise the proposed written in Java. Table 1 summarizes this agent-based
framework: parallel-processing infrastructure which is composed of
Parallel-aglet: it must be a computational unit, able (a) the Aglets Framework, and (b) our proposed Mobile
of creating and launching other Parallel-aglets. It is a Parallel Processing Framework.
descendant of IBM’s Aglet object. The coordination
between the various parallel aglets is an additional Table 1: The Mobile parallel-processing infrastructure.
responsibility. It must be able to create TaskHandler The Aglet The Mobile Parallel
objects from the TaskHandler library that travel along
Framework Processing Framework agents. This assignment is achieved with the following
A Tahiti aglet server The Parallel-aglet steps:
at each Workstation-host The TaskHandler i. The parallel aglet is created
library ii. If necessary creates and fires other parallel aglets
iii. The parallel aglet dispatches itself to the
3.2 Enhancing the Framework to Utilize the Web appropriate host.
iv. It creates a TaskHandler object and initiates it in
One of the biggest improvements of our suggested new separate thread
framework is its capability to be initiated from within a v. The TaskHandler perform its task in concurrently
Web page, making it accessible to the public through the
with the parallel aglet.
Web. The key for that is the ability of the Parallel-aglet
to be initiated within a Java enabled browser that has the vi. The parallel aglet requests from the TaskHandler to
FijiApplet plug-in. perform a specific task. While waiting the first
To achieve that, we expand our proposed framework TaskHandler to performed its tasks more
as follows (table 2): TaskHandler objects can be launched to
• We create a descendant of the FijiApplet abstract accomplish other tasks
class. We name this applet-based process ‘Parallel- vii. Finally the parallel-aglet collects, in coordination
applet’. This applet can create and communicate with a with the other parallel-aglets, the results and returns
Parallel-aglet (the web server must have the code of the them to the user. In other words the results are
Parallel-aglet). channeled through various aglets back to the leader
• By adding the aglet router and the aglet plug-in in aglet and then to the user.
the aglet framework. This class hierarchy is depicted in Figure 4 with the
• By adding a third framework, the Standard Web dashed lines we represent the dynamic assignment.
infrastructure.
The new Web-enabled Framework is consequently Figure 4: The class hierarchy of the various agents
called “The Web-Mobile Parallel Processing
Framework”.
Table 2: The new Mobile Web-based parallel-processing 3.4 Utilizing the Web-Mobile Parallel
infrastructure Framework
The Mobile
The Aglet The Standard Web Parallel The steps that a developer must follow in order to
Framework Web Processing create a parallel processing application, according to the
Infrastructure Framework Web-Mobile Parallel Processing Framework are the
A Tahiti aglet A Web The Parallel- following. Note that these steps only realize a specific
server at each Server applet parallel scenario. In section 6 we present and compare
Workstation-host various scenarios.
An aglet router A Java The Parallel- • Extend the Parallel-aglet class or implement our
installed at the powered Web aglet Parallel-aglet interface 2.
Web server Browser with • Program his own Parallel-applet either by extending
machine the aglet plug- our Parallel-applet class or writing a new one which
in. extends the IBM’s FijiApplet abstract class. (This applet
An aglet plug- The is used as the interface between the user and the Parallel-
in for Java- TaskHandler aglet).
enabled browsers library • Program the TaskHandler objects by extending our
to enable a Web TaskHandler abstract class (thus adding the necessary
browser to host objects in the TaskHandler library) or use an existing
aglets one from the current TaskHandler library.
• Include the Parallel-applet in an html page, and
3.3 Execution Roadmap install it on a Web server.
• Install the Parallel-aglet and the TaskHandlers on
As we have described above, the framework has a the Web server in order to be accessible to the Parallel-
great degree of generality and freedom. The static part of Applet.
our agent is responsible for the mobility, the general In order to setup the necessary infrastructure we must:
coordination, the creation and manipulation of other • Setup a number workstations-hosts by installing on
aglets and of course the dynamic assignment of
TaskHandlers, which compose the dynamic part of our 2
We give this option for reasons of compatibility and combination with
other frameworks that use IBM’s Aglets.
them the JVM and a Tahiti Server. 5.1 Implementation Roadmap
• Install the aglet router on the Web server.
• Install Java enabled Web browser that has the aglet The first step was to write the necessary
plug-in. TaskHandlers that our Parallel aglet will use:
To initiate the application, the user points his Web • DBMS_TaskHandler class, which has database
browser to the html page of the Web-Mobile Parallel capabilities, and the
Processing Framework. The leader (the first) Parallel- • Join_TaskHandler class, which joins the results of
aglet creates a number of other Parallel-aglets and two tables.
dispatches them to some hosts in the Web to work in This amounts to effectively writing two
parallel. The Parallel-aglets must first go through the Developer’s_TaskHandler classes. Then we extend our
aglet router that is installed on the Web server. parallel aglet to make him understand and handle the
messages that he might receive. Finally we did design a
4. Extending the Agent-based Parallel user interface of our application which was composed by
Frameworks an applet, descendant of Fiji applet, that serves as an
interface between the user and our parallel-aglet.
“Each mobile agent is a computation along The second step is to store the compiled code of the
with its own data and execution state” parallel aglet along with the necessary TaskHandlers and
the html page with the applet on host A (web server)
In the Java agent based technology, an agent can be The TaskHandler objects must be in the same file with
further viewed as an object that can be inherited, the parallel-aglets and serializable to travel with the
enhanced or refined just like any other object. The aglet.
Aglets can be viewed as the basic abstract object that The third step is to install on each host of the
provides us with the basic capabilities of mobility, distributed databases a Tahiti server in order to accept
communication, ability to cloning themselves, i.e., and host incoming aglets, and an SQL server (e.g.
implementing all the capabilities supported by the Aglets Microsoft Access). We also need to install on host A an
Framework. aglet router to route the mobile agents.
The parallel Frameworks enhance these capabilities The experiment can be initiated on any computer on
with the addition of parallel processing features. We the WWW that has Netscape Communicator 4.0 and
create a hierarchy that can be later on used to create above, with the Fiji plug-in. By pointing to the html
more complex and sophisticated applications. Figure 5 page of our prototype host A it downloads the applet that
shows the aglets hierarchy. will start our prototype. Through the applet’s graphical
interface, the user can issue a number of SQL sub-
Figure 5: The agents’ hierarchy queries. The user must also provide the IP addresses of
the machines that host the each distributed database to
To enhance the new aglets with other capabilities is be queried. As soon as the user issues the “execute”
now straightforward. For example, to extend the parallel command, the applet creates the parallel aglet (which
framework with database capabilities we only have to will be the leader) on host A and gives him vital
create a database TaskHandler [11], make it descendant information including:
of the TaskHandler class and extend the Parallel-aglet in • The number of hosts, and thus the number of
order to use the DBMS TaskHandler (which could be parallel aglets.
any of the Developer’s TaskHandler in Figure 5). Such a • The IP addresses of the remote hosts to be visited by
scenario is demonstrated in the section below. other parallel aglets (aglets he will create).
• The queries to be executed with the database server
on each host.
5. Prototype Implementation: Parallel Web • The names of the TaskHandlers objects that each
Querying aglet must create and use (including the ones for itself).
• The information that he is the leader.
As proof of concept for our methodology we have • His personal task (in other words, the IP address of a
setup a Mobile parallel-processing infrastructure network remote host that he’s supposed to visit along with the
and created Parallel Web Querying application. The appropriate query).
goal of this application was to provide the user the • Application specific information (e.g. database
capability of querying a number of distributed databases, username and password).
and join the result tables of each query. The application Immediately after that, while still on the web server
has been tested under various configurations on a (host A), the leader creates all the other necessary
number of distributed databases. parallel aglets (which are identical with him as far as
their capabilities are concerned) and then it dispatches
itself to the appropriate host. Each parallel aglet that is
created by the leader has the following information: iii) We have four parallel-aglets, each one
• The location of the leader and all other parallel visits and perform the queries at a different host, but the
aglets that the leader created. joining is done in a tree-reduction fashion.
• The names of the TaskHandlers that it must use.
• The information that he is NOT the leader. Figure 6: Performance of the various scenarios.
• His personal task (in other words, the IP address of a
remote host that he’s supposed to visit along with the Figure 6 shows the performance as implied by the
appropriate query). timing results of our prototype under the three scenarios
• Application specific information. outlined above. As it can be seen from the results the use
Each parallel aglet dispatches itself to the appropriate of multiple agents in parallel improves the performance
remote host. Arriving at the remote host, each parallel of the prototype. Improvement is achieved both in the
aglet initiates its main task. In this case it creates in a query phase and the join phase. The performance
new thread the DBMS_TaskHandler object. Please note improvement of scenario ii and scenario iii compared
that the initiation of the DBMS_TaskHandler and not of with scenario i is due to the fact that the queries are
some other TaskHandler is a decision which was taken performed in parallel. The improvement of scenario iii
dynamically (the aglet was instructed to do so – it was compared to scenario ii is due to the fact that the joining
not hardcoded to do so). The DBMS_TaskHandler is done in parallel in tree-reduction fashion. It is our
connects to the local SQL database server, performs its estimation that the speedups achieved are the maximum
query and gets the results. As soon as the results are possible according to the ahmdahls law.
available, the parallel aglet gets them (requests them)
from its DBMS_TaskHandler and then it terminates the 6. Advantages of using Mobile Agents for
TaskHandler’s thread. After that the parallel-aglets co-
operate to perform the join of the result tables. In order
Parallel Processing
to join two result tables, a parallel-aglet initiates the
A parallel processing application that is implemented
Join_TaskHandler, which does all the dirty work of the
accordingly to our suggested Web-Mobile Parallel
joining. When this is finished it sends the new results to
Processing Framework is boosted by the inherited
the applet.
benefits of using Java and Java mobile agents.
An important advantage is that the number of
5.2 Experimentation and analysis of results processes in a Mobile Web Parallel Processing
Framework can change dynamically. After initiating
We contacted experiments on a local network and the application with a number of aglets serving it, the
involved 4 hosts with distributed databases. We used leader parallel aglet can create, at run time, as many
medium size databases (about 50-Mb) which had some other parallel aglets as necessary. The workstations that
tables having more than half a million records. However will host the parallel aglets can be decided at run time,
the SQL was designed to limit the intermediate results. after considering the network traffic or the workload of
We perform experiments under three scenarios: the available workstations [12]. Parallel aglets can be
i) We have just one parallel-aglet (the leader) which reused as they can receive new instructions and then use
goes from host to host performs the queries and joins the new tasks i.e., initiate different TaskHandler objects
results at the end. according to the its instructions. Furthermore, the
ii) We have four parallel-aglets, each one visit and workstations that hosts worker processes are not required
perform the queries at a different host. The joining is to be part of the same local network in which the
done by the leader. workstation that hosts the leader parallel aglet belongs
to. A workstation-host can be located anywhere in the
entire Web.
By using Java, the Web-Mobile Parallel Processing
Prototype's Performance
Framework breaks the homogeneity barriers enabling
4,0 all kinds of workstations to be part of the framework.
3,5 The application based on this framework can be initiated
from within a Web page. Thus, unlike to other parallel
3,0 processing implementations, an application of the
2,5 Mobile Web Parallel Processing Framework can be
Speedup
ag
20
40
60
80
10
er
Av