OSGi Multi-Tenancy with Regions – Case Study

Proposal

WSO2 Carbon is an OSGi based server framework. One of the core features of the upcoming WSO2 Carbon 5.0 (C5 kernel) is to provide multi-tenacy aspect at server framework level. In previous carbon versions, the multi-tenancy aspect was limited to run-time execution only. In there,  the Axis2 Configuration & Context model to achieve the multi-tenancy where each tenant got its own execution space during run-time. But the OSGi environment was not partitioned for tenants and was visible to all, where a bundle (the library and its packages) installed by a tenant was visible to other tenants as well.

The idea here is to implement Multi-Tenancy at OSGi framework level also, so that each tenant gets its totally isolated run-time environment. One possible approach here is to use OSGi “Regions” concept proposed by Eclipse Virgo, to achieve this with the usage of OSGi framework hooks. A region is a grouping of bundles in an OSGi run-time, which is governed by controls when accessing resources (packages, services) from other regions.

How it will work

This is a high level view of how this will work. This does not focus on any implementation details.

Each tenant gets its own region and there will be a separate “Kernel” region where the core bundles, packages and services will be residing. These will be exposed to tenant regions. We can still limit and filter on what to expose from kernel region. Each tenant region will be isolated from each other. They will not see any events related to bundles or services. The package visibility will also be filtered from other regions, but they can only see from within their region self and kernel region.

Below image is high level view of this concept.

OSGi Multi Tenancy

Below are the overview of the initially planned framework hooks to implement this feature.

  • CarbonRegionResolverHook – manages the package resolve process for requirements from bundles in regions.
  • CarbonRegionBundleFindHook – manages/filters the BundleContext.getBundle lookups from region bundles.
  • CarbonRegionBundleEventHook – manages/filters the bundle’s life-cycle events for regions.
  • CarbonRegionBundleCollisionHook – manages the duplicate bundle resolving in multiple regions. This will facilitate to have same bundles in different regions.
  • CarbonRegionServiceFindHook and CarbonRegionServiceEventHook – manages/filters the service lookup and life-cycle events for regions.
Advertisements

About kishanthan

I’m currently working as a Software Engineer at WSO2, an open source software company. I hold an Engineering degree, majoring in Computer Science & Engineering field, from University of Moratuwa, Sri Lanka.
This entry was posted in Carbon, Carbon5, OSGi, WSO2 and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s