• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
How dense is the Cloud of OSGi - T Watson
 

How dense is the Cloud of OSGi - T Watson

on

  • 152 views

The use of OSGi technology has evolved over the past decade from being used to manage devices (service gateways etc.), to providing an extensible framework for desktop applications (Eclipse RCP), to ...

The use of OSGi technology has evolved over the past decade from being used to manage devices (service gateways etc.), to providing an extensible framework for desktop applications (Eclipse RCP), to being used by a majority of JEE servers for implementing extensible and modular servers, and as a programming model for developing server-side applications as well as applications deployed to the cloud. When deploying OSGi applications to the cloud the cost of the infrastructure that is required to run the application vs the isolation needs of each individual application must be taken into account. Various architectures are available that range from no-sharing to shared multitenant. With no-sharing each OSGi Application uses its own JVM and OSGi Framework instances in order to run the application. This provides nice isolation for each application but adds additional overhead for each application deployed. Other application models exist, such as OSGi subsystems, that allow applications to share the same JVM and OSGi framework instance to host multiple applications. While this model can provide optimal sharing, it comes at the cost of significantly reducing isolation for each application deployed to the shared OSGi Framework.

This talk will look at opportunities for OSGi applications to take advantage of a Multitenant JVM [1]. A multitenant JVM enables application deployments to gain the advantages of sharing the JVM while maintaining better isolation than can be achieved when a traditional JVM is shared. There are many issues an OSGi Framework implementation must consider when supporting a multitenant JVM in order to share the most resources across the tenants while maintaining the correct level of isolation. This talk will discuss the various issues and (hopefully) some the solutions in the context of the Equinox OSGi Framework implementation.

[1] http://www.ibm.com/developerworks/java/library/j-multitenant-java/

Bio:
Tom Watson is a Senior Software Engineer at IBM with years of experience as a developer. His focus is on the architecture and development of OSGi technologies. He is the Equinox project lead at Eclipse, the lead of the EclipseRT Project Management Committee (PMC) and the lead IBM developer for the Equinox OSGi Framework implementation in Eclipse.

Tom has been involved in the development of OSGi technologies since 2002 and plays a key role in the adoption of OSGi technologies by the Eclipse platform. He is currently a member of the OSGi Core Platform Expert Group (CPEG) and made significant contributions to the OSGi specifications over the years.

Statistics

Views

Total Views
152
Views on SlideShare
152
Embed Views
0

Actions

Likes
1
Downloads
10
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    How dense is the Cloud of OSGi - T Watson How dense is the Cloud of OSGi - T Watson Presentation Transcript

    • © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license HOW DENSE IS THE CLOUD OF OSGI? Tom Watson IBM June 11th 2014 OSGi Alliance Marketing © 2008-2010 . All Rights ReservedPage 1
    • Page 2 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Agenda • Applications and OSGi • Cost of deploying an application • Sharing resources, density and multi-tenant VMs • Equinox enhancements to increase density • Limitations
    • Page 3 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Applications • What is Required to Run • JVM JVM
    • Page 4 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license JVM OSGi Applications • What is Required to Run • JVM • OSGi Framework Framework
    • Page 5 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license JVM OSGi Applications • What is Required to Run • JVM • OSGi Framework • A set of bundles Framework Bundles
    • Page 6 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Applications – Cost • Each OSGi application instance pays the overhead cost • JVM • Framework • A set of bundles JVM Framework A B Bundles X Y Z JVM Framework A B Bundles JVM Framework A B Bundles
    • Page 7 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Multi-tenancy vs. Multi-instance • Multitenancy refers to a principle in software architecture where a single instance of the software runs on a server, serving multiple client organizations (tenants). • Multitenancy is contrasted with a multi-instance architecture where separate software instances (or hardware systems) are set up for different client organizations. • With a multitenant architecture, a software application is designed to virtually partition its data and configuration, and each client organization works with a customized virtual application instance.
    • Page 8 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Applications - Subsystems • OSGi Subsystems can help • Single JVM JVM
    • Page 9 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license JVM OSGi Applications - Subsystems • OSGi Subsystems can help • Single JVM • Single OSGi Framework Framework
    • Page 10 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license JVM OSGi Applications - Subsystems • OSGi Subsystems can help • Single JVM • Single OSGi Framework • Applications are isolated with a subsystem (tenant?) Framework Bundles Bundles X Y A B A B
    • Page 11 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license JVM OSGi Applications - Subsystems • OSGi Subsystems can help • Single JVM • Single OSGi Framework • Applications are isolated with a subsystem (tenant?) • Packages and services can be shared directly Framework Bundles Bundles X Y Root A B Shared Bundles
    • Page 12 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license JVM OSGi Applications - Subsystems • Advantages • Maximize sharing • Directly share OSGi Services and other shared objects. • Disadvantages • Applications must play nicely with shared resources • Unable to monitor resource consumption • Requires modifications to component models to understand subsystems • DS, Blueprint, Config ... Framework Bundles Bundles X Y Root A B Shared Bundles
    • Page 13 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Multi-tenant JVM • A standard java invocation creates a dedicated (non-shared) JVM in each processes JVM java1 JVM java2 JVM java3
    • Page 14 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Multi-tenant JVM • A standard java invocation creates a dedicated (non-shared) JVM in each processes • IBM's Multitenant JVM puts a lightweight 'proxy' JVM in each java invocation. The 'proxy' knows how to communicate with the shared JVM deamon called javad • javad is launched and shuts down automatically • No changes required to applications • javad process is where aggressive sharing of runtime artifacts happen JVM java1 JVM java2 JVM java3 proxy java1 proxy java2 proxy java3 JVM javad
    • Page 15 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Multi-tenant JVM – Tenant Isolation • Each tenant behaves like a dedicated JVM • Static APIs only effect the tenant they are being called from: System.exit, System.getProperty • No visibility to other tenant threads • Sharing occurs at the class loader • Eliminates loading of duplicate classes that are shared across applications • Allows the sharing of compiled (JIT) code • A single GC instead of one for each JVM instance
    • Page 16 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Multi-tenant JVM – Class Loaders global scope (shared) Bootstrap loader Ext loader App loader App loader tenant scope #1 (private) tenant scope #2 (private) Sharing only the classes available from boot and ext All other classes are NOT shared
    • Page 17 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Multi-tenant JVM – OSGi Applications X JVM javad • Each OSGi application instance pays the overhead cost • JVM – now sharing the JVM, boot and ext class loaders • Framework – Loaded above the JVM, not shared • Bundles – Loaded above the framework, not shared proxy java1 Yproxy java2 Zproxy java3 Boot CP Framework A B Bundles Framework A B Bundles Framework A B Bundles TenantXTenantYTenantZ
    • Page 18 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Increasing Density • Multi-tenant JVM increases density by loading more classes with class loaders in the shared scope • Boot and ext class loaders can be shared because they are consistent across tenants • OSGi is dynamic! • Bundles are resolved at runtime and may get different wirings depending on what is installed • Dynamic imports allow the wiring for a particular bundle to change over time • OSGi weaving hooks may weave bytes differently across tenants
    • Page 19 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license What Can We Share? • The launcher and the framework implementation • Adding the launcher and framework implementation to the boot or ext loader allows the framework implementation classes to be shared • But most OSGi applications (hopefully) have more code than the framework implementation has • What rules are required to allow OSGi application classes to be shared? • What limitations do these rules impose on the bundles that can be shared?
    • Page 20 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders • A subset of declared requirement types effect the OSGi class loader • The package, bundle and host requirements all have an effect on the overall OSGi class loader graph. • Resolved bundles form a directed graph between the requirers and the providers • Connections are referred to as wires • A wiring for a bundle is the complete list of required wires • If the wiring for a bundle is identical between multiple tenants then it has potential for sharing
    • Page 21 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content Bundles
    • Page 22 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA SHA: A SHA: C SHA: D SHA: B SHA: E SHA: F Bundles
    • Page 23 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA • Dynamic imports cause unknown SHA SHA: A SHA: C SHA: D SHA: B SHA: E SHA: F Bundles SHA: ?
    • Page 24 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA • Dynamic imports cause unknown SHA • Identify bundle wiring • Build a SHA based on bundle content SHA values SHA: A SHA: C SHA: D SHA: B SHA: E SHA: F Bundles SHA: ?
    • Page 25 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA • Dynamic imports cause unknown SHA • Identify bundle wiring • Build a SHA based on bundle content SHA values • Seed with the SHA of the wiring's resource SHA: A SHA: C SHA: D SHA: B P B SHA: E SHA: F Bundles SHA: ? A
    • Page 26 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA • Dynamic imports cause unknown SHA • Identify bundle wiring • Build a SHA based on bundle content SHA values • Seed with the SHA of the wiring's resource • Merge in SHA of attached fragments SHA: A SHA: C SHA: D SHA: B H P B SHA: E SHA: F Bundles SHA: ? A + B
    • Page 27 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA • Dynamic imports cause unknown SHA • Identify bundle wiring • Build a SHA based on bundle content SHA values • Seed with the SHA of the wiring's resource • Merge in SHA of attached fragments • Merge in SHA of resources providing package and bundle wires SHA: A SHA: C SHA: D SHA: B H P B SHA: E SHA: F Bundles SHA: ? A + B + C
    • Page 28 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA • Dynamic imports cause unknown SHA • Identify bundle wiring • Build a SHA based on bundle content SHA values • Seed with the SHA of the wiring's resource • Merge in SHA of attached fragments • Merge in SHA of resources providing package and bundle wires SHA: A SHA: C SHA: D SHA: B H P B SHA: E SHA: F Bundles SHA: ? A + B + C + D
    • Page 29 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA • Dynamic imports cause unknown SHA • Identify bundle wiring • Build a SHA based on bundle content SHA values • Seed with the SHA of the wiring's resource • Merge in SHA of attached fragments • Merge in SHA of resources providing package and bundle wires • Perform transitive closure for package and bundle requirements SHA: A SHA: C SHA: D SHA: B H P B SHA: E SHA: F P B Bundles SHA: ? A + B + C + D + E + F = Unique CL ID
    • Page 30 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loaders – Unique Wirings • Identify bundle resources • Calculate the SHA of the content • Only support jar'ed because it is easy to compute the SHA • Dynamic imports cause unknown SHA • Identify bundle wiring • Build a SHA based on bundle content SHA values • Seed with the SHA of the wiring's resource • Merge in SHA of attached fragments • Merge in SHA of resources providing package and bundle wires • Perform transitive closure for package and bundle requirements • If an unknown content SHA is encountered then the wiring SHA is unknown (not shared) SHA: A SHA: C SHA: D SHA: B H P B SHA: E SHA: F P B Bundles SHA: ? P A + B + C + D + E + F + ? = ?
    • Page 31 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Discovering Shared OSGi Loaders New java process X is started and a Framework instance is created in for tenant X in javad. Framework classes are shared. X javad proxy java1 Framework TenantX JVM Boot CP Framework
    • Page 32 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Discovering Shared OSGi Loaders X javad proxy java1 Framework Bundles TenantX A B C D JVM Boot CP A B C Framework Bundles A, B, C & D are installed. Wiring unique ID (SHA) is successfully computed for A, B and C. Shared loaders A, B & C are created. A tenant specific loader D is created.
    • Page 33 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Discovering Shared OSGi Loaders X javad proxy java1 Yproxy java2 Framework Bundles Framework TenantXTenantY A B C D JVM Boot CP A B C Framework New java process Y is started and a Framework instance is created in for tenant Y in javad. Framework classes are shared.
    • Page 34 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Discovering Shared OSGi Loaders X JVM javad proxy java1 Yproxy java2 Boot CP Framework Bundles Framework Bundles TenantXTenantY A B C A B C D A B EFramework C Bundles A, B, C & E are installed. Wiring unique ID (SHA) is successfully computed for A, B and C. Shared loaders A, B & C are found. A tenant specific loader E is created.
    • Page 35 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Discovering Shared OSGi Loaders Even though each tenant does not have identical bundles installed they are able to share classes that are common X javad proxy java1 Yproxy java2 Zproxy java3 Framework Bundles Framework Bundles Framework Bundles TenantXTenantYTenantZ A B C D A B A B F EC C JVM Boot CP A B C Framework
    • Page 36 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Discovering Shared OSGi Loaders In order to provide proper isolation objects are not shared, only classes and loaders This is not as dense as using subsystems, but it provides much better isolation X javad proxy java1 Yproxy java2 Zproxy java3 Framework Bundles Framework Bundles Framework Bundles TenantXTenantYTenantZ A B C D A B A B F EC C JVM Boot CP A B C Framework
    • Page 37 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loader - Multiplexing • OSGi loaders must implement the BundleReference interface • ProtectionDomain must provide the correct answers for each tenant • Resource URLs must be tenant specific javad Framework Bundles TenantX A A
    • Page 38 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loader - Multiplexing • OSGi loaders must implement the BundleReference interface • ProtectionDomain must provide the correct answers for each tenant • Resource URLs must be tenant specific javad Framework Bundles TenantX A{ } Registers A tenantMap tenantID_X → clTenant_X
    • Page 39 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loader - Multiplexing • OSGi loaders must implement the BundleReference interface • ProtectionDomain must provide the correct answers for each tenant • Resource URLs must be tenant specific javad Framework Bundles TenantX A Framework Bundles TenantY A Registers A tenantMap tenantID_X → clTenant_X tenantID_Y → clTenant_Y{ }
    • Page 40 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loader - Multiplexing • OSGi loaders must implement the BundleReference interface • ProtectionDomain must provide the correct answers for each tenant • Resource URLs must be tenant specific javad Framework Bundles TenantX A Framework Bundles TenantY A tenantID_X → clTenant_X tenantID_Y → clTenant_Y A ((BundleReference) loaderA).getBundle(); tenantMap getBundle() { }
    • Page 41 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loader - Multiplexing • OSGi loaders must implement the BundleReference interface • ProtectionDomain must provide the correct answers for each tenant • Resource URLs must be tenant specific javad Framework Bundles TenantX A Framework Bundles TenantY A tenantID_X → clTenant_X tenantID_Y → clTenant_Y A ((BundleReference) loaderA).getBundle(); tenantMap tenantMap.get(tenantID_X).getBundle(); getBundle() { }
    • Page 42 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license IBM JVM Multitenant - Notes • Available in Java 7 (64-bit) • Multitenant support is available as a tech preview https://www.ibm.com/developerworks/java/jdk/linux/download.html • Additional patches to the VM are necessary • Create and discovery of shared class loaders with unique IDs • Equinox enhancements are implemented as an equinox extension on top of Luna.
    • Page 43 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license Results? Memory (megabytes) 0 50 100 150 200 250 300 350 400 450 500 Startup Time (seconds) 0 5 10 15 20 25 30 35 40 45 Standard MT MT + Framework MT + Framework + Bundles • Starting 10 Liberty Servers • Minimal server configuration • Servlet support only + OSGi console • About 75 bundles, most all shareable • MT javad fully initialized • Shared class loaders already created • Classes loaded for startup • JIT cache populated
    • Page 44 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license OSGi Loader - Limitations • Dynamic imports kill ability to share • Must not share class loaders for bundles that need weaving • Native code may be able to be shared if no global state is stored in native code • Lazy activated bundles are not supported
    • Page 45 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license New OSGi Specifications • Last week (week of June 2nd ) the OSGi Core Release 6 Specification received its final approval and will be available this week to the public for downloading. – http://www.osgi.org/Specifications/HomePage • Also happening last week, the OSGi Board of Directors approved the publication of an Early Draft Specification of OSGi Enterprise Release 6 for downloading. – http://www.osgi.org/Specifications/Drafts
    • Page 46 © 2014 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license IBM and WebSphere are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at “Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml. Trademarks