96
L. Moreau and D. Ribbens / Mobile objects in Java
problem [25]. A forwarding endpoint is allowed to
be cleared if it can be proved that no other platform
will ever forward method calls to it. This may be im-
plemented using a distributed reference counting algo-
rithm [23,25]. In particular, RMI provides a method
Unreferenced for remote objects which is called
when there is no remote reference to this object [12].
When this method is called on an endpoint, it may be
unexported, and the reference to the next startpoint in
the chain may be lost. Note that this mechanism can
only work if tables of startpoints contain weak refer-
ences to these. Otherwise, if startpoints remain live,
the RMI-stubs they contain will also remain live, which
will prevent the call of the Unreferenced method
on the associated endpoints.
6. Benchmark
The scientific programming community has a tra-
dition of adopting benchmarks to evaluate the perfor-
mance of computers; for instance, the Linpack Bench-
mark is a numerically intensive test used to measure
floating point performance. Unfortunately, we lack
benchmarks specifically suited to evaluate routing al-
gorithms for mobile objects. This may be explained
by the relative novelty of the concept of mobile ob-
ject, and the inexistence of widely accepted applica-
tions for mobile agents. In a previous paper [23], we
observed that there was no recognised benchmark for
evaluating distributed garbage collectors; therefore, we
designed some synthetic benchmarks for such a type of
distributed algorithms. We propose to adopt a similar
approach here.
A synthetic benchmark is an abstraction of a real
program, where routing of messages may have an im-
pact on the performance of the computation. In our
benchmark, we measure the cost of invoking a method
on a mobile object that has changed location since the
last time the method was invoked on it. In the con-
text of the Magnitude architecture of Section 2, such a
benchmark is reminiscent of the communications one
may have with a mobile agent visiting several locations
to perform a task.
Figure 4 summarises the “Itinerary Benchmark”. An
Itinerary consists of N platforms P0, . . . , PN−1 to be
visited by a mobile object. A platform P, not part of
the itinerary, is used to initiate invocations of a method
m on the remote mobile object. Every method invoca-
tion takes as argument a list of J platform identifiers
that the mobile object has successively to migrate to; an
itinerary is completed when the mobile object returns
to the first platform P0. As method m is invoked on the
mobile object, it spawns a thread responsible for mi-
grating the mobile object to J platforms, while method
m terminates in parallel. On platform P, we measure
the time taken to perform all method calls necessary to
complete an itinerary.
Figure 5 illustrates the execution of the Itinerary
benchmark over 10 platforms (5 rather heavily loaded
workstations/servers each running 2 JVMs), connected
by a local area network. Each method call forced the
object to migrate to one new location. We ran the same
benchmark using both the call forwarding and the re-
ferrals techniques. We can see that in this specific in-
stance, referrals are on average 9% faster than call for-
warding, over 200 itineraries. We should observe the
abnormal duration of the first itinerary in Fig. 5: in-
5. Forwarding vs referrals
In our theoretical algorithm [22], messages are
routed individually; a reply would be regarded as a sep-
arate message to be routed independently. The view
that we have adopted for Mobile Objects in Java differs
slightly because it is based on the remote method invo-
cation paradigm: methods are invoked and are expected
to produce a result. In the previous section, we showed
that the result could be propagated backwards along the
chain of forwarding pointers left by the mobile object.
Long chains of remote method invocations offer too
little resilience to failures of intermediary nodes. In-
stead of forwarding a method call, an endpoint could
throw an exception indicating that the mobile object
has migrated. The exception could contain the new
startpoint pointing at the mobile object location.
The approach consisting of throwing an exception
containing a new startpoint, instead of forwarding a
call, is similar to the referral mechanism [9] used in
distributed search systems such as Whois++ [26] and
LDAP [28]. It then puts the onus on the method in-
voker to re-try the invocation with the next location of
the object; once the object has been reached, the result
may then be returned to the caller directly. In our im-
plementation, the startpoint is in charge of re-trying a
method invocation until it becomes successful. There-
fore, from the programmer’sviewpoint, there is no syn-
tactic difference between the two approaches. An op-
tion passed as argument to the stub compiler specifies
whether code has to be generated for referrals or for
call forwarding. In the rest of the paper, we compare
the performance of the two approaches.