Thursday, October 22, 2009

OSGi: The Value Proposition?

In a recent blog Hal Hildebrand argues OSGi's value proposition in terms of its ability to reduce long term 'complexity'. Hal argues that whilst it may be harder to start with OSGi as it initially appears more complex, for large applications and large teams it is ultimately simpler because the architecture is 'modular'. A diagram along the lines of the following is used to emphasis the point.


Complexity over time?


As an ex-Physicists, I'm naturally interested in concepts such as 'Complexity', 'Information' and 'Entropy'; and while I agree with Hal's sentiments, I feel uneasy when the 'complexity' word is used within such broad brush general arguments. Indeed; I find myself asking, in what way is a modular system 'simpler'? Surely a modular system exposes previously hidden internal structure, and while this is 'necessary complexity' (i.e information describing the dependencies in the composite system), the system is never-the-less visibly more complex!

For those interested, the following discussion between physicists at a Perimeter Institute seminar concerning 'information' is amusing, illuminating and demonstrates just how difficult such concepts can be.

Before attempting to phrase my response, I visited Kirk Knoernschild's blog - IMO one of the industries leading experts in modularisation - to see what he had to say on the subject.

Sure enough Kirk states the following:

"As we refactor a coarse-grained and heavyweight module to something finer-grained and lighter weight, we’re faced with a set of tradeoffs. In addition to increased reusability, our understanding of the system architecture increases! We have the ability to visualize subsytems and identify the impact of change at a higher level of abstraction beyond just classes. In the example, grouping all classes into a single module may isolate change to only a single module, but understanding the impact of change is more difficult. With modules, we not only can assess the impact of change among classes, but modules, as well."

Hence, Kirk would seem to agree. As one modularises an application, complexity increases in the form of exposed structural dependencies. Note that one must be careful not to confuse this 'necessary' complexity with accidental complexity; a subject of previous blog entries of mine - see Complexity Part I & Part II


OSGi - Preventing 'System Rot'?

Those who have worked in a large enterprise environment will know that systems tend to 'rot' over time. Contributing factors are many and varied but usually include:
  • Structural knowledge is lost as key developers and architects leave the organisation.
  • Documentation missing and / or inadequate.
  • The inability to effectively re-factor the system in response to changing business requirements.
The third issue is really a 'derivative' of the others: As application structure is poorly understood, accidental complexity is introduced over time as non-optimal changes are made.

Hence, rather than trying to frame OSGi's value proposition arguments in terms of 'complexity' - OSGi's value is perhaps more apparent when framed in terms of 'necessary information' required to manage and change systems over time?



Structural information loss over time for modular and non-modular System.


Unlike a traditional system, the structure of a modular System is always defined: The structural information exposed by a correctly modularised system being the necessary information (necessary complexity) required for the long term maintenance of that System.

In principle, at each point in time:
  • The components used within the System are known
  • The dependencies between these components are known
  • The impact of changing a component is understood
However, the value of this additional information is a function of the tooling available to the developer and the sophistication of the target runtime environment.


The Challenge: Simplifying while preserving Flexibility

Effectively dealing with both module and context dependencies is key to realizing OSGi's true value in the enterprise.

To quote Kirk yet again:

"Unfortunately, if modules become too lightweight and fine-grained we’re faced with the dilemma of an explosion in module and context dependencies. Modules depend on other modules and require extensive configuration to deal with context dependencies! Overall, as the number of dependencies increase, modules become more complex and difficult to use, leading us to the corollary we presented in Reuse: Is the Dream Dead:"

The issue of module dependency management is well understood. Development tooling initiatives are underway to ease module dependency management during the development process; an example of which being the SIGIL project recently donated by Paremus to the Apache Felix.

However, Kirk's comment with respect to 'context dependencies' remain mostly unheard.

From a run time perspective vendors and early adopters currently adopt one of the following two strategies:

  • Explicit management of all components: Dependency resolution is 'frozen in' at development time. All required bundles, or a list of required bundles, are deployed to each runtime node in the target runtime environment; i.e. operations are fully exposed to the structural dependencies / complexities of the application
  • Use of an opaque deployment artifact: Dependency resolution is again 'frozen in' at development time. Here the application is 'assembled' at development time and released as a static opaque blob into the production environment. Operations interact with this release artifact, much like today's legacy applications. While the dependencies are masked, as the unit of deployment is the whole application, this decreases flexibility, and if one considers the 'Re-use Release Equivalence Principle' partly negates OSGi's value proposition with respect to code re-use.
Both of these approaches fail with respect to Kirk's 'context dependencies'. As dependencies are 'frozen in' at development time there is no ability to manage 'context' dependencies at runtime. Should conditions in the runtime environment for whatever reason require a structural change; a complete manual re-release process must be triggered. With these approaches, operational day to day management will at best remain painful.

In contrast, leveraging our Nimble resolver technology Paremus pursue a different approach:

  • The runtime environment - a 'Service Fabric' - is model driven. Operations release and interact with a running Service via its model representation; this an SCA description of the System. Amongst other advantages, this shields the operations staff from unnecessary structural information.
  • The Service Fabric dynamically assembles each System resolving all modules AND context dependencies.
  • Resolution policies may be used to control various aspects of the dynamic resolution process for each System; this providing a higher level policy based hook into runtime dependency management.
  • The release artifacts are OSGi bundles and SCA System descriptions - conforming with the 're-use / release equivalence principle'.
  • The inter-relationship between all OSGi bundles and all Systems with the Service Fabric may be easily deduced.
The result is a run time which is extremely flexible, promotes code-reuse, whilst is significantly easier to manage than traditional environments. OSGi is an important element, but the use of a high level structural description used in conjunction with the model driven runtime are also essential elements of this story.


OSGi: The Value Proposition?

The short answer really is - "it depends on how you use it"!

Without a doubt, many will naively engage with OSGi, and will unwittingly increase operational management complexity beyond any benefits achieved by application modularization; see 'OSGi here, there and everywhere'. However, for those that implement solutions that maximize flexibility and code-reuse, while minimizing management, OSGi's value proposition is substantial; and the runtime used is a critical factor in realising these benefits.

How Substantial?

To date my only benchmark is provided by an informal analysis made by a group of architects at a tier 1 Investment Bank in 2008. They estimated the potential OPEX cost saving per production application, assuming that it were replaced with a Service Fabric equivalent; for the purpose of this blog one may equate Service Fabric to adaptive, distributed OSGi runtime.

Cost savings in terms of
  • application release efficiency.
  • ongoing change management,
  • fault diagnostics and resolution,
  • efficiency savings through code re-use
were estimated. The final figure suggested a year on year OPEX saving of 60% per application. Somewhat surprised at the size of the estimate I've challenge the group on several occasions, each time the response was that the estimates were conservative.

To turn this into some real numbers - consider the following. A tier 1 investment bank may have as many as ~1000 applications; each application typically costing $1m per annum. Lets assume that only 30% of the applications are suitable for migrating to the new world - we're still looking at a year on year saving of $200m. Migration costs are not included in this, but these are short term expenses. Likewise neither are the cost savings realized by replacing legacy JEE Application Server and middleware with the Service Fabric solution.

As always - 'mileage may vary' - but never the less, quite a value proposition for OSGi!

1 comment:

Hal Hildebrand said...

"That is not dead which can eternal lie... And with strange eons even death may die."

Just sayin'

:)

Nice post.