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.
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.