Federated Tuple Space Host-Level Tuple Spaces Interface Tuple

LIME II
Reengineering a Mobile
Middleware
A New TupleWare..



Reengineering LIME – a middleware based on the
tuple space paradigm revisited according to
mobility
Goals of the reengineering process
 weaken the semantics of the model so that it
can deal with highly dynamic scenarios
 decouple the middleware from the underlying
application-level transport layer
Background: tuple space and LIME v.1
Challenges of Mobility

Problems





How can we manage the increase of complexity ?



the environment changes rapidly and continuously
clients connect to the network for short periods of time
disconnection is unannounced and unpredictable
...
use more sophisticated SW logics (↓ ad-hoc solution)
add a middleware layer (↑ S.E. solution)
Traditional RPC-based middleware is too limited
Mobile Middleware

A new area of research

none






Universally Interoperable Core
Coda, Bayou, Odyssey
coordination based



Nexus, Teleporting
data-sharing oriented


μCode, Aglets, Mole
context aware

Mobiware, L2imbo
reflection based
mobile code

LW-IOP, Mobile DCE, JMS
QoS oriented


.NET Compact Framework, J2ME
revised traditional


reconfigurable pub/sub
tuple spaces
Commercial success of tuple space based technology:
TSpaces (IBM) and JavaSpaces (Sun)
Tuple Spaces

Original model developed in the mid-80’s (Linda)

Space of tuples


astraction, a separate third-party form of distributed shared
memory that is accessed concurrently by processes that
insert, take or read tuples
Tuple




a “generic data structure”, a sequence of typed fields
a tuple field is either an actual or a formal
tuples that have formal fields are also called templates
simple matching rules
e.g. <String, Boolean, 2005> ≈ <“UIC”, true, 2005>
Primitives




out(tuple) inserts the tuple
out
into the tuple space
rd(template) reads a tuple
that matches the given template,
blocking
in(template) takes a tuple
that matches the given template,
blocking
Extensions



wait
non-blocking: rdp, inp
bulk: rdg, ing
Non deterministic matching
in
?
rdp
ing
copy
Pros and Cons

Temporal decoupling (↑)


Spatial decoupling (↑)



asynchronous communication: consumers and
producers can exist in ≠ periods of time
no bindings between servers and clients: requests
of tuples are implicitly routed
decentralized, fault-tolerant architecture
Global and persistent tuple space (↓)

unrealistic assumption for mobile scenarios
Linda In a Mobile Environment

Virtual spaces, name-based “transient sharing”
Agent
Host-Level
Tuple Spaces
Federated Tuple Space
Interface
Tuple Spaces
Constructs of LIME

Location-aware operations



Reactive programming



out: select the agent that has to hold the tuple
rd, in: select a projection of the tuple space
reaction = a code fragment that is executed when the
state of the space satisfies a given template
strong vs weak
They cope with physical and logical mobility
Engagement / Disengagement

space grows and shrinks transparently according to
the connectivity among the components


engagement – the sharing process, atomic
disengagement – the inverse process, atomic
engagement
disengage
Roles of Engagement

Engagement modifies only the accessibility of
tuples: each tuple exists in a single location

Engagement is used to




attach a new node to the system
move tuples whose destination is the new node
disseminate reactions regarding the new node
The engagement process delivers tuples and
reactions as soon as the target agent or host
joins the LIME community
Other Features


Applications can retrieve information
about the community of agents and
hosts by accessing a “system” tuple
space (LIME System Tuple Space)
Other components:


μCode – kernel for mobile agents
LighTS – tuple space engine and adapter
Limitations of LIME v.1

Engagement relies on distributed transactions



to complete the transaction, all hosts have to stay
connected for enough time
since transactions are atomic, they block all hosts
until completion
Disconnection must be announced


if unannounced disconnection occurs while tuples
are transmitted, they are lost
the system is not able to recover whenever a host
collapses during a transaction
My Work: LIME II
1. Reengineering the model
2. Reengineering the implementation
3. Improvements and optimizations
Changes to the Model
LIME
LIME II
mobile agents are supported
explicit upload of code is supported
tuple spaces can be bound to agents
tuple spaces are bound to hosts
group view is symmetrical
group view is asymmetrical
group join and reconciliation of tuples and
reactions occur during engagement
group join and reconciliation are asynchronous
access to the tuple space is globally atomic
the semantics for accessing the tuple space is
not globally atomic
unannounced disconnection is not supported
unannounced disconnection is supported and
policies for reconciliation are provided
Engagement Vs Reconciliation

Dis/Engagement



allows a host to join or leave the group
each host collects the beacons from the other units and updates
its (asymmetrical) view of the community
Reconciliation


allows to deliver misplaced tuples, register issued reactions and
remove triggered ones, resolve inconsistencies of the space
atomic / wrt a pair of hosts and a single tuple space
B
Best-Effort

Unannounced disconnection can occur while tuples are
being transferred to a host


clean-up phase of TCP/IP: the sender perceives failure and
cannot know whether the data was handed to the receiver
Multi-level approach

1. transport



re-send the message
declare the type of failure: critical, total, partial
2. application protocol


apply the recovery policy selected by the user for this space
 loss, duplicate, conservative
the conservative policy keeps track of the tuples whose delivery
we are uncertain of  reconciliation will be run (third level)
Architecture of LIME II

Decoupled with respect to the underlying application
level transport layer (reconfig pub/sub, DHT, etc..)
modules (3rd party)
applications
LIME II
communication adapter
Plain
Unicast
+
Multicast
Subject
based
Content
based
Pub/Sub
Pub/Sub
network
DHT
...
based
MW
A New Design

Decoupling requirement was imposed by VICOM


funded Italian research project that embraces LIME
Other goals



build a modular, flexible, scalable middleware
increase overall performance
solve non-trivial synchronization issues – that are due to
the weakened semantics of the model, such as



concurrent reconciliations
race conditions on accessing the tuple space
Radical reengineering



only a small fraction of the code has been reused ≈ 2%
substantial compatibility with the API of LIME v.1
underlying architecture is extremely different
Core of the Middleware

LimeTupleSpace


LocalOpMgr


wrapper for LighTS, cloning, naming
CommunicationMgr


support for strong reactions, atomicity
TupleSpaceProxy


astraction of a local reactive tuple space
Reactor


synchronization of agents, local operations
LimeTSMgr


main class, de/limification, operation descriptors
remote operations via a thread pool
CommunicationAdapter

adapter for the transport layer
Communication Adapter

You can employ any application-level transport layer for whom it is
provided a (third-party) adapter that implements the standard
interface ICommunicationAdapter







init()
shutdown()
joinSystem(info)
leaveSystem()
joinGroup(space)
leaveGroup(space)






sendOp(space, message)
sendOp(host, message)
sendReaction(space, message)
sendReaction(host, message)
sendReply(host, message)
getNextOp()



queryHost(host)
addHost(host)
remove(host)
Available communication adapters





LocalTestCA
LocalCA
PlainCA
MessageCA
FragProxyCA
pure UDP unicast, only for testing
UDP unicast + multicast (wired LAN, high performances)
TCP unicast + multicast (connection caching, keep alive)
decorator, shows flow of messages
enables de/fragmentation of messages
Remote Operations

Thread-to-thread messaging among thread pools of hosts



automatic dispatching of msgs according to headers
37 protocols implement all the operations


classified on the basis of type, space projection, snd/rcv side
instances of Runnable, assigned to the thread pool as “tasks”


kept apart from the infrastructure
a protocol needs to send and receive messages



local agent
or
remote request
to send messages, the thread invokes the methods of C-Adapter
to retrieve messages, the thread queries a non-shared buffer
a timeout mechanism avoids to wait forever on the buffer
CommunicationMgr
Protocols
ThreadPool
selectProtocol(...)
P
ù
P : RemOutg
assignTask(P)
Synchronization



A reaction is always executed atomically, even when its
code fragment installs other reactions
 strong → weak → strong → weak → ...
The methods of the core classes of the middleware are
re-entrant, i.e. they can be invoked also “within” the
bodies of reactions
Complex case: reconciliation



during a reconciliation between two hosts, the arrival of a
tuple can trigger a reaction that starts reconciliation with a
third host and, recursively, with a fourth, ...
the distributed transaction is splitted into parallel processes
of reconciliation – they can succed or not according to
timeouts, interleaving of threads, ...
if a reconciliation process fails, the system will retry it later
Further Improvements

Parallelized operations


Thread pool




an operation (outg, installWeak) dealing with
several hosts is splitted into independent tasks;
the tasks are assigned to the thread pool
anti-leakage, safely resizable on-the-fly
profiles the maximum number of busy threads
enables fine-tuning and load-balancing
Priority scheduler (QoS)

manages the internal flow of msgs, parametric
Also..

Fragmentation and defragmentation




transparent to applications
can be turned on/off for any communication adapter
allows to transfer extremely large objects (e.g. tuples
whose order of magnitude is MBytes or more)
Integrated diagnostic service



lightweight web server
generates dynamically a set of HTML pages that describe
the contents of the tuple spaces
the service is very useful for testing LIME applications:
you can inspect their behavior via a browser
Testing and SW Development

Agents



each agent performs a single operation, allowing to
select the projection of the tuple space
you can combine agents in order to re-create nearly
every possible testing scenario
LiM



an ICQ-clone instant messenger
the whole logic of the application
consists of 73 lines of code
advances features, e.g. off-line
delivery of msgs, cost zero
Conclusions

The model has been weakened


The middleware is modular, scalable, flexible




it copes with highly dynamic environments (MANETs)
performances are superior with respect to LIME v.1
part of the Italian Research Project VICOM
also used in TU Delft, Netherlands
Future work

implement other communication adapters


REDS, DHT, bridge communication adapters, ...
perform a quantitative analysis of performances