The Case For Reflective Middleware

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

The Case for Reflective Middleware

Building Middleware that is Flexible, Reconfigurable, and yet Simple to Use.

Fabio Kon Fabio Costa


Department of Computer Science Department of Computer Science
University of São Paulo Federal University of Goiás
kon@ime.usp.br fmc@inf.ufg.br
Gordon Blair Roy H. Campbell
Department of Computing Department of Computer Science
Lancaster University Univ. of Illinois at Urbana-Champaign
gordon@comp.lancs.ac.uk roy@cs.uiuc.edu

Recent advances in distributed, mobile, CORBA and Java also hide the differences
and ubiquitous systems are creating new among the underlying software and hardware
computing environments that are character- platforms, increasing portability and facili-
ized by a high degree of dynamism. Vari- tating maintenance as new versions of oper-
ations in resource availability, network con- ating systems are released.
nectivity, and hardware and software plat-
forms impact greatly the performance of user
applications. The expected growth of ubiq-
uitous computing will further change the
nature of the computational infrastructure,
bringing a plethora of small devices and re- While conventional middleware technol-
quiring customized protocols and policies in ogy aids the development of distributed ap-
order to fulfill the user’s evolving quality of plications for the new computing environ-
service requirements. ments, it does not provide appropriate sup-
port for dealing with the dynamic aspects of
In the past ten years, software develop- the new computational infrastructure. Next
ers witnessed the creation of various mid- generation applications require a middleware
dleware technologies whose goal is to fa- that can be adapted to changes in the envi-
cilitate the development of software sys- ronment and customized to fit into devices
tems. Middleware resides between the op- ranging from PDAs and sensors to power-
erating system and the application (thus ful desktops and multicomputers [1, 2]. This
its name), mediating the interactions be- article draws on the experience of two in-
tween them. Technologies such as OMG’s dependent research projects on next genera-
CORBA 3, Sun’s Java-based J2EE, and Mi- tion middleware. We argue that the reflec-
crosoft’s .NET hide from the programmer tive middleware model is a principled and ef-
the complicated details of network commu- ficient way to deal with highly dynamic en-
nication, remote method invocation, nam- vironments, supporting the development of
ing, and service instantiation, easing the flexible and adaptive systems and applica-
construction of complex distributed systems. tions.

1
Why Reflective Middleware? details of the underlying layers, but some
applications can get very significant perfor-
A major advantage of using middleware to mance improvements by examining the dy-
develop software is that it hides the details namic state of the underlying layers and tun-
of the underlying layers and operating sys- ing the middleware implementation to its
tem specific interfaces. Developers of dis- needs [2]. Therefore, what we need is a
tributed applications can write code that model of middleware that provides trans-
looks very similar to code for centralized ap- parency to the applications that want it and
plications; the middleware takes care of net- translucency and fine-grain control to the ap-
working, marshalling, method dispatching, plications that need it.
scheduling, etc. The code that runs on top
of the middleware is easily portable and the
programmer need not to worry about the in- The Reflective Middleware
ternals of the operating system and of the Model
middleware.
On the other hand, some applications In the reflective model, the middleware is
can benefit greatly from knowing what is implemented as a collection of components
happening inside the underlying layers, in that can be configured at application startup
the computational environment, and in the time. The middleware interface is unchanged
physical environment. For example, a multi- and can be used by applications developed
media streaming or videoconferencing appli- for traditional middleware. In addition, sys-
cation can obtain dramatic improvements in tem and application code may also use meta-
its quality of service by selecting a network interfaces to inspect the internal configura-
transport protocol that suits the underlying tion of the middleware and, if needed, re-
network infrastructure (e.g., wireless LAN, configure it to adapt to changes in the en-
wired LAN, or long distance Internet) and vironment. In that manner, it is possible
the available bandwidth. It may also benefit to select networking protocols, security poli-
from being aware of its physical context, de- cies, encoding algorithms, and various other
tecting the presence of a wall display and re- mechanisms to optimize system performance
configuring the application to show the video for different contexts and situations.
in the larger display. An e-commerce web In general terms, reflective middleware
site can improve its response time by ex- refers to the use of a causally connected
amining information about resource utiliza- self-representation to support the inspection
tion and changing dynamically the location and adaptation of the middleware system
of its system components, creating replicas [1]. Thus, the same reflection techniques
of its most requested services, or changing used in traditional areas, such as program-
the middleware’s request scheduling policies. ming languages, apply to middleware as well
A calendar application for ubiquitous com- (see Sidebars). By self-representation, we
puting can be more effective if its code can mean an explicit representation of the inter-
detect in what kind of hardware platform it nal structure of the middleware implementa-
is executing (e.g., PDA, wrist watch, desk- tion that is maintained and can be manipu-
top, or wall display) so that it can provide a lated by it; one can also say that the middle-
graphical interface that is optimized for that ware is self-aware. The self-representation
platform. is causally connected if changes in the rep-
In other words, most of the applications resentation lead to changes in the middle-
benefit from middleware that can hide the ware implementation itself and, conversely,

2
changes in the middleware implementation
lead to changes in the representation.
Unlike traditional middleware that is con-
structed as a monolithic black box, reflective
middleware is organized as a group of collab-
orating components. This organization per-
mits the configuration of very small middle-
ware engines that are able to interoperate
with traditional middleware. Conventional
middleware implementations include all the
functionality that any application may ever
need; however, most of the times, applica-
tions use only a small subset of this func-
tionality. The current difficulties in deploy-
ing standard middleware technologies to the
small devices used in ubiquitous computing Figure 1: dynamicTAO component configu-
do not apply to component-based middle- rators
ware. While conventional CORBA ORBs
and Java virtual machines require several sent the dependence relationships between
megabytes of memory, component-based re- ORB components and between ORB and ap-
flective ORBs can have a memory footprint plication components. A ComponentConfig-
as little as 6KB [3]. urator is a C++ object that stores the de-
In addition to the characteristics men- pendencies as lists of references, pointing to
tioned above, a reflective architecture must other component configurators, creating a
also provide support for customizing compo- directed dependence graph of ORB and ap-
nent behavior dynamically and for fine-grain plication components as shown in Figure 1.
resource management through system meta- Whenever a request for replacing a compo-
interfaces (see the Basic Reflection Termi- nent C arrives, the middleware examines the
nology Sidebar ). dynamic dependencies between C and other
middleware and application components us-
ing the ComponentConfigurator object asso-
Case Studies ciated with C. Programmers can extend the
We now describe two different implementa- ComponentConfigurator class by inheritance
tions of reflective middleware systems devel- to provide customized implementations deal-
oped at the University of Illinois and at Lan- ing with different kinds of components. Mid-
caster University and explain how each im- dleware developers use this feature to write
plementation addresses the issues discussed the code that takes the proper actions to
above. guarantee the consistency of the ORB inter-
nal structure in the presence of dynamic re-
configurations. DynamicTAO supports safe
dynamicTAO
dynamic reconfiguration of the middleware
DynamicTAO [4] is an extension of the C++ components that control concurrency, secu-
TAO ORB [5], enabling on-the-fly reconfig- rity, and monitoring.
uration of the ORB internal engine and of DynamicTAO exports a meta-interface for
applications running on top of it. In dy- loading and unloading modules into the sys-
namicTAO, ComponentConfigurator s repre- tem runtime, and for inspecting and chang-

3
ing the ORB configuration state. This meta- gine that dynamicTAO adds to the conven-
interface can be accessed by developers for tional TAO implementation make it a reflec-
debugging and testing purposes, by system tive ORB.
administrators for maintenance purposes, or
by other software components that can in- Open ORB
spect and reconfigure the internals of the
ORB based on information collected from The Open ORB project [9] aims at the
other sources, such as resource utilization design of highly configurable and dynami-
monitors [6]. In addition, to support the cally reconfigurable middleware platforms to
reconfiguration of a large collection of dis- support applications with dynamic require-
tributed ORBs, dynamicTAO exports a sim- ments, such as those involving distributed
ilar meta-interface for mobile agents. In this multimedia and mobility.
case, system administrators use a graphical Components with well-defined interfaces
interface to build mobile agents and inject implement the several elements of middle-
them in the network; the agents travel from ware functionality. Customized instances of
ORB to ORB, inspecting and reconfiguring the Open ORB platform can then be config-
them according to the instructions the ad- ured by assembling the appropriate compo-
ministrator programmed [4]. nents together, following a component model
To allow dynamic interposition of that allows for hierarchic composition and
application- or enterprise-specific code distribution. The Open ORB architecture
into the remote method invocation path, preserves components as identifiable entities
dynamicTAO provided support for intercep- at runtime, which in turn facilitates run-
tors since its first releases. More recently, time reconfiguration, as it eases identifica-
the OMG defined a standard for portable tion of the parts of the platform that need
interceptors [7], which is now part of TAO. to change.
Developers can install portable interceptors Dynamic reconfigurability is achieved with
at the client and server sides and at the the extensive use of reflection, with a clear
message or request levels. This facility separation between base- and meta-level.
can be used for supporting cryptography, While the base-level consists of components
compression, access control, monitoring, that implement the usual middleware ser-
auditing, etc. vices, the meta-level comprises reflective fa-
DynamicTAO delegates resource manage- cilities to expose such implementation, en-
ment to components that are not part of the abling inspection and adaptation. The struc-
basic middleware engine but that can be dy- ture of the meta-level follows the same com-
namically loaded into it. It employs the Dy- ponent model used to define the base-level,
namic Soft Real-Time Scheduler (DSRT) [8], which means that reflection can also be ap-
which runs as a user-level process in conven- plied to inspect and adapt the meta-level
tional operating systems like Solaris, Linux, itself. Meta-level components comprise a
and Windows. DSRT uses the system’s low- causally connected self-representation of the
level real-time API to provide QoS guaran- platform and are associated with the base-
tees to applications with soft real-time re- level components on an individual basis.
quirements. It performs QoS-aware admis- Each base-level component may have its own
sion control, resource negotiation, reserva- private set of meta-level components, which
tion, and real-time scheduling [6]. are collectively referred to as the compo-
The mechanisms for reification, inspection nent’s meta-space.
and reconfiguration of the ORB internal en- To tackle the complexity of the meta-level

4
architecture and to provide for manageable, agement [11]. The associated MOP allows
yet comprehensive reflective interfaces, the the inspection and reconfiguration of the re-
meta-space of a component is defined ac- sources, such as storage and processing, al-
cording to a multi-model reflection frame- located to particular activities in the sys-
work [10]. The meta-space is partitioned tem (e.g., by adding or removing resources,
into distinct meta-space models, which offer or changing the parameters and algorithms
different views of the platform implementa- for resource management). In this way, re-
tion and can be independently reified. Open source allocation and properties can evolve
ORB currently defines four meta-space mod- to match the quality of service requirements
els, which are grouped according to the dis- of applications.
tinction between structural and behavioral The Open ORB research group imple-
reflection, and are illustrated in Figure 2. mented prototypes of the architecture focus-
The Interfaces and Architecture meta- ing on performance, management of meta-
space models support structural reflection. information, and resource management [9].
The former model is concerned with the In each case, the researchers carried out tests
external representation of a component, in that demonstrated the suitability of the ar-
terms of the set of provided and required in- chitecture for the support of distributed mul-
terfaces. The associated meta-object proto- timedia applications.
col (MOP) offers facilities to enumerate and
search the elements of interface definitions,
allowing, for instance, the dynamic discov- Comparison
ery of the services a component provides.
The Architecture meta-space model in turn Open ORB and dynamicTAO were devel-
is concerned with the internal implementa- oped independently at different sides of
tion of components, in terms of its software the Atlantic by people with different back-
architecture. The self-representation consists grounds using different technologies. Never-
of two parts: a component graph, represent- theless, their motivations were the same and
ing the interconnections between the com- both projects led to similar solutions based
ponents in a component assembly, and a on reflective architectures.
set of architectural constraints, which define These projects illustrate two opposite ap-
the rules to validate component assemblies. proaches for the development of reflective
The associated MOP provides the ability to systems and, more specifically, reflective
inspect and adapt the software architecture middleware. The development of dynam-
(e.g., to add, remove or replace components, icTAO started with TAO, a complete im-
and to inspect and change the constraints), plementation of a CORBA ORB that was
enabling dynamic adaptation. modular but static. The dynamicTAO de-
The Interception meta-space model sup- velopers re-used tens of thousands of lines
ports behavioral reflection. The correspond- of code that were already functional and
ing MOP enables the manipulation of non- concentrated on adding reflective features to
functional properties, in the form of intercep- make the system more flexible, dynamic, and
tors that perform pre- and post-processing customizable. Conversely, the development
of the interactions emitted and received at of Open ORB started from scratch, its de-
an interface. In addition to this form of be- signers had the opportunity to plan its ar-
havioral reflection, the Resources meta-space chitecture from the earliest stages. There-
model offers structured access to the under- fore, while dynamicTAO focused on code re-
lying platform’s resources and resource man- use and on leveraging existing systems, Open

5
Figure 2: Structure of the meta-space in Open ORB

ORB focused on a novel middleware archi- openness. Finally, the use of reflection per-
tecture where all the elements are consistent mits the manipulation and adaptation of the
with the principles of reflection. different aspects of a platform in ways that
were not anticipated during its design.
We believe that it is now time for the mid-
Conclusions and dleware community to get together to dis-
Future Directions cuss the architecture of the next generation
middleware technologies. Reaching an inter-
In the past two years, existing implemen- national consensus in this area and working
tations of traditional middleware have been for the emergence of standards for reflective
incorporating some of the contributions of- middleware would be extremely beneficial.
fered by research in reflective middleware.
CORBA has now a standard for portable in-
terceptors [7]. Orbix2000 allows the spec- References
ification of different policies and supports
dynamic loading of new components called [1] Geoff Coulson. What is Reflec-
plug-ins [12]. Despite the usefulness of tive Middleware? IEEE Dis-
these features, the degree of support for cus- tributed Systems Online, 2(8), 2001.
tomization and dynamic adaptation is only http://computer.org/dsonline/
partial, not covering all aspects of the de- middleware/RMarticle1.htm.
sign and the different phases of a platform’s [2] Mark Astley, Daniel C. Sturman, and
life cycle. This is mostly due to the inher- Gul Agha. Customizable Middle-
ent black-box nature of these technologies, ware for Modular Distributed Software.
which limits the extent to which elements of Communications of the ACM, 44(5):99–
the design can be opened and exposed to the 107, May 2001.
programmer. Reflection, on the other hand,
offers a truly generic solution to the prob- [3] Manuel Román, Dennis Mickunas,
lem with a principled approach to middle- Fabio Kon, and Roy H. Campbell.
ware design that naturally renders itself to LegORB and Ubiquitous CORBA. In

6
Proceedings of the IFIP/ACM Middle- Clarke, Fábio Costa, Hector Duran-
ware’2000 Workshop on Reflective Mid- Limon, Tom Fitzpatrick, Lee Johnston,
dleware, pages 1–2, Palisades, NY, Rui Moreira, Nikos Parlavantzas, and
April 2000. Katia Saikoski. The Design and Imple-
mentation of Open ORB 2. IEEE Dis-
[4] Fabio Kon, Manuel Román, Ping tributed Systems Online, 2(6), 2001.
Liu, Jina Mao, Tomonori Yamane,
Luiz Claudio Magalhães, and Roy H. [10] Hidehaki Okamura, Y. Ishikawa, and
Campbell. Monitoring, Security, and Mario Tokoro. AL-1/D: A Distributed
Dynamic Configuration with the dy- Programming System with Multi-Model
namicTAO Reflective ORB. In Pro- Reflection Framework. In Proceed-
ceedings of the IFIP/ACM Interna- ings of the International Workshop
tional Conference on Distributed Sys- on New Models for Software Architec-
tems Platforms and Open Distributed ture (IMSA’92), pages 36–47, Tokyo,
Processing (Middleware’2000), number November 1992.
1795 in LNCS, pages 121–143, New
York, April 2000. Springer-Verlag.
[11] Hector Duran-Limon and Gordon S.
[5] Douglas C. Schmidt and Chris Cleeland. Blair. The Importance of Re-
Applying Patterns to Develop Extensi- source Management in Engineering Dis-
ble ORB Middleware. IEEE Communi- tributed Objects. In Proceedings of
cations Magazine Special Issue on De- the 2nd. International Workshop on En-
sign Patterns, 37(4):54–63, May 1999. gineering Distributed Objects, number
1999 in LNCS, pages 44–60, Davis, CA,
[6] Fabio Kon, Roy H. Campbell, M. Den- November 2000. Springer-Verlag.
nis Mickunas, Klara Nahrstedt, and
Francisco J. Ballesteros. 2K: A Dis- [12] IONA Technologies. Orbix 2000, 2000.
tributed Operating System for Dynamic White paper available at http://www.
Heterogeneous Environments. In Pro- iona.com.
ceedings of the 9th IEEE International
Symposium on High Performance Dis- Fabio Kon (kon@ime.usp.br) is an assistant
tributed Computing (HPDC’9), pages professor of Computer Science at the University
201–208, Pittsburgh, August 2000. of São Paulo, Brazil.
Fábio Costa (fmc@inf.ufg.br) is an assistant
[7] OMG. The object management group. professor of Computer Science at the University
Home page: http://www.omg.org, of Goiás, Brazil.
2002. Gordon Blair (gordon@comp.lancs.ac.uk) is
a professor of Computer Science at the Lancaster
[8] Klara Nahrstedt, Hao hua Chu, and University, UK.
Srinivas Narayan. QoS-aware Resource Roy H. Campbell (roy@cs.uiuc.edu) is a
Management for Distributed Multime- professor of Computer Science at the University
dia Applications. Journal of High-Speed of Illinois at Urbana-Champaign.
Networking, Special Issue on Multime-
dia Networking, 7:227–255, 1998. This work is supported by CNPq-Brazil proc.
680037/99-3, FAPESP-Brazil proc. 01/03861-0,
[9] Gordon S. Blair, Geoff Coulson, An- NSF-USA proc. 99-70139, and EPSRC-UK proc.
ders Andersen, Lynne Blair, Michael GR/M04242.

7
SIDEBAR1: Basic Reflection meta-objects support provides the re-
Terminology flective capabilities and is known as the
meta-object protocol (MOP).
The foundations of reflective computing sys-
tems were originally laid out by Smith [1] • structural reflection: the ability of
and Maes [2] in the context of programming a language (or system) to provide a
languages. In short, a system is reflective complete reification of the program cur-
when it is able to manipulate and reason rently executing, for instance, in terms
about itself in the same way as it does about of its methods and state. This enables
its application domain. As a result of such the programmer to inspect or change
introspective processing, a reflective system the functionality of the program and the
provides the ability to inspect and change way it models the domain.
itself during the course of its execution.
• behavioral reflection: the ability of a
From its original application in program-
language (or system) to provide a com-
ming languages, reflection gained wider ac-
plete representation of its own seman-
ceptance in other areas, such as operat-
tics, in terms of internal aspects of its
ing systems [3] and distributed systems [4].
runtime environment. This enables the
This was based on the assumption that the
programmer to inspect or change the
same underlying principles seamlessly apply
way the underlying environment pro-
to these areas. Such assumption has also fu-
cesses the program, for example, with
eled the work on reflective middleware, as
regard to non-functional properties and
seen in the main body of this article. We
resource management.
now describe a few fundamental concepts of
reflective systems.
References
• reification: the action of exposing the
internal representation of a system in [1] Brian Cantwell Smith. Reflection and Se-
terms of programming entities that can mantics in a Procedural Language. PhD
be manipulated at runtime. The oppo- thesis, MIT Laboratory of Computer Sci-
site process, absorption, consists in ef- ence, 1982.
fecting the changes made to reified en-
tities into the system, thus realizing the [2] Patie Maes. Concepts and Experiments
causal connection link. in Computational Reflection. In Proceed-
ings of the ACM Conference on Object-
• meta-level architectures: a reflec- Oriented Programming, Systems, Lan-
tive system has a meta-level architec- guages and Applications (OOPSLA’87),
ture when it is explicitly structured in pages 147–155, Orlando, FL, October
terms of a base-level, which deals with 1987.
application concerns, and a meta-level,
which deals with reflective computation. [3] Y. Yokote. The Apertos Reflective Oper-
ating System: The Concept and its Im-
• meta-object and meta-object pro- plementation. In Proceedings of the ACM
tocol (MOP): in object-oriented re- Conference on Object-Oriented Program-
flective systems, the entities that pop- ming, Systems, Languages and Appli-
ulate the meta-level are called meta- cations (OOPSLA’92), pages 414–434,
objects. The interaction protocol the Vancouver, October 1992.

8
[4] Jeff McAffer. Meta-Level Architecture adapt their structure and behavior.
Support for Distributed Objects. In Pro- Besides the object-oriented approach of
ceedings of Reflection’96, pages 39–62, most reflective middleware projects, re-
San Francisco, CA, 1996. searchers have considered the use of
the aspect-oriented programming (AOP)
paradigm to structure middleware meta-level
SIDEBAR2: Other Reflective architectures. AOP extends the basic notion
Middleware Implementations of separation of concerns in reflective sys-
tems (i.e., base- vs. meta-level) to a finer
A number of researchers have developed mid- level of granularity, where multiple crosscut-
dleware architectures that apply the con- ting concerns or aspects (at both base- and
cepts of reflection and meta-level architec- meta-level) can be implemented separately
tures. Some examples are discussed below. and yet be integrated into a cohesive sys-
FlexiNet is a configurable ORB architec- tem. In mainstream AOP research, aspects
ture aiming at environments of mobile Java are not preserved at runtime as identifiable
objects [1]. FlexiNet defines an open dis- entities, thus hindering their use for dynamic
tributed binding framework, structuring it in adaptation. Nevertheless, other approaches
terms of modules in a protocol stack. It sup- for the realization of aspect-oriented systems
ports adaptation through a meta-object pro- have employed mechanisms such as compo-
tocol that allows for reconfiguration of such sition filters [5] and fragmented components
modules to alter the properties of the bind- [6], which realize aspects in terms of first-
ing. class runtime entities. This opens the pos-
OpenCORBA is a reflective imple- sibility for aspect-oriented reflective middle-
mentation of CORBA in NeoClasstalk, a ware, in which the design of the meta-level
Smalltalk-like reflective language based on benefits from the greater separation of con-
the concept of meta-classes [2]. The re- cerns that is typical of the AOP paradigm.
flective features of OpenCORBA are based
on the idea of modifying the behavior of a
CORBA service by replacing the meta-class References
of the class defining that service.
[1] Richard Hayton. FlexiNet Open
Quarterware is a reflective middleware
ORB Framework. Technical Report
platform supporting multiple middleware
2047.01.00, APM Ltd., Cambridge, UK,
standards such as CORBA, Java RMI, and
October 1997.
MPI [3]. It uses a component framework for
middleware, where the various ORB mech- [2] Thomas Ledoux. OpenCORBA: A Re-
anisms are realized in terms of components. flective Open Broker. In Proceedings
A reflective interface allows the programmer of Reflection’99, number 1616 in LNCS,
to plug customized versions of these compo- pages 197–214, St. Malo, France, July
nents into the framework. 1999. Springer-Verlar.
mChaRM is a reflective middleware plat-
form that uses the communication reifica- [3] Ashish Singhai, Ahmond Sane, and
tion approach to enable explicit control over Roy H. Campbell. Quarterware for Mid-
multi-party communications [4]. The archi- dleware. In Proceedings of the 18th Inter-
tecture is centered on channels as the main national Conference on Distributed Com-
meta-level abstraction, which permits the in- puting Systems (ICDCS’98), pages 192–
terception of method calls to inspect and 201, Amsterdam, May 1998.

9
[4] Walter Cazzola and Mario Ancona.
mChaRM: A Reflective Middleware for
Communication-based Reflection. Tech-
nical Report DISI-TR-00-09, DISI, Uni-
versita degli Studi di Milano, Milan, May
2000.

[5] Lodewijk Bergmans and Mehmet Ak-


sit. Aspects and Crosscutting in Lay-
ered Middleware Systems. In Pro-
ceedings of the IFIP/ACM Middle-
ware’2000 Workshop on Reflective Mid-
dleware (RM’2000), New York, April
2000.

[6] Franz Hauck, U. Becker, M. Geier,


E. Meier, U. Rastofer, and M. Stecker-
meier. AspectIX - An Aspect-Oriented
and CORBA-compliant ORB Architec-
ture. Technical Report TR-I4-98-08,
IMMD IV, Univesity of Erlangen, Nurn-
berg, Germany, September 1998.

10

You might also like