[24] REFERENCE COUNTING ARCHITECTURES
(Part of the CORBA FAQ, Copyright © 1996-99)


[24.1] WHAT IS A DISTRIBUTED REFERENCE COUNTING ARCHITECTURE?

Distributed reference counting is something typically performed either by a remote object, the factory for the remote object or possibly by the ORB itself. The key concept is that something is tracking the number of connections to a particular remote object. The counter is incremented when a new reference to the remote object is created. The counter is decremented when a reference to the remote object is destroyed. The idea is that by looking at the counter, one can determine if the remote object is still in use.

TopBottomPrevious sectionNext section ]


[24.2] WHY WOULD AN APPLICATION IMPLEMENT A DISTRIBUTED REFERENCE COUNTING ARCHITECTURE?

There are several reasons why reference counting might be important.

  1. Clean-up: An application might like to know that a remote object no longer has active references. The typical reason is that object that are no longer in use can be removed from memory. This allows resources associated with a remote object to be reclaimed. This is especially important if a distinct remote object exists for each client application.
  2. Reporting: In many cases it might be helpful to know the usage patterns for a particular remote object. Without reference counting, an object could only report the total number of method invocations performed. Information regarding the number of connected clients or average usage per client would only be available if a reference counting architecture was in place.
  3. Load Balancing: In some cases, a client might gain access to a remote object via an out-of-process factory. The goal of the factory might be to support clients via a pool of remote objects hosted on different machines. The factory can choose which remote object to return based on actual usage. Reference counting might be one mechanism for determining a remote object’s “load”.

TopBottomPrevious sectionNext section ]


[24.3] DOES CORBA SUPPORT DISTRIBUTED REFERENCE COUNTING ARCHITECTURES?

CORBA does not directly support distributed reference counting. This was a conscious decision on the part of its designers. While CORBA does not directly support reference counting, it is possible to build reference counting into a particular distributed object architecture. This can be done through an explicit session management facility which can be exposed through factories or other remote interfaces. While it is possible to design reference counting into an application, it is the burden of the application designer/developer to ensure that such an approach is implemented correctly.

TopBottomPrevious sectionNext section ]


[24.4] WHAT PROBLEMS MIGHT BE ASSOCIATED WITH A DISTRIBUTED REFERENCE COUNTING ARCHITECTURE?

The designers of the CORBA specification chose not to support distributed reference counting for several specific reasons.

  1. Error prone: Distributed reference counting relies upon the developer to properly increment and decrement the reference counting mechanism. Failure to do so can result in disappearing objects or orphaned objects that have no users.
  2. Performance problems: In some cases, clients terminate abnormally without properly releasing references. This results in reference counts not being decremented. In order to survive such situations without leaving remote object orphaned, objects must occasionally ping clients to determine if they are alive. This can result in excessive network traffic and cause performance problems.
  3. No support for persistent object references: CORBA allows object references to be stringified, stored, and objectified without losing their remote context. An object reference can be considered valid even if its connection terminates or if the remote object is destroyed. Supporting both persistent object references and reference counting is very difficult since counting stringified object references may not be possible.

Some distributed frameworks such as DCOM are built around a distributed reference counting architecture.

TopBottomPrevious sectionNext section ]


[24.5] IS THERE AN ALTERNATIVE TO DISTRIBUTED REFERENCE COUNTING ARCHITECTURES?

Yes: connection-less architectures.

With a connection-less architecture, an object does not “know” any thing about the object references which refer to it, including the number of references. This is the style found most often on the World Wide Web.

TopBottomPrevious sectionNext section ]


E-Mail E-mail us
CORBA FAQTable of ContentsExhaustiveAlphabeticalSubject indexAbout the authors©TMDownload your own copy ]
Revised May 27, 1999