Concierge: Bringing OSGi (Back) to Embedded Devices

33
© 2013 IBM Corporation Concierge: Bringing OSGi (Back) to Embedded Devices Jan S. Rellermeyer, IBM Research Jan S. Rellermeyer 24 Sep 2013

description

JavaOne 2013 Talk on bringing OSGi back to embedded devices through Concierge, a new version of the optimized OSGi core framework implementation.

Transcript of Concierge: Bringing OSGi (Back) to Embedded Devices

Page 1: Concierge: Bringing OSGi (Back) to Embedded Devices

© 2013 IBM Corporation

Concierge: Bringing OSGi (Back) to Embedded Devices Jan S. Rellermeyer, IBM Research

Jan S. Rellermeyer

24 Sep 2013

Page 3: Concierge: Bringing OSGi (Back) to Embedded Devices

Embedded Devices Are Evolving

We see a new class of embedded systems emerging

Advanced processors

Larger set of capabilities

Enhanced user interface / user experience

Open platforms for a software ecosystem

3

Image: www.apple.com

Page 5: Concierge: Bringing OSGi (Back) to Embedded Devices

Continuous Platform Experience

5

Cloud Softw

are Stack

Embedded Device Image: http://www.raspberrypi.org

ESSC

Page 6: Concierge: Bringing OSGi (Back) to Embedded Devices

OSGi

Dynamic Module System for the Java Runtime

Original domain: Home Gateway – Multiple software packages need to co-exist on the same machine – Long-running software – Periodic maintenance and updates requires – Ideally with minimal downtime and no interruption of unrelated software packages

6

• Java on the Embedded Device • Pros:

• bridges heterogeneity • can run the same code in the cloud or on the device

• Cons:

• updates and maintenance

Page 7: Concierge: Bringing OSGi (Back) to Embedded Devices

Module Management

Traditional Java: The mystical class path

java –cp commons-X.jar:foo.jar:bar.jar my.application.MainClass

• Which module contains the main class? • What are the dependencies between foo.jar and bar.jar? • What happens if bar.jar is upgraded to bar-1.01.jar?

Page 8: Concierge: Bringing OSGi (Back) to Embedded Devices

OSGi – Module Layer

Modules are called Bundles – JAR files with additional metadata

Runtime system: The Framework – Lifecycle management

Bundles implement isolation and locality

Interaction between bundles is limited – Shared code through package imports – Inter-bundle calls through services – Monitoring system state through events

Page 9: Concierge: Bringing OSGi (Back) to Embedded Devices

The Lifecycle of a Bundle

Management: Install / Start / Stop / Uninstall bundles at runtime.

OSGi keeps track of dependencies

What happens if a Bundle is uninstalled?

From the OSGi Core Specifications

Page 10: Concierge: Bringing OSGi (Back) to Embedded Devices

The OSGi Framework

OSGi Framework

Bundle A

Package 1Package 2Package 3

Bundle B

Package IPackage II

Exported Package Exported Package

Private Package

Import

Export-Package: Package 1 Export-Package: Package I, Package II

Import-Package: Package 1

• Packages can be versioned • OSGi encourages semantic versioning of bundles and packages

Page 11: Concierge: Bringing OSGi (Back) to Embedded Devices

OSGi Services: Reducing Coupling

Modules allow for a compositional approach to building applications

But: Package dependencies are explicit. – Limits the modularity!

Solution: Services – Idea: Separate the interface from the implementation

Interface

Implementation

Module

Module Module Service Service

Page 12: Concierge: Bringing OSGi (Back) to Embedded Devices

The Service Registry

The OSGi framework maintains a central service registry

Bundles can register their own services and retrieve services provided by other bundles

Services can be registered with a set of properties – Additional description of the service, can be used to model constraints or do

“best fit matching”

No runtime overhead for using services after lookup! Registry

Page 13: Concierge: Bringing OSGi (Back) to Embedded Devices

OSGi Services

Composition at runtime

Loosely-coupled interaction through services

The system is dynamic

13

Page 14: Concierge: Bringing OSGi (Back) to Embedded Devices

14

Concierge

Question: What is the (minimum) overhead of OSGi?

My answer: Concierge – OSGi R3 core implementation developed during my PhD at ETH

Zurich – optimized for mobile and embedded devices, has a footprint of only

86kB – People found the source code readable and understandable: 7

Java classes + 7 inner classes.

[J.S. Rellermeyer and G. Alonso: Concierge – A Service Platform for Resource-Constrained Devices. In: EuroSys 2007].

Image: http://www.linksys.com

Page 15: Concierge: Bringing OSGi (Back) to Embedded Devices

15

Consistency across Platforms

iPAQ 3870 Linux Familiar 0.8 SA-1110 CPU 64 MB RAM SableVM

Zaurus 5500G Linux Embedix SA-1110 CPU 64 MB RAM Sun cvm

Nokia 9300i SymbianOS TI OMAP 1510 CPU 80 MB RAM IBM J9

iPAQ 5550 Windows Mobile PXA255 CPU 128 MB RAM IBM J9

LinkSys NSLU2 Unslung IXP420 CPU 32 MB RAM JamVM

Page 16: Concierge: Bringing OSGi (Back) to Embedded Devices

16

Performance influence of the final modifier

Page 17: Concierge: Bringing OSGi (Back) to Embedded Devices

17

Evaluation (Small Devices)

Page 18: Concierge: Bringing OSGi (Back) to Embedded Devices

Example: The BUG Platform

18

Embedded Linux Device

Runs Java (PhoneME) and OSGi

Pluggable hardware modules

Registers OSGi services

Applications are OSGi bundles

Image: http://www.buglabs.com

Page 19: Concierge: Bringing OSGi (Back) to Embedded Devices

OSGi R3

OSGi R3: “unique” bundles and packages

19

my.bundle.one my.bundle.two exports my.package

imports

Page 20: Concierge: Bringing OSGi (Back) to Embedded Devices

OSGi R4

OSGi R4: multiple versions, class spaces

Fragments

Require-Bundle

20

my.bundle.one 1.0 my.bundle.two exports my.package; version 1.0

imports

my.bundle.one 2.0 exports my.package; version 2.0

Page 21: Concierge: Bringing OSGi (Back) to Embedded Devices

OSGi R5

OSGi R5: generic requirements and capabilities

Many hooks into the framework to manipulate the observed state

21

my.bundle.one 1.0

my.bundle.two

Provide capability foo.bar{a=10, b=[1,2,3]}

Require capability foo.bar filter=(!(a>10))

Page 22: Concierge: Bringing OSGi (Back) to Embedded Devices

Generic vs. Optimized

22

Packages Bundles

Generic Capabilities

Page 23: Concierge: Bringing OSGi (Back) to Embedded Devices

Concierge goes Eclipse

Targets:

Full OSGi core R5 compatibility

Keep a small footprint to work well on embedded devices – Currently < 350kB footprint

Remain “readable” – Currently 9 classes

Remain backwards-compatible

Being a sandbox for innovation around OSGi

23

Image: http://www.eclipse.org

Page 24: Concierge: Bringing OSGi (Back) to Embedded Devices

Demo

BeagleBone AM335x 720MHz ARM Cortex-A8

256MB DDR2 RAM

4GB microSD card

runs Angstrom Linux Distribution

Java SE Embedded 1.7.0_21-b11

Concierge R5 alpha

24

Image: http://www.beaglebone.org

Page 25: Concierge: Bringing OSGi (Back) to Embedded Devices

REST Interface

Designed for the cloud

Very useful for embedded systems as well Examples

– GET http://my_host/framework/bundles/representations – POST http://my_host/framework/bundles

– GET http://my_host/framework/bundle/5/state – GET http://my_host/framework/services/(objectClass=org.osgi.*)/representations/

This is work in progress (RFC 182)

http://www.osgi.org/download/osgi-early-draft-2013-03.pdf

25

Page 26: Concierge: Bringing OSGi (Back) to Embedded Devices

Location Transparency: Remote Service Invocation

26

Page 27: Concierge: Bringing OSGi (Back) to Embedded Devices

Juggle

Model critical functionality as services –Module with hardware-accelerated

service

–Co-Module with dynamically

accelerated service

“Juggle” with the accelerators

27

Page 28: Concierge: Bringing OSGi (Back) to Embedded Devices

Juggle Prototype System

Xilinx Virtex-II Pro

PPC 440 core, 300 MHz

256 MB DDR SRAM

Linux 2.6.35 (patched)

JVM –IcedTea Zero, IcedTea Cacao, or IBM J9

OSGi Framework – Concierge

Juggle – Adds support for loading and managing co-bundles – Manages the FPGA and the reprogramming

28

Image: http://www.xilinx.com

Page 29: Concierge: Bringing OSGi (Back) to Embedded Devices

Evaluation

PRR of about 16% of the chip real estate

Reprogramming time: 11 – 25 msec.

(Literature: max. 30 msec) Switching the socket bridge: 3 msec.

Initial load time for a hardware accelerated bundle: ~ 100 msec.

Initial load time for a co-bundle: < 1sec

29

Page 30: Concierge: Bringing OSGi (Back) to Embedded Devices

Evaluation: Triple-DES

30

Page 31: Concierge: Bringing OSGi (Back) to Embedded Devices

TDES with hardware acceleration

31

Page 32: Concierge: Bringing OSGi (Back) to Embedded Devices

© Copyright IBM Corporation 2013. All rights reserved. The information contained in these materials is provided for informational purposes only, and is provided AS IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, these materials. Nothing contained in these materials is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software. References in these materials to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in these materials may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. IBM, the IBM logo, Rational, the Rational logo, Telelogic, the Telelogic logo, and other IBM products and services are trademarks of the International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.

Page 33: Concierge: Bringing OSGi (Back) to Embedded Devices

Legal Disclaimer

• © IBM Corporation 2013. All Rights Reserved. • The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained

in this publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are subject to change by IBM without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.

• References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.

• Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.

• IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, other countries, or both. • Java and all Java-based trademarks are trademarks of Oracle Corporation, Inc. in the United States, other countries, or both. • Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both. • Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of

others.