Jan Rellemeyer, Research Staff Member, IBM Research, @rellermeyer
Modularization of software is key to handling the inherent complexity of distributed applications like for
the Internet of Things (IoT) and provide a flexible environment to evolve applications and manage their
deployment effectively. OSGi is a popular framework for dynamic modules for the Java language. Eclipse
Concierge provides a clean, small and lightweight implementation of the OSGi core framework
specification, specifically tailored to embedded systems and IoT.
Lean and Easy IoT Applications with OSGi and Eclipse Concierge
1. #DevoxxUS
Lean and Easy IoT Applications
with OSGi and Eclipse Concierge
Jan S. Rellermeyer, IBM Research
#eclipseIoT @rellermeyer
2. #DevoxxUS
THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES
ONLY.
WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION
CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.
ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED
ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR
INFRASTRUCTURE DIFFERENCES.
ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE.
IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT
PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.
IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF
THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.
NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
- CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR
THEIR SUPPLIERS AND/OR LICENSORS
Important Disclaimers
#eclipseIoT @rellermeyer
4. #DevoxxUS
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
• Every bundle is loaded through a separate classloader
Monitoring system state through events
#eclipseIoT @rellermeyer
Module
Module Module
5. #DevoxxUS
OSGi Framework
OSGi Framework
BundleA
Package 1
Package 2
Package 3
BundleB
Package I
Package II
Exported Package Exported Package
Private Package
Import
Export-Package: Package 1 Export-Package: Package I, Package II
Import-Package: Package 1
#eclipseIoT @rellermeyer
6. #DevoxxUS
OSGi Service Layer
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
Module
Module Module
Interface
Implementation
Service Service
#eclipseIoT @rellermeyer
7. #DevoxxUS
OSGi for IoT
IoT systems are often dynamic
•Sensors and actuators might not always be available
•N:M relationship between producers and consumers
Event
Source
Event
Listener
Service
gets registers
receives service life-cycle events
Service Registry
#eclipseIoT @rellermeyer
8. #DevoxxUS
Eclipse Concierge
Full OSGi core R5 compatibility
• Goal achieved
Keep a small footprint to work well on embedded
devices
• 250kiB without debug symbols
• 330kiB with debug symbols
Remain “readable”
• Currently 9 classes
Remain backwards-compatible
• Java 5
#eclipseIoT @rellermeyer
9. #DevoxxUS
Building IoT Applications
• Concierge supports Knopflerfish-style xargs file for startup
• Enhanced property (variable replacement) and install notation (wildcard support)
• Supports start level in scripts (-level <n>)
#eclipseIoT @rellermeyer
$ java -jar framework/org.eclipse.concierge-5.0.0.*.jar samples/demo.xargs
# demo.xargs
-Dorg.osgi.framework.system.packages.extra+=javax.xml.parsers
# -Drepo=http://www.us.apache.org/dist/felix
-Drepo=localRepo
# load bundles, use wildcard notation for local files, not for URLs
-istart bundles/org.eclipse.concierge.shell-5.0.0.*.jar
-istart bundles/org.eclipse.concierge.service.startlevel-5.0.0.*.jar
-istart bundles/org.eclipse.concierge.service.packageadmin-5.0.0.*.jar
-istart ${repo}/org.apache.felix.httplite.complete-0.1.4.jar
-istart ${repo}/org.apache.felix.webconsole-4.2.14-all.jar
10. #DevoxxUS
Remote Management
• RESTful interface
• Exposing the framework and its internal state as resources
• Bundles
• Services
• Easy management of OSGi deployments through REST
• Command line tools
• Web interfaces
• Application-level
#eclipseIoT @rellermeyer
13. #DevoxxUS
Use Case: OSGi enRoute
OSGi enRoute uses OSGi R6 and bndtools
• R6 implementation of Concierge available as a snapshot
• OSGi repository hosted at the Concierge website
#eclipseIoT @rellermeyer
14. #DevoxxUS
Experiments
Beaglebone Rev A5
•AM335x 720MHz ARM Cortex-A8
•256 MiB DDR2 RAM
•4 GiB microSD card
•Angstrom Linux
•Java SE Embedded 1.7.0_21-b11 and
•Java SE Embedded build 1.8.0_06-b23 compact1
Image: http://beaglebone.org
Raspberry Pi B
•ARM1176JZF-S 700 MHz ARM 11
•512 MiB SDRAM (shared with GPU)
•8 GiB SDHD card
•Raspbian Linux
•Java SE build 1.8.0-b132
#eclipseIoT @rellermeyer
15. #DevoxxUS
Experiments
Eclipse Equinox
• version 3.11.2.v20161107-1947
• 1.3 MiB
• (R6 framework)
Apache Felix
• version 5.6.2
• 697 kiB
Knopflerfish
• version 7.2.0
• 609kiB / 320kiB compact
Concierge
• version 5.1.0 SNAPSHOT
• 248kiB
16. #DevoxxUS
Performance – Startup Time
#eclipseIoT @rellermeyer
0
2
4
6
8
10
12
14
16
18
20
Beaglebone ejre7 Beaglebone ejre8 Raspberry Pi
time(s)
VM
Concierge
Equinox
Felix
Knopflerfish
17. #DevoxxUS
Performance – Service Registry
Stress test
Register 10000 services
• Each one has a random value for the same key
• Range: byte => collisions
Perform 1000 lookups (getServiceReferences) for a random value
• Range: byte
Unregister the 10000 services
Registry
#eclipseIoT @rellermeyer
18. #DevoxxUS
Performance – Service Registry
0
2000
4000
6000
8000
10000
12000
14000
16000
Beaglebone ejre7 Beaglebone ejre8 Raspberry Pi
time (ms)
Service Registration
Concierge
Equinox
Felix
Knopflerfish
#eclipseIoT @rellermeyer
19. #DevoxxUS
Performance – Service Registry
0
100000
200000
300000
400000
500000
600000
700000
Beaglebone ejre7 Beaglebone ejre8 Raspberry Pi
time (ms)
Service Lookup
Concierge
Equinox
Felix
Knopflerfish
#eclipseIoT @rellermeyer
20. #DevoxxUS
Performance – Service Registry
0
1000
2000
3000
4000
5000
6000
Beaglebone ejre7 Beaglebone ejre8 Raspberry Pi
time (ms)
Service Unregistration
Concierge
Equinox
Felix
Knopflerfish
#eclipseIoT @rellermeyer
21. #DevoxxUS
Performance – Resolver
Generate 1000 “random bundles”
• Can either import or export up to 5 packages
• Choice of 50 packages in total
• For exports: generate a random package version from [1.0.0-21.0.0)
• For import: generate a random import range from the interval.
Install all 1000 bundles
Resolve the bundles
Benchmark turned out to be rather volatile…
#eclipseIoT @rellermeyer
24. #DevoxxUS
Eclipse Concierge
Concierge is an OSGi framework
optimized for embedded devices
and the Internet of Things
#eclipseIoT @rellermeyer
http://eclipse.org/concierge
Project
Homepage
https://github.com/eclipse/concierge
Clone it
from here It’s simplicity and usability can help
you with developing complex IoT
applications with ease.