Home > Candidate Patterns > Deferred Controller

Deferred Controller

img

How can service composition logic be dynamically reallocated to improve service composition performance?

Problem

A common requirement for a service acting as a composition controller is that it defer the state of the service composition until it has collected enough responses to return its own response to the composition initiator. In some service composition designs (or in some runtime instances of service compositions), this can result in significant performance overhead.

Solution

When required, the composition controller logic is moved to the service consumer acting as the composition initiator.

Application

The service composition logic can be expressed in a composition definition that can be dynamically downloaded and transferred to composition initiator, effectively making this service consumer also the composition controller.

The composition definition can be retrieved by invoking a special service capability provided by the composition controller. The service consumer acting as the composition initiator and composition controller then invokes other composition members. If a given composition member also acts as a composition sub-controller, that service can also be designed to provide its composition logic to the service consumer via a separate composition definition.

Impacts

The effectiveness of caching composition-related state data is improved by the finer granularity of information transferred to the service consumer.

Now that the service consumer assumes both composition initiator and composition controller logic, it becomes more complex and, because it is an application not subjected to service-orientation design principles, it may also be less reliable.

Composition definitions may be inflexible if defined solely in terms of flat data. Flexibility can be improved by combining this pattern with Code-On-Demand [SDP].



Architecture

Inventory, Composition, Service

Status

Under Review

Contributors

Raj Balasubramanian, Benjamin Carlyle, Cesare Pautasso
img

Service compositions can be designed to have a dedicated service that acts as the composition controller. The service consumer invokes a capability on this service, which in turn invokes a series of capabilities on other services acting as composition members, before returning a response back to the service consumer

img

With the Deferred Controller pattern the composition initiator loads the retrieved composition definition that instructs it on how to interact with composition member capabilities.